diff options
author | Brad King <brad.king@kitware.com> | 2017-02-14 15:32:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-02-14 15:34:06 (GMT) |
commit | 8d75d8dc72a0ac4502991891782a2c84df1f61c3 (patch) | |
tree | cf7081c5075e4c0114bc0ee2d7e037207865bf4e /Tests/Cuda/WithC/cuda.cu | |
parent | c4a6135039a417087b478c031849337316022263 (diff) | |
download | CMake-8d75d8dc72a0ac4502991891782a2c84df1f61c3.zip CMake-8d75d8dc72a0ac4502991891782a2c84df1f61c3.tar.gz CMake-8d75d8dc72a0ac4502991891782a2c84df1f61c3.tar.bz2 |
Tests: Add case for CUDA with C but not C++
An executable using CUDA and C should link as CUDA.
Diffstat (limited to 'Tests/Cuda/WithC/cuda.cu')
-rw-r--r-- | Tests/Cuda/WithC/cuda.cu | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/Cuda/WithC/cuda.cu b/Tests/Cuda/WithC/cuda.cu new file mode 100644 index 0000000..06bd7b9 --- /dev/null +++ b/Tests/Cuda/WithC/cuda.cu @@ -0,0 +1,16 @@ +#include <cuda.h> + +#include <iostream> + +extern "C" int use_cuda(void) +{ + int nDevices = 0; + cudaError_t err = cudaGetDeviceCount(&nDevices); + if (err != cudaSuccess) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices" + << std::endl; + return 1; + } + std::cout << "Found " << nDevices << " CUDA enabled devices" << std::endl; + return 0; +} |