blob: d1be2d4815c95b662b5d6fbdb0dfcf35146e1ddb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#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;
}
|