diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-21 23:30:11 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-21 23:35:38 +0200 |
commit | 140975116905e7637e906e645b588e03b8c3aebb (patch) | |
tree | 3987d9a05450bd0024f625102aa3a2311cdb4edd /test cases/cuda | |
parent | 8eca221aac333489004953c4149011b5d74df176 (diff) | |
download | meson-140975116905e7637e906e645b588e03b8c3aebb.zip meson-140975116905e7637e906e645b588e03b8c3aebb.tar.gz meson-140975116905e7637e906e645b588e03b8c3aebb.tar.bz2 |
Convert basic test to print out card info.
Diffstat (limited to 'test cases/cuda')
-rw-r--r-- | test cases/cuda/1 simple/prog.cu | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/test cases/cuda/1 simple/prog.cu b/test cases/cuda/1 simple/prog.cu index 5f8f0c3..2dd4554 100644 --- a/test cases/cuda/1 simple/prog.cu +++ b/test cases/cuda/1 simple/prog.cu @@ -1,11 +1,33 @@ -#include <stdio.h> +#include <iostream> __global__ void kernel (void){ } int main(int argc, char **argv) { - kernel<<<1,1>>>(); - printf("Hello, World!\n"); - return 0; + int cuda_devices = 0; + std::cout << "CUDA version: " << CUDART_VERSION << "\n"; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + std::cout << "This computer has " << cuda_devices << " Cuda device(s).\n"; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, 0); + std::cout << "Properties of device 0.\n\n"; + + std::cout << " Name: " << props.name << "\n"; + std::cout << " Global memory: " << props.totalGlobalMem << "\n"; + std::cout << " Shared memory: " << props.sharedMemPerBlock << "\n"; + std::cout << " Constant memory: " << props.totalConstMem << "\n"; + std::cout << " Block registers: " << props.regsPerBlock << "\n"; + + std::cout << " Warp size: " << props.warpSize << "\n"; + std::cout << " Threads per block: " << props.maxThreadsPerBlock << "\n"; + std::cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << "\n"; + std::cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << "\n"; + std::cout << "\n"; + + return 0; } |