Skip to content
Snippets Groups Projects
Commit f7e3897a authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

Merge branch 'CUDA_ARCH' into 'master'

Cuda Arch

Closes #129 and #138

See merge request walberla/walberla!440
parents 13b441e5 a8804081
No related tags found
No related merge requests found
...@@ -496,13 +496,6 @@ else() ...@@ -496,13 +496,6 @@ else()
endif() endif()
endif() endif()
if (WALBERLA_BUILD_WITH_CUDA AND (CUDA_VERSION VERSION_LESS "11.0" OR CMAKE_VERSION VERSION_LESS 3.18.0))
# CUDA < 11 does not support C++17. std::experimental::any works with C++14, unlike std::any.
set(CMAKE_CUDA_STANDARD 14)
set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
endif()
############################################################################################################################ ############################################################################################################################
## ##
## Visual Studio Setup ## Visual Studio Setup
...@@ -1037,22 +1030,39 @@ if ( WALBERLA_BUILD_WITH_CUDA ) ...@@ -1037,22 +1030,39 @@ if ( WALBERLA_BUILD_WITH_CUDA )
include(CheckLanguage) include(CheckLanguage)
check_language(CUDA) check_language(CUDA)
if( CMAKE_CUDA_COMPILER ) if( CMAKE_CUDA_COMPILER )
enable_language(CUDA)
#include directories and cudart lib is needed for cpp files that use cuda headers/libs if(${CMAKE_VERSION} VERSION_GREATER "3.18.0" AND NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) set(CMAKE_CUDA_ARCHITECTURES OFF)
find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) message(WARNING "CMAKE_CUDA_ARCHITECTURES was not set. It is automatically set to: ${CMAKE_CUDA_ARCHITECTURES}")
list ( APPEND SERVICE_LIBS ${CUDART_LIBRARY} ) endif()
enable_language(CUDA)
find_library( NVTX_LIBRARY nvToolsExt ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} ) #include directories and cudart lib is needed for cpp files that use cuda headers/libs
list ( APPEND SERVICE_LIBS ${NVTX_LIBRARY} ) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
list ( APPEND SERVICE_LIBS ${CUDART_LIBRARY} )
#CUDA_FOUND is need for our cmake mechanism find_library( NVTX_LIBRARY nvToolsExt ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} )
set ( CUDA_FOUND TRUE ) list ( APPEND SERVICE_LIBS ${NVTX_LIBRARY} )
#CUDA_FOUND is need for our cmake mechanism
set ( CUDA_FOUND TRUE )
else() else()
set ( WALBERLA_BUILD_WITH_CUDA FALSE ) set ( WALBERLA_BUILD_WITH_CUDA FALSE )
endif ( ) endif ( )
endif ( ) endif ( )
# old nvcc compilers and newer stdlibc++ are incompatible. This needs to be checked!
if (WALBERLA_STL_BOUNDS_CHECKS AND WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_CUDA AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "11.0" AND WALBERLA_CXX_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")
message(FATAL_ERROR "WALBERLA_STL_BOUNDS_CHECKS is not compatible with your CUDA compiler")
endif()
if (WALBERLA_BUILD_WITH_CUDA AND (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "11.0" OR CMAKE_VERSION VERSION_LESS 3.18.0))
# CUDA < 11 does not support C++17. std::experimental::any works with C++14, unlike std::any.
set(CMAKE_CUDA_STANDARD 14)
set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
endif()
############################################################################################################################ ############################################################################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment