Skip to content

Commit

Permalink
Merge pull request #3623 from vicentebolea/kokkos-use-nvcc-wrapper
Browse files Browse the repository at this point in the history
ci: use nvcc_wrapper in adiosKokkos
  • Loading branch information
vicentebolea authored May 17, 2023
2 parents c4af0cf + a28e226 commit 189f384
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ scripts/ @vicentebolea
source/adios2/toolkit/sst/dp/mpi_dp.c @vicentebolea

# GPU-aware specific files
source/adios2/helper/adiosKokkos.* @anagainaru
source/adios2/helper/kokkos/ @anagainaru
source/adios2/helper/adiosCUDA.* @anagainaru
source/adios2/helper/adiosGPUFunctions.h @anagainaru
4 changes: 2 additions & 2 deletions cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ endif()
# Kokkos
if(ADIOS2_USE_Kokkos)
if(ADIOS2_USE_Kokkos STREQUAL AUTO)
find_package(Kokkos 3.7...<4.0 QUIET)
find_package(Kokkos 3.7 QUIET)
else()
find_package(Kokkos 3.7...<4.0 REQUIRED)
find_package(Kokkos 3.7 REQUIRED)
endif()
if(Kokkos_FOUND)
set(ADIOS2_HAVE_Kokkos TRUE)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_scripts/build-adios2-kokkos-crusher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ARGS_ADIOS=(
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-D BUILD_TESTING=OFF
-D ADIOS2_BUILD_EXAMPLES=OFF
-D CMAKE_CXX_COMPILER=hipcc
-D CMAKE_CXX_COMPILER=g++
-D CMAKE_C_COMPILER=gcc

-D ADIOS2_USE_Kokkos=ON
Expand Down
28 changes: 7 additions & 21 deletions source/adios2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,14 @@ endif()

set(maybe_adios2_core_kokkos)
if(ADIOS2_HAVE_Kokkos)
add_library(adios2_core_kokkos helper/adiosKokkos.h helper/adiosKokkos.cpp)

set_target_properties(adios2_core_kokkos PROPERTIES
VISIBILITY_INLINES_HIDDEN ON
INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${ADIOS2_SOURCE_DIR}/source>;$<BUILD_INTERFACE:${ADIOS2_BINARY_DIR}/source>"
EXPORT_NAME core_kokkos
OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_core_kokkos
)

kokkos_compilation(SOURCE helper/adiosKokkos.cpp)
if(Kokkos_ENABLE_CUDA)
set_property(SOURCE helper/adiosKokkos.cpp PROPERTY LANGUAGE CUDA)
set_property(SOURCE helper/adiosKokkos.cpp APPEND PROPERTY COMPILE_FLAGS "--extended-lambda")
set_target_properties(adios2_core_kokkos PROPERTIES
CUDA_VISIBILITY_PRESET hidden
)
target_compile_features(adios2_core_kokkos PRIVATE cuda_std_17)
endif()

target_link_libraries(adios2_core_kokkos PRIVATE Kokkos::kokkos)
# Kokkos imposes us to set our CMAKE_CXX_COMPILER to Kokkos_CXX_COMPILER.
# The problem is that we do not want this for the whole project and with
# CMake we cannot set the CXX_COMPILER for a single target. The solution is
# to move the adios2 module that uses Kokkos to its independent subdir and
# set there CMAKE_CXX_COMPILER, which is possible (and scoped to that subdir)
# in cmake.
add_subdirectory(helper/kokkos)
target_link_libraries(adios2_core PRIVATE adios2_core_kokkos)

set(maybe_adios2_core_kokkos adios2_core_kokkos)
endif()

Expand Down
2 changes: 1 addition & 1 deletion source/adios2/helper/adiosGPUFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#endif

#ifdef ADIOS2_HAVE_KOKKOS
#include "adios2/helper/adiosKokkos.h"
#include "adios2/helper/kokkos/adiosKokkos.h"
#endif

#endif /* ADIOS2_HELPER_ADIOSGPUFUNCTIONS_H_ */
25 changes: 25 additions & 0 deletions source/adios2/helper/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#------------------------------------------------------------------------------#
# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#

if (NOT DEFINED Kokkos_CXX_COMPILER)
message(FATAL_ERROR "ADIOS: Kokkos module requires the Kokkos_CXX_COMPILER variable")
endif()

# CXX Compiler settings only in for this subdir
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER "${Kokkos_CXX_COMPILER}")

add_library(adios2_core_kokkos adiosKokkos.h adiosKokkos.cpp)

set_target_properties(adios2_core_kokkos PROPERTIES
VISIBILITY_INLINES_HIDDEN ON
INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${ADIOS2_SOURCE_DIR}/source>;$<BUILD_INTERFACE:${ADIOS2_BINARY_DIR}/source>"
EXPORT_NAME core_kokkos
OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_core_kokkos
)

kokkos_compilation(SOURCE adiosKokkos.cpp)
target_link_libraries(adios2_core_kokkos PRIVATE Kokkos::kokkos)
File renamed without changes.
File renamed without changes.

0 comments on commit 189f384

Please sign in to comment.