CMake/Tests/Cuda/WithC/cuda.cu
Kitware Robot ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00

17 lines
381 B
Plaintext

#include <iostream>
#include <cuda.h>
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;
}