summaryrefslogtreecommitdiff
path: root/Tests/Cuda/WithC/cuda.cu
blob: 06bd7b975bcc4b457d0d980bcdb5d7b96e10a55d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
}