aboutsummaryrefslogtreecommitdiff
path: root/test cases/cuda
diff options
context:
space:
mode:
authorAleksey Gurtovoy <agurtovoy@acm.org>2019-09-06 12:31:26 -0500
committerDylan Baker <dylan@pnwbakers.com>2019-09-24 14:22:20 -0700
commit6ac5db50c901f172176b297d087e6123df497062 (patch)
treec57cab2ef12633b760ab0189539a932e3b465817 /test cases/cuda
parent1670fca36fcb1a4fe4780e96731e954515501a35 (diff)
downloadmeson-6ac5db50c901f172176b297d087e6123df497062.zip
meson-6ac5db50c901f172176b297d087e6123df497062.tar.gz
meson-6ac5db50c901f172176b297d087e6123df497062.tar.bz2
CUDA support on Windows
Diffstat (limited to 'test cases/cuda')
-rw-r--r--test cases/cuda/6 std/main.cu20
-rw-r--r--test cases/cuda/6 std/meson.build4
-rw-r--r--test cases/cuda/7 static vs runtime/main.cu20
-rw-r--r--test cases/cuda/7 static vs runtime/meson.build4
-rw-r--r--test cases/cuda/8 release/main.cu20
-rw-r--r--test cases/cuda/8 release/meson.build4
-rw-r--r--test cases/cuda/9 optimize for space/main.cu20
-rw-r--r--test cases/cuda/9 optimize for space/meson.build4
8 files changed, 96 insertions, 0 deletions
diff --git a/test cases/cuda/6 std/main.cu b/test cases/cuda/6 std/main.cu
new file mode 100644
index 0000000..a010307
--- /dev/null
+++ b/test cases/cuda/6 std/main.cu
@@ -0,0 +1,20 @@
+#include <cuda_runtime.h>
+#include <iostream>
+
+auto cuda_devices() {
+ int result = 0;
+ cudaGetDeviceCount(&result);
+ return result;
+}
+
+
+int main() {
+ int n = cuda_devices();
+ if (n == 0) {
+ std::cout << "No Cuda hardware found. Exiting.\n";
+ return 0;
+ }
+
+ std::cout << "Found " << n << "Cuda devices.\n";
+ return 0;
+}
diff --git a/test cases/cuda/6 std/meson.build b/test cases/cuda/6 std/meson.build
new file mode 100644
index 0000000..69a6868
--- /dev/null
+++ b/test cases/cuda/6 std/meson.build
@@ -0,0 +1,4 @@
+project('C++ std', 'cuda', version : '1.0.0', default_options : ['cuda_std=c++14'])
+
+exe = executable('prog', 'main.cu')
+test('cudatest', exe)
diff --git a/test cases/cuda/7 static vs runtime/main.cu b/test cases/cuda/7 static vs runtime/main.cu
new file mode 100644
index 0000000..4d62e9c
--- /dev/null
+++ b/test cases/cuda/7 static vs runtime/main.cu
@@ -0,0 +1,20 @@
+#include <cuda_runtime.h>
+#include <iostream>
+
+int cuda_devices() {
+ int result = 0;
+ cudaGetDeviceCount(&result);
+ return result;
+}
+
+
+int main() {
+ int n = cuda_devices();
+ if (n == 0) {
+ std::cout << "No Cuda hardware found. Exiting.\n";
+ return 0;
+ }
+
+ std::cout << "Found " << n << "Cuda devices.\n";
+ return 0;
+}
diff --git a/test cases/cuda/7 static vs runtime/meson.build b/test cases/cuda/7 static vs runtime/meson.build
new file mode 100644
index 0000000..ab13304
--- /dev/null
+++ b/test cases/cuda/7 static vs runtime/meson.build
@@ -0,0 +1,4 @@
+project('static msvc runtime', 'cuda', version : '1.0.0', default_options : ['b_vscrt=mtd'])
+
+exe = executable('prog', 'main.cu')
+test('cudatest', exe)
diff --git a/test cases/cuda/8 release/main.cu b/test cases/cuda/8 release/main.cu
new file mode 100644
index 0000000..4d62e9c
--- /dev/null
+++ b/test cases/cuda/8 release/main.cu
@@ -0,0 +1,20 @@
+#include <cuda_runtime.h>
+#include <iostream>
+
+int cuda_devices() {
+ int result = 0;
+ cudaGetDeviceCount(&result);
+ return result;
+}
+
+
+int main() {
+ int n = cuda_devices();
+ if (n == 0) {
+ std::cout << "No Cuda hardware found. Exiting.\n";
+ return 0;
+ }
+
+ std::cout << "Found " << n << "Cuda devices.\n";
+ return 0;
+}
diff --git a/test cases/cuda/8 release/meson.build b/test cases/cuda/8 release/meson.build
new file mode 100644
index 0000000..bdb311d
--- /dev/null
+++ b/test cases/cuda/8 release/meson.build
@@ -0,0 +1,4 @@
+project('release', 'cuda', version : '1.0.0', default_options : ['buildtype=release'])
+
+exe = executable('prog', 'main.cu')
+test('cudatest', exe)
diff --git a/test cases/cuda/9 optimize for space/main.cu b/test cases/cuda/9 optimize for space/main.cu
new file mode 100644
index 0000000..4d62e9c
--- /dev/null
+++ b/test cases/cuda/9 optimize for space/main.cu
@@ -0,0 +1,20 @@
+#include <cuda_runtime.h>
+#include <iostream>
+
+int cuda_devices() {
+ int result = 0;
+ cudaGetDeviceCount(&result);
+ return result;
+}
+
+
+int main() {
+ int n = cuda_devices();
+ if (n == 0) {
+ std::cout << "No Cuda hardware found. Exiting.\n";
+ return 0;
+ }
+
+ std::cout << "Found " << n << "Cuda devices.\n";
+ return 0;
+}
diff --git a/test cases/cuda/9 optimize for space/meson.build b/test cases/cuda/9 optimize for space/meson.build
new file mode 100644
index 0000000..cd6ac05
--- /dev/null
+++ b/test cases/cuda/9 optimize for space/meson.build
@@ -0,0 +1,4 @@
+project('optimize for space', 'cuda', version : '1.0.0', default_options : ['optimization=s'])
+
+exe = executable('prog', 'main.cu')
+test('cudatest', exe)