summaryrefslogtreecommitdiffstats
path: root/test cases/cuda/10 cuda dependency/c/prog.c
blob: ed9333efb6e818149ec5fbea704cc99f4a7d4957 (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 <stdio.h>

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

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

    printf("Found %i CUDA devices.\n", n);
    return 0;
}