You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
381 B

#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;
}