Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ set(WITH_2DECOMPFFT ON CACHE BOOL

add_subdirectory(src)
add_subdirectory(tests)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(SelectBackend)
25 changes: 25 additions & 0 deletions cmake/SelectBackend.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Defines the backend selection for x3d2.
#
# Currently available backends
# - GPU/CUDAFortran (nvfort only)
# - CPU/OMP (all)

set(X3D2_BACKEND_OPTIONS "OMP/CPU")
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI" OR
${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC")
set(X3D2_BACKEND_DEFAULT "CUDA/GPU")
list(APPEND X3D2_BACKEND_OPTIONS ${X3D2_BACKEND_DEFAULT})
else()
set(X3D2_BACKEND_DEFAULT "OMP/CPU")
endif()

set(X3D2_BACKEND
${X3D2_BACKEND_DEFAULT}
CACHE
STRING
"Select the backend. Current options are ${X3D2_BACKEND_OPTIONS}")
set_property(CACHE
X3D2_BACKEND
PROPERTY STRINGS
${X3D2_BACKEND_OPTIONS})
message(STATUS "Using ${X3D2_BACKEND} backend")