-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing SYCL implementations/variants #64
Changes from 3 commits
a471d1c
6986911
50bcf3f
e615fdf
82df8d3
22a11a8
0196a0a
ac90e14
ed0ced0
734b7ce
62dd862
b6be083
04ed5bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use |
||
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be linked to a check that SYCL is actually available.
We could do this adding
REQUIRED_PACKAGES "IntelSYCL"
(see https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2024-0/use-cmake-with-the-compiler.html).If we want to make this compatible with other SYCL implementations (e.g., whatever OpenSYCL is called these days), we could use this pattern: