-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix CTests in SYCL runs #153
base: develop
Are you sure you want to change the base?
Changes from all commits
cd8a9e5
8dd30e2
a9c2fd8
be5c90c
e4f899d
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 |
---|---|---|
|
@@ -29,6 +29,10 @@ macro(common) | |
option(OMEGA_DEBUG "Turn on error message throwing (default OFF)." OFF) | ||
option(OMEGA_LOG_FLUSH "Turn on unbuffered logging (default OFF)." OFF) | ||
|
||
if("${OMEGA_BUILD_TYPE}" STREQUAL "Debug" OR "${OMEGA_BUILD_TYPE}" STREQUAL "DEBUG") | ||
set(OMEGA_DEBUG ON) | ||
endif() | ||
|
||
if(NOT DEFINED OMEGA_CXX_FLAGS) | ||
set(OMEGA_CXX_FLAGS "") | ||
endif() | ||
|
@@ -120,7 +124,7 @@ macro(read_cime_config) | |
break() | ||
|
||
elseif("${arg}" STREQUAL "-n" OR "${arg}" STREQUAL "-N" OR | ||
"${arg}" STREQUAL "-c") | ||
"${arg}" STREQUAL "-c" OR "${arg}" STREQUAL "-np") | ||
set(SKIP_ARG TRUE) | ||
|
||
else() | ||
|
@@ -219,6 +223,9 @@ macro(init_standalone_build) | |
elseif(USE_HIP) | ||
set(OMEGA_ARCH "HIP") | ||
|
||
elseif(USE_SYCL) | ||
set(OMEGA_ARCH "SYCL") | ||
|
||
else() | ||
|
||
execute_process( | ||
|
@@ -294,7 +301,11 @@ macro(init_standalone_build) | |
set(_CtestScript ${OMEGA_BUILD_DIR}/omega_ctest.sh) | ||
file(WRITE ${_CtestScript} "#!/usr/bin/env bash\n\n") | ||
file(APPEND ${_CtestScript} "source ./omega_env.sh\n\n") | ||
file(APPEND ${_CtestScript} "ctest --output-on-failure $* # --rerun-failed\n\n") | ||
if(OMEGA_DEBUG) | ||
file(APPEND ${_CtestScript} "ctest --output-on-failure --verbose $* # --rerun-failed\n\n") | ||
else() | ||
file(APPEND ${_CtestScript} "ctest --output-on-failure $* # --rerun-failed\n\n") | ||
endif() | ||
|
||
# create a profile script | ||
set(_ProfileScript ${OMEGA_BUILD_DIR}/omega_profile.sh) | ||
|
@@ -422,10 +433,14 @@ macro(init_standalone_build) | |
file(APPEND ${_ProfileScript} " -o \$OUTFILE ./src/omega.exe 1000") | ||
|
||
elseif("${OMEGA_ARCH}" STREQUAL "SYCL") | ||
set(CMAKE_CXX_COMPILER ${OMEGA_SYCL_COMPILER}) | ||
set(CMAKE_CXX_COMPILER ${OMEGA_CXX_COMPILER}) | ||
|
||
if(OMEGA_SYCL_FLAGS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OMEGA_SYCL_FLAGS}") | ||
# add flags from upstream-E3SM | ||
if(SYCL_FLAGS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SYCL_FLAGS}") | ||
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. We want to add the "OMEGA_" prefix to all Omega-related CMake variables and prefer using "OMEGA_SYCL_FLAGS" instead of "SYCL_FLAGS." |
||
endif() | ||
if(OMEGA_SYCL_EXE_LINKER_FLAGS) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OMEGA_SYCL_EXE_LINKER_FLAGS}") | ||
endif() | ||
|
||
else() | ||
|
@@ -458,7 +473,7 @@ macro(init_standalone_build) | |
|
||
message(STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") | ||
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") | ||
# message(STATUS "CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}") | ||
message(STATUS "CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}") | ||
|
||
endmacro() | ||
|
||
|
@@ -512,10 +527,6 @@ macro(update_variables) | |
|
||
add_definitions(-DOMEGA_BUILD_MODE=${OMEGA_BUILD_MODE}) | ||
|
||
if("${OMEGA_BUILD_TYPE}" STREQUAL "Debug" OR "${OMEGA_BUILD_TYPE}" STREQUAL "DEBUG") | ||
set(OMEGA_DEBUG ON) | ||
endif() | ||
|
||
if(NOT DEFINED OMEGA_LOG_LEVEL) | ||
set(OMEGA_LOG_LEVEL "INFO") | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ target_link_libraries( | |
if(GKlib_FOUND) | ||
target_link_libraries( | ||
OmegaLibFlags | ||
PUBLIC | ||
INTERFACE | ||
gklib | ||
) | ||
endif() | ||
|
@@ -106,6 +106,6 @@ if(OMEGA_BUILD_EXECUTABLE) | |
OmegaLibFlags | ||
) | ||
|
||
set_target_properties(${OMEGA_EXE_NAME} PROPERTIES LINKER_LANGUAGE C) | ||
set_target_properties(${OMEGA_EXE_NAME} PROPERTIES LINKER_LANGUAGE CXX) | ||
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. Same as the above comment about using C linker instead of CXX. |
||
|
||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ enum FileFmt { | |
FmtHDF5 = PIO_IOTYPE_HDF5, ///< native HDF5 format | ||
FmtADIOS = PIO_IOTYPE_ADIOS, ///< ADIOS format | ||
FmtUnknown = -1, ///< Unknown or undefined | ||
FmtDefault = PIO_IOTYPE_NETCDF4C, ///< NetCDF4 is default | ||
FmtDefault = PIO_IOTYPE_PNETCDF, ///< work around HDF5 in SYCL runs | ||
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. Does this change, setting the default I/O type to PNETCDF, work on all machines, including Frontier, Perlmutter, and Chrysalis? |
||
}; | ||
|
||
/// File operations | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,14 +46,22 @@ function(add_omega_test test_name exe_name source_files mpi_args) | |
) | ||
endif() | ||
|
||
set_target_properties(${exe_name} PROPERTIES LINKER_LANGUAGE C) | ||
set_target_properties(${exe_name} PROPERTIES LINKER_LANGUAGE CXX) | ||
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. Same as the above comment about using C linker instead of CXX. |
||
|
||
# Add the test command | ||
if (mpi_args) | ||
add_test( | ||
NAME ${test_name} | ||
COMMAND ${OMEGA_MPI_EXEC} ${OMEGA_MPI_ARGS} ${mpi_args} -- ./${exe_name} | ||
) | ||
|
||
if("${OMEGA_ARCH}" STREQUAL "SYCL") | ||
add_test( | ||
NAME ${test_name} | ||
COMMAND ${OMEGA_MPI_EXEC} ${mpi_args} ${OMEGA_MPI_ARGS} ./${exe_name} | ||
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. I am curious why the order of MPI arguments matters. |
||
) | ||
else() | ||
add_test( | ||
NAME ${test_name} | ||
COMMAND ${OMEGA_MPI_EXEC} ${OMEGA_MPI_ARGS} ${mpi_args} -- ./${exe_name} | ||
) | ||
endif() | ||
|
||
else() | ||
add_test( | ||
|
@@ -281,7 +289,7 @@ add_omega_test( | |
TEND_PLANE_TEST | ||
testTendencyTermsPlane.exe | ||
ocn/TendencyTermsTest.cpp | ||
"-n 8;--cpu-bind=cores" | ||
"-n 8;" | ||
) | ||
target_compile_definitions( | ||
testTendencyTermsPlane.exe | ||
|
@@ -293,15 +301,15 @@ add_omega_test( | |
TEND_PLANE_SINGLE_PRECISION_TEST | ||
testTendencyTermsPlaneSinglePrecision.exe | ||
ocn/TendencyTermsTest.cpp | ||
"-n 8;--cpu-bind=cores" | ||
"-n 8;" | ||
single_precision | ||
) | ||
|
||
add_omega_test( | ||
TEND_SPHERE_TEST | ||
testTendencyTermsSphere.exe | ||
ocn/TendencyTermsTest.cpp | ||
"-n 8;--cpu-bind=cores" | ||
"-n 8;" | ||
) | ||
target_compile_definitions( | ||
testTendencyTermsSphere.exe | ||
|
@@ -350,7 +358,7 @@ add_omega_test( | |
REDUCTIONS_TEST | ||
testReductions.exe | ||
base/ReductionsTest.cpp | ||
"-n;2;--cpu-bind=cores" | ||
"-n;2;" | ||
) | ||
|
||
################### | ||
|
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.
On Frontier, there was an issue with linking to the CXX compiler because mipcxx was set to CXX instead of the CC Cray compiler wrapper. During the linking phase, the Omega compilation failed. Time have passed since then, and a quick build with this change now seems to pass the linking stage, but please ensure that this change works correctly with all compilers on Frontier.