summaryrefslogtreecommitdiffstats
path: root/test cases/cuda/10 cuda dependency/cpp/prog.cc
blob: 4832afa81e519277d6aabc68fbbb169a06449699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <cuda_runtime.h>
#include <iostream>

int cuda_devices(void) {
    int result = 0;
    cudaGetDeviceCount(&result);
    return result;
}

int main(void) {
    int n = cuda_devices();
    if (n == 0) {
        std::cout << "No CUDA hardware found. Exiting.\n";
        return 0;
    }

    std::cout << "Found " << n << " CUDA devices.\n";
    return 0;
}