Skip to content
Snippets Groups Projects
Commit 270cb827 authored by Georgiana Mania's avatar Georgiana Mania Committed by Pradipta Samanta
Browse files

configure compilation for kokkos + nvidia (!31)


Merged-by: default avatarPradipta Samanta <samanta@dkrz.de>
Changelog: default
parent be8fea69
No related branches found
No related tags found
1 merge request!37Draft: C++ port of horizontal/mo_lib_gradients.F90
...@@ -29,6 +29,7 @@ option(IM_USE_CPP_BINDINGS "Use C++ bindings" OFF) ...@@ -29,6 +29,7 @@ option(IM_USE_CPP_BINDINGS "Use C++ bindings" OFF)
option(IM_ENABLE_DIM_SWAP "Enable dimension swap" OFF) option(IM_ENABLE_DIM_SWAP "Enable dimension swap" OFF)
option(IM_ENABLE_OPENACC "Enable OpenACC support" OFF) option(IM_ENABLE_OPENACC "Enable OpenACC support" OFF)
option(IM_ENABLE_OPENMP "Enable OpenMP support" OFF) option(IM_ENABLE_OPENMP "Enable OpenMP support" OFF)
set(IM_ENABLE_GPU OFF CACHE STRING "Enable Kokkos GPU support for arch. Valid values: OFF, nvidia-sm80")
# GNUInstallDirs issues a warning if CMAKE_SIZEOF_VOID_P is not defined, which # GNUInstallDirs issues a warning if CMAKE_SIZEOF_VOID_P is not defined, which
# is the case with NAG. One way to circumvent that is to enable C language for # is the case with NAG. One way to circumvent that is to enable C language for
...@@ -124,6 +125,16 @@ set(Kokkos_ENABLE_IMPL_MDSPAN OFF CACHE BOOL "Experimental mdspan support") ...@@ -124,6 +125,16 @@ set(Kokkos_ENABLE_IMPL_MDSPAN OFF CACHE BOOL "Experimental mdspan support")
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Kokkos Serial backend") set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Kokkos Serial backend")
set(Kokkos_ARCH_NATIVE ON CACHE BOOL "Kokkos native architecture optimisations") set(Kokkos_ARCH_NATIVE ON CACHE BOOL "Kokkos native architecture optimisations")
if ("${IM_ENABLE_GPU}" STREQUAL "nvidia-sm80")
# NVIDIA A100
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Kokkos CUDA backend")
set(Kokkos_ARCH_AMPERE80 ON CACHE BOOL "CUDA architecture: Ampere cc80")
endif()
if (${IM_ENABLE_OPENMP})
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "Kokkos OpenMP backend")
endif()
FetchContent_MakeAvailable(kokkos) FetchContent_MakeAvailable(kokkos)
add_subdirectory(src) add_subdirectory(src)
......
...@@ -66,7 +66,8 @@ target_include_directories( ...@@ -66,7 +66,8 @@ target_include_directories(
target_link_libraries(iconmath-horizontal PUBLIC fortran-support::fortran-support) target_link_libraries(iconmath-horizontal PUBLIC fortran-support::fortran-support)
target_link_libraries(iconmath-horizontal PUBLIC iconmath-support) target_link_libraries(iconmath-horizontal PUBLIC iconmath-support)
target_link_libraries(iconmath-horizontal PUBLIC iconmath-interpolation) target_link_libraries(iconmath-horizontal PUBLIC iconmath-interpolation)
target_link_libraries(iconmath-interpolation PRIVATE Kokkos::kokkos) target_link_libraries(iconmath-horizontal PRIVATE Kokkos::kokkos)
set_target_properties(iconmath-horizontal PROPERTIES LINKER_LANGUAGE Fortran)
install(TARGETS iconmath-horizontal EXPORT "${PROJECT_NAME}-targets") install(TARGETS iconmath-horizontal EXPORT "${PROJECT_NAME}-targets")
......
...@@ -70,6 +70,7 @@ target_include_directories( ...@@ -70,6 +70,7 @@ target_include_directories(
target_link_libraries(iconmath-interpolation PUBLIC fortran-support::fortran-support) target_link_libraries(iconmath-interpolation PUBLIC fortran-support::fortran-support)
target_link_libraries(iconmath-interpolation PUBLIC iconmath-support) target_link_libraries(iconmath-interpolation PUBLIC iconmath-support)
target_link_libraries(iconmath-interpolation PRIVATE Kokkos::kokkos) target_link_libraries(iconmath-interpolation PRIVATE Kokkos::kokkos)
set_target_properties(iconmath-interpolation PROPERTIES LINKER_LANGUAGE Fortran)
install(TARGETS iconmath-interpolation EXPORT "${PROJECT_NAME}-targets") install(TARGETS iconmath-interpolation EXPORT "${PROJECT_NAME}-targets")
......
...@@ -80,6 +80,7 @@ target_link_libraries(iconmath-support ...@@ -80,6 +80,7 @@ target_link_libraries(iconmath-support
PRIVATE PRIVATE
Kokkos::kokkos Kokkos::kokkos
) )
set_target_properties(iconmath-support PROPERTIES LINKER_LANGUAGE Fortran)
install(TARGETS iconmath-support EXPORT "${PROJECT_NAME}-targets") install(TARGETS iconmath-support EXPORT "${PROJECT_NAME}-targets")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment