aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/cuda/15 sanitizer
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/cuda/15 sanitizer
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/cuda/15 sanitizer')
-rw-r--r--meson/test cases/cuda/15 sanitizer/meson.build4
-rw-r--r--meson/test cases/cuda/15 sanitizer/prog.cu30
2 files changed, 34 insertions, 0 deletions
diff --git a/meson/test cases/cuda/15 sanitizer/meson.build b/meson/test cases/cuda/15 sanitizer/meson.build
new file mode 100644
index 000000000..367a4e2f8
--- /dev/null
+++ b/meson/test cases/cuda/15 sanitizer/meson.build
@@ -0,0 +1,4 @@
+project('simple', 'cuda', version : '1.0.0',
+ default_options: ['b_sanitize=address,undefined'])
+
+libtests = shared_library('tests', 'prog.cu')
diff --git a/meson/test cases/cuda/15 sanitizer/prog.cu b/meson/test cases/cuda/15 sanitizer/prog.cu
new file mode 100644
index 000000000..340b07aea
--- /dev/null
+++ b/meson/test cases/cuda/15 sanitizer/prog.cu
@@ -0,0 +1,30 @@
+#include <iostream>
+
+int run_tests(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;
+}
+