Add a CUDA test

test cuda: import fmt in CUDA source code

Current test is only for Windows(cl.exe).
Need to test more with the other host compilers...

* Activate the test when `find_package(CUDA)` worked
* The test runs with C++14

Detailed comments in 'test/cuda-test'

test cuda: add more comment / macro check

* checks both `__NVCC__` and `__CUDACC__`

More comments for CMake and CUDA source file.

test cuda: <fmt/core.h> checks NVCC and CUDA

The header file checks 2 things.

* __NVCC__: if the compiler is from NVIDIA
* __CUDACC__: if the source code is CUDA(.cu) file

Since we can't sure all users prefer latest, Version for
`find_pacakge(CUDA)` is downgraded to 9.0.
This is the minimum version for C++14 in CUDA
This commit is contained in:
luncliff
2019-08-30 17:45:50 -07:00
committed by Victor Zverovich
parent 9e2490be4c
commit 345ba07f1d
5 changed files with 105 additions and 2 deletions
+8
View File
@@ -225,3 +225,11 @@ if (FMT_PEDANTIC AND NOT WIN32)
"-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
endif ()
# Activate optional CUDA tests if CUDA is found. For version selection, see
# https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#cpp14-language-features
find_package(CUDA 9.0)
if (CUDA_FOUND)
add_subdirectory(cuda-test)
add_test(NAME cuda-test COMMAND fmt-in-cuda-test)
endif ()