Skip to content

Commit deee180

Browse files
committed
Merge branch 'jgfouca/refactor_ekat_build' into next (PR #7634)
Refactor EKAT/Kokkos integration with E3SM Change list: 1) Fix DEBUG propagation to EKAT build, this will fix CI 2) Add new setting KOKKOS_USE_EKAT_MACH_FILE to E3SM cmake macros. This will allow machines to opt-in to using an EKAT machine file to configure kokkos. This should hopefully reduce duplication and tedium of Kokkos cmake configuration. 3) Make several machine take advantage of this feature. 4) Make eamxx standalone use the ekat machine files where possible 5) Remove unused EKAT_DISABLE_WORKSPACE_SHARING 6) Allow users to turn on kokkos view bounds checking via the env variable E3SM_ENABLE_KOKKOS_BOUNDS_CHECKING 7) ALWAYS turn off openmp for non-threaded cases Guide to configuring Kokkos/EKAT: 1) If the machine/compiler macro does nothing, it will use the universal Kokkos settings (Serial + (OpenMP IF compile_threaded). 2) The macro can manually set configuration by setting KOKKOS_OPTIONS. 3) The macro can just follow EKAT machine files by setting KOKKOS_USE_EKAT_MACH_FILE to TRUE. This only works if ekat/cmake/machine-files has a file ${MACH}.cmake. [BFB]
2 parents ec23b4e + ebce530 commit deee180

File tree

15 files changed

+43
-55
lines changed

15 files changed

+43
-55
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")

cime_config/machines/cmake_macros/gnu_mappy.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2")
66
if (MPILIB STREQUAL mpi-serial AND NOT compile_threaded)
77
set(PFUNIT_PATH "$ENV{SEMS_PFUNIT_ROOT}")
88
endif()
9+
10+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(KOKKOS_USE_EKAT_MACH_FILE "TRUE")

cime_config/machines/cmake_macros/universal.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(KOKKOS_OPTIONS "-DKokkos_ENABLE_SERIAL=On")
77
if (compile_threaded)
88
string(APPEND KOKKOS_OPTIONS " -DKokkos_ENABLE_OPENMP=On")
99
endif()
10+
set(KOKKOS_USE_EKAT_MACH_FILE "FALSE")
1011

1112
# Unless told otherwise, set has_contiguous to FALSE
1213
set(HAS_F2008_CONTIGUOUS "FALSE")

components/eamxx/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,22 @@ endif()
7171
# Kokkos related settings #
7272
####################################################################
7373

74+
# Note: this only does anything for standalone eamxx. CIME cases will
75+
# use the sharedlib EKAT/kokkos
7476
if (Kokkos_ENABLE_CUDA)
7577
if (Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE)
7678
if (Kokkos_ENABLE_DEBUG_BOUNDS_CHECK)
7779
string (CONCAT msg
78-
"Kokkos_ENALBE_CUDA_RELOCATABLE_DEVICE_CODE=ON, and Kokkos_ENALBE_DEBUG_BOUNDS_CHECK=ON.\n"
80+
"Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON, and Kokkos_ENABLE_DEBUG_BOUNDS_CHECK=ON.\n"
7981
" -> Disabling bounds checks, to prevent internal compiler errors.")
8082
message(WARNING "${msg}")
81-
set (Kokkos_ENABLE_DEBUG_BOUNDS_CHECK OFF CACHE BOOL "" FORCE)
83+
set(Kokkos_ENABLE_DEBUG_BOUNDS_CHECK OFF CACHE BOOL "" FORCE)
8284
else()
8385
string (CONCAT msg
84-
"Kokkos_ENALBE_CUDA_RELOCATABLE_DEVICE_CODE=ON.\n"
86+
"Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON.\n"
8587
" -> Disabling bounds checks, to prevent internal compiler errors.")
8688
message(STATUS "${msg}")
87-
set (Kokkos_ENABLE_DEBUG_BOUNDS_CHECK OFF CACHE BOOL "" FORCE)
89+
set(Kokkos_ENABLE_DEBUG_BOUNDS_CHECK OFF CACHE BOOL "" FORCE)
8890
endif()
8991
endif()
9092
endif()
@@ -204,9 +206,6 @@ option(SCREAM_ENABLE_MAM "Whether to enable MAM aerosol support" ON)
204206
set(SCREAM_SMALL_KERNELS ${DEFAULT_SMALL_KERNELS} CACHE STRING "Use small, non-monolothic kokkos kernels for ALL components that support them")
205207
set(SCREAM_P3_SMALL_KERNELS ${SCREAM_SMALL_KERNELS} CACHE STRING "Use small, non-monolothic kokkos kernels for P3 only")
206208
set(SCREAM_SHOC_SMALL_KERNELS ${SCREAM_SMALL_KERNELS} CACHE STRING "Use small, non-monolothic kokkos kernels for SHOC only")
207-
if (NOT SCREAM_P3_SMALL_KERNELS AND NOT SCREAM_SHOC_SMALL_KERNELS)
208-
set(EKAT_DISABLE_WORKSPACE_SHARING TRUE CACHE STRING "")
209-
endif()
210209

211210
# Add RRTMGP settings. Note, we might consider also adding RRTMGP_EXPENSIVE_CHECKS
212211
# to turn on the RRTMGP internal checks here as well, via
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,2 @@
11
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
22
common_setup()
3-
4-
set(EKAT_MACH_FILES_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../../externals/ekat/cmake/machine-files)
5-
6-
# Get AMD arch settings
7-
include(${EKAT_MACH_FILES_PATH}/kokkos/amd-zen2.cmake)
8-
9-
# Add OpenMP settings in standalone mode OR e3sm with compile_threaded=ON
10-
if (NOT "${PROJECT_NAME}" STREQUAL "E3SM" OR compile_threaded)
11-
include(${EKAT_MACH_FILES_PATH}/kokkos/openmp.cmake)
12-
endif()
13-
14-
# Use srun for standalone testing
15-
include(${EKAT_MACH_FILES_PATH}/mpi/srun.cmake)

0 commit comments

Comments
 (0)