aboutsummaryrefslogtreecommitdiff
path: root/test cases/cuda
diff options
context:
space:
mode:
authorOlexa Bilaniuk <obilaniu@gmail.com>2021-02-21 07:04:55 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-02-22 23:56:55 +0200
commit4c1a0c400f4a57bb51d663fcc3aa90014dd47df3 (patch)
treeb06c0ad6fae0275961eacf13204d141184d2ca8a /test cases/cuda
parent2fabd4c7dc22373e99fc63823d80083ad30704b8 (diff)
downloadmeson-4c1a0c400f4a57bb51d663fcc3aa90014dd47df3.zip
meson-4c1a0c400f4a57bb51d663fcc3aa90014dd47df3.tar.gz
meson-4c1a0c400f4a57bb51d663fcc3aa90014dd47df3.tar.bz2
[CUDA] Bugfix: Forward sanitizer_*_args() methods to host compiler.
Enables -Db_sanitize=undefined and company. Also serves as a testcase for NVCC comma-shielding: Because the test- case declares `b_sanitize=address,undefined`, the host GCC compiler needs `-fsanitize=address,undefined`, but this stands a danger of being split by NVCC when wrapped with `-Xcompiler=args,args`. Special, already-existing comma-shielding codepaths activate to prevent this splitting. Closes #8394.
Diffstat (limited to 'test cases/cuda')
-rw-r--r--test cases/cuda/15 sanitizer/meson.build4
-rw-r--r--test cases/cuda/15 sanitizer/prog.cu30
2 files changed, 34 insertions, 0 deletions
diff --git a/test cases/cuda/15 sanitizer/meson.build b/test cases/cuda/15 sanitizer/meson.build
new file mode 100644
index 0000000..367a4e2
--- /dev/null
+++ b/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/test cases/cuda/15 sanitizer/prog.cu b/test cases/cuda/15 sanitizer/prog.cu
new file mode 100644
index 0000000..340b07a
--- /dev/null
+++ b/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;
+}
+