@@ -13,6 +13,7 @@ cmake_minimum_required(VERSION 3.14.5)
1313
1414option (ENABLE_RAJA_SEQUENTIAL "Run sequential variants of RAJA kernels. Disable
1515this, and all other variants, to run _only_ raw C loops." On )
16+ option (ENABLE_KOKKOS "Include Kokkos implementations of the kernels in the RAJA Perfsuite" Off )
1617
1718#
1819# Note: the BLT build system is inheritted by RAJA and is initialized by RAJA
@@ -22,8 +23,13 @@ if (PERFSUITE_ENABLE_WARNINGS)
2223 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror" )
2324endif ()
2425
25- set (CMAKE_CXX_STANDARD 14)
26- set (BLT_CXX_STD c++14)
26+ if (ENABLE_KOKKOS)
27+ set (CMAKE_CXX_STANDARD 17)
28+ set (BLT_CXX_STD c++17)
29+ else ()
30+ set (CMAKE_CXX_STANDARD 14)
31+ set (BLT_CXX_STD c++14)
32+ endif ()
2733
2834include (blt/SetupBLT.cmake )
2935
@@ -100,7 +106,12 @@ endif()
100106if (ENABLE_CUDA)
101107 list (APPEND RAJA_PERFSUITE_DEPENDS cuda)
102108endif ()
103- if (ENABLE_HIP)
109+
110+ # Kokkos requires hipcc as the CMAKE_CXX_COMPILER for HIP AMD/VEGA GPU
111+ # platforms, whereas RAJAPerf Suite uses blt/CMake FindHIP to set HIP compiler.
112+ # Separate RAJAPerf Suite and Kokkos handling of HIP compilers
113+
114+ if ((ENABLE_HIP) AND (NOT ENABLE_KOKKOS))
104115 message (STATUS "HIP version: ${hip_VERSION} " )
105116 if ("${hip_VERSION} " VERSION_LESS "3.5" )
106117 message (FATAL_ERROR "Trying to use HIP/ROCm version ${hip_VERSION} . RAJA Perf Suite requires HIP/ROCm version 3.5 or newer. " )
@@ -113,8 +124,13 @@ set(RAJAPERF_BUILD_SYSTYPE $ENV{SYS_TYPE})
113124set (RAJAPERF_BUILD_HOST $ENV{HOSTNAME} )
114125
115126if (ENABLE_CUDA)
116- set (CMAKE_CUDA_STANDARD 14)
117- set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -restrict -arch ${CUDA_ARCH} --expt-extended-lambda --expt-relaxed-constexpr" )
127+ if (ENABLE_KOKKOS)
128+ set (CMAKE_CUDA_STANDARD 17)
129+ set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -restrict --extended-lambda --expt-relaxed-constexpr" )
130+ else ()
131+ set (CMAKE_CUDA_STANDARD 14)
132+ set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -restrict -arch ${CUDA_ARCH} --expt-extended-lambda --expt-relaxed-constexpr" )
133+ endif ()
118134
119135 set (RAJAPERF_COMPILER "${CUDA_NVCC_EXECUTABLE} " )
120136 list (APPEND RAJAPERF_COMPILER ${CMAKE_CXX_COMPILER} )
@@ -135,13 +151,46 @@ configure_file(${CMAKE_SOURCE_DIR}/src/rajaperf_config.hpp.in
135151
136152include_directories ($<BUILD_INTERFACE :${PROJECT_BINARY_DIR} /include >)
137153
138- # Make sure RAJA flag propagate (we need to do some house cleaning to
154+ # Make sure RAJA flags propagate (we need to do some tidying to
139155# remove project-specific CMake variables that are no longer needed)
140156set (CUDA_NVCC_FLAGS ${RAJA_NVCC_FLAGS} )
141157
142158#
143159# Each directory in the perf suite has its own CMakeLists.txt file.
144- #
160+
161+ # ENABLE_KOKKOS is A RAJAPerf Suite Option
162+ if (ENABLE_KOKKOS)
163+ add_definitions (-DRUN_KOKKOS )
164+ if (ENABLE_HIP)
165+ set (Kokkos_ENABLE_HIP ON CACHE BOOL "Kokkos builds for AMD HIP set the
166+ Kokkos_ENABLE_HIP variable to ON" )
167+ endif ()
168+
169+ if (ENABLE_TARGET_OPENMP)
170+ set (Kokkos_ENABLE_OPENMPTARGET ON CACHE BOOL "Docstring" )
171+ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
172+ if (NOT EXPERIMENTAL_BUILD)
173+ message (FATAL_ERROR "Kokkos builds with OpenMPTarget require a Debug build to succeed at the moment. Rebuild with CMAKE_BUILD_TYPE=Debug. If you're a compiler developer, rebuild with -DEXPERIMENTAL_BUILD=ON" )
174+ endif ()
175+ endif ()
176+ endif ()
177+
178+ # ENABLE_CUDA IS A RAJA PERFSUITE OPTION
179+ if (ENABLE_CUDA)
180+ set (Kokkos_ENABLE_CUDA ON CACHE BOOL "Docstring" )
181+ set (Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Docstring" )
182+ enable_language (CUDA )
183+ endif ()
184+ if (ENABLE_OPENMP)
185+ set (Kokkos_ENABLE_OPENMP ON CACHE BOOL "Docstring" )
186+ endif ()
187+
188+ add_subdirectory (tpl/kokkos )
189+ get_property (KOKKOS_INCLUDE_DIRS DIRECTORY tpl/kokkos PROPERTY INCLUDE_DIRECTORIES )
190+ include_directories (${KOKKOS_INCLUDE_DIRS} )
191+ list (APPEND RAJA_PERFSUITE_DEPENDS kokkos)
192+ endif ()
193+
145194add_subdirectory (src )
146195
147196if (RAJA_PERFSUITE_ENABLE_TESTS)
0 commit comments