diff options
author | Aleksey Gurtovoy <agurtovoy@acm.org> | 2019-09-06 12:31:26 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-09-24 14:22:20 -0700 |
commit | 6ac5db50c901f172176b297d087e6123df497062 (patch) | |
tree | c57cab2ef12633b760ab0189539a932e3b465817 /test cases/cuda | |
parent | 1670fca36fcb1a4fe4780e96731e954515501a35 (diff) | |
download | meson-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.cu | 20 | ||||
-rw-r--r-- | test cases/cuda/6 std/meson.build | 4 | ||||
-rw-r--r-- | test cases/cuda/7 static vs runtime/main.cu | 20 | ||||
-rw-r--r-- | test cases/cuda/7 static vs runtime/meson.build | 4 | ||||
-rw-r--r-- | test cases/cuda/8 release/main.cu | 20 | ||||
-rw-r--r-- | test cases/cuda/8 release/meson.build | 4 | ||||
-rw-r--r-- | test cases/cuda/9 optimize for space/main.cu | 20 | ||||
-rw-r--r-- | test cases/cuda/9 optimize for space/meson.build | 4 |
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) |