2017-04-14 19:02:05 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
2020-02-01 23:06:01 +01:00
|
|
|
#include <cuda.h>
|
|
|
|
|
2017-04-14 19:02:05 +02:00
|
|
|
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;
|
|
|
|
}
|