Skip to content

Commit

Permalink
Introducing SYCL implementations/variants (SCC, SCC-HOIST, SCC-K-CACH…
Browse files Browse the repository at this point in the history
…ING)
  • Loading branch information
MichaelSt98 committed Dec 13, 2023
1 parent 22fc989 commit a471d1c
Show file tree
Hide file tree
Showing 19 changed files with 11,010 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ options :
cmake: >
ENABLE_HIP=ON
- with-sycl :
help: Enable GPU kernel variant based on HIP
cmake: >
ENABLE_SYCL=ON
- with-mpi :
help : Enable MPI-parallel kernel
cmake : ENABLE_MPI=ON
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ add_subdirectory(cloudsc_python)
add_subdirectory(cloudsc_c)
add_subdirectory(cloudsc_cuda)
add_subdirectory(cloudsc_hip)
add_subdirectory(cloudsc_sycl)
add_subdirectory(cloudsc_gpu)
add_subdirectory(cloudsc_loki)
144 changes: 144 additions & 0 deletions src/cloudsc_sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# (C) Copyright 1988- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# Define this dwarf variant as an ECBuild feature
ecbuild_add_option( FEATURE CLOUDSC_SYCL
DESCRIPTION "Build the SYCL version CLOUDSC using Serialbox" DEFAULT ON
CONDITION Serialbox_FOUND AND HAVE_SYCL
)

if( HAVE_CLOUDSC_SYCL )

set(LINK_SYCL OFF)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
set(LINK_SYCL ON)
endif()

ecbuild_add_library(
TARGET dwarf-cloudsc-scc-sycl-lib
INSTALL_HEADERS LISTED
SOURCES
cloudsc/yoecldp_c.h
cloudsc/load_state.h
cloudsc/load_state.cpp
cloudsc/cloudsc_c.kernel
cloudsc/cloudsc_driver.h
cloudsc/cloudsc_driver.cpp
cloudsc/cloudsc_validate.h
cloudsc/cloudsc_validate.cpp
cloudsc/mycpu.h
cloudsc/mycpu.cpp
PUBLIC_INCLUDES
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cloudsc>
PUBLIC_LIBS
$<$<BOOL:${LINK_SYCL}>:sycl>
Serialbox::Serialbox_C
$<${HAVE_OMP}:OpenMP::OpenMP_C>
)


ecbuild_add_executable(
TARGET dwarf-cloudsc-scc-sycl
SOURCES dwarf_cloudsc.cpp
LIBS dwarf-cloudsc-scc-sycl-lib
)

ecbuild_add_test(
TARGET dwarf-cloudsc-sycl-serial
COMMAND bin/dwarf-cloudsc-scc-sycl
ARGS 1 1000 128
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../..
OMP 1
)

######

ecbuild_add_library(
TARGET dwarf-cloudsc-scc-hoist-sycl-lib
INSTALL_HEADERS LISTED
SOURCES
cloudsc/yoecldp_c.h
cloudsc/load_state.h
cloudsc/load_state.cpp
cloudsc/cloudsc_c_hoist.kernel
cloudsc/cloudsc_driver_hoist.h
cloudsc/cloudsc_driver_hoist.cpp
cloudsc/cloudsc_validate.h
cloudsc/cloudsc_validate.cpp
cloudsc/mycpu.h
cloudsc/mycpu.cpp
PUBLIC_INCLUDES
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cloudsc>
PUBLIC_LIBS
$<$<BOOL:${LINK_SYCL}>:sycl>
Serialbox::Serialbox_C
$<${HAVE_OMP}:OpenMP::OpenMP_C>
)

ecbuild_add_executable(
TARGET dwarf-cloudsc-scc-hoist-sycl
SOURCES dwarf_cloudsc.cpp
LIBS dwarf-cloudsc-scc-hoist-sycl-lib
)

ecbuild_add_test(
TARGET dwarf-cloudsc-sycl-hoist-serial
COMMAND bin/dwarf-cloudsc-scc-hoist-sycl
ARGS 1 1000 128
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../..
OMP 1
)

######

ecbuild_add_library(
TARGET dwarf-cloudsc-scc-k-caching-sycl-lib
INSTALL_HEADERS LISTED
SOURCES
cloudsc/yoecldp_c.h
cloudsc/load_state.h
cloudsc/load_state.cpp
cloudsc/cloudsc_c_k_caching.kernel
cloudsc/cloudsc_driver.h
cloudsc/cloudsc_driver_k_caching.cpp
cloudsc/cloudsc_validate.h
cloudsc/cloudsc_validate.cpp
cloudsc/mycpu.h
cloudsc/mycpu.cpp
PUBLIC_INCLUDES
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cloudsc>
PUBLIC_LIBS
$<$<BOOL:${LINK_SYCL}>:sycl>
Serialbox::Serialbox_C
$<${HAVE_OMP}:OpenMP::OpenMP_C>
)

ecbuild_add_executable(
TARGET dwarf-cloudsc-scc-k-caching-sycl
SOURCES dwarf_cloudsc.cpp
LIBS dwarf-cloudsc-scc-k-caching-sycl-lib
)

ecbuild_add_test(
TARGET dwarf-cloudsc-sycl-k-caching-serial
COMMAND bin/dwarf-cloudsc-scc-k-caching-sycl
ARGS 1 1000 128
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../..
OMP 1
)

# Create symlink for the input data
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/../../data ${CMAKE_CURRENT_BINARY_DIR}/../../../data )

else()
ecbuild_info( "Serialbox not found, disabling SYCL version" )
endif()
Loading

0 comments on commit a471d1c

Please sign in to comment.