vendored-meson/meson/test cases/cuda/8 release/main.cu
raw| 1 | #include <cuda_runtime.h> |
| 2 | #include <iostream> |
| 3 | |
| 4 | #ifndef NDEBUG |
| 5 | #error "NDEBUG not defined, this is a Meson bug" |
| 6 | #endif |
| 7 | |
| 8 | int cuda_devices(void) { |
| 9 | int result = 0; |
| 10 | cudaGetDeviceCount(&result); |
| 11 | return result; |
| 12 | } |
| 13 | |
| 14 | |
| 15 | int main(void) { |
| 16 | int n = cuda_devices(); |
| 17 | if (n == 0) { |
| 18 | std::cout << "No Cuda hardware found. Exiting.\n"; |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | std::cout << "Found " << n << "Cuda devices.\n"; |
| 23 | return 0; |
| 24 | } |