register_flag_optional(CMAKE_CXX_COMPILER "Any CXX compiler that is supported by CMake detection, this is used for host compilation" "c++") register_flag_optional(MEM "Device memory mode: DEFAULT - allocate host and device memory pointers. MANAGED - use CUDA Managed Memory. PAGEFAULT - shared memory, only host pointers allocated." "DEFAULT") register_flag_required(CMAKE_CUDA_COMPILER "Path to the CUDA nvcc compiler") # XXX CMake 3.18 supports CMAKE_CUDA_ARCHITECTURES/CUDA_ARCHITECTURES but we support older CMakes register_flag_required(CUDA_ARCH "Nvidia architecture, will be passed in via `-arch=` (e.g `sm_70`) for nvcc") register_flag_optional(CUDA_EXTRA_FLAGS "Additional CUDA flags passed to nvcc, this is appended after `CUDA_ARCH`" "") macro(setup) enable_language(CUDA) register_definitions(MEM=${MEM}) set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} -arch=${CUDA_ARCH} ${CUDA_EXTRA_FLAGS}) message(STATUS "NVCC flags: ${CMAKE_CUDA_FLAGS}") endmacro()