aboutsummaryrefslogtreecommitdiff
path: root/test cases/cuda
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2020-09-02 07:35:30 -0700
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-09-02 17:48:39 +0200
commit56ebd5c7407482883765e00c0c90111b6947e700 (patch)
tree059f6f67de8f58fb4db20ce0a9977679a73751de /test cases/cuda
parent3eab43136cfc3418e59e588c62f1d41f577974ad (diff)
downloadmeson-56ebd5c7407482883765e00c0c90111b6947e700.zip
meson-56ebd5c7407482883765e00c0c90111b6947e700.tar.gz
meson-56ebd5c7407482883765e00c0c90111b6947e700.tar.bz2
Add test case for cuda compiler setting fix
Signed-off-by: Matt Madison <matt@madison.systems>
Diffstat (limited to 'test cases/cuda')
-rw-r--r--test cases/cuda/13 cuda compiler setting/meson.build5
-rw-r--r--test cases/cuda/13 cuda compiler setting/nativefile.ini5
-rw-r--r--test cases/cuda/13 cuda compiler setting/prog.cu30
3 files changed, 40 insertions, 0 deletions
diff --git a/test cases/cuda/13 cuda compiler setting/meson.build b/test cases/cuda/13 cuda compiler setting/meson.build
new file mode 100644
index 0000000..19af734
--- /dev/null
+++ b/test cases/cuda/13 cuda compiler setting/meson.build
@@ -0,0 +1,5 @@
+project('simple', 'cuda', version : '1.0.0')
+
+exe = executable('prog', 'prog.cu')
+test('cudatest', exe)
+
diff --git a/test cases/cuda/13 cuda compiler setting/nativefile.ini b/test cases/cuda/13 cuda compiler setting/nativefile.ini
new file mode 100644
index 0000000..ffaad65
--- /dev/null
+++ b/test cases/cuda/13 cuda compiler setting/nativefile.ini
@@ -0,0 +1,5 @@
+[binaries]
+
+cuda = 'nvcc'
+
+
diff --git a/test cases/cuda/13 cuda compiler setting/prog.cu b/test cases/cuda/13 cuda compiler setting/prog.cu
new file mode 100644
index 0000000..b893bd3
--- /dev/null
+++ b/test cases/cuda/13 cuda compiler setting/prog.cu
@@ -0,0 +1,30 @@
+#include <iostream>
+
+int main(void) {
+ 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;
+}
+