summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-07 16:45:44 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-12 15:39:04 (GMT)
commit5599d858c7881b4331c449ba5c59d255ed50bd11 (patch)
tree9461bf2509ff5b14e6442b2cfde2c8808bd49dc1 /Tests/Cuda
parent1155170230ebd096df06ebf108908d6c99242d6d (diff)
downloadCMake-5599d858c7881b4331c449ba5c59d255ed50bd11.zip
CMake-5599d858c7881b4331c449ba5c59d255ed50bd11.tar.gz
CMake-5599d858c7881b4331c449ba5c59d255ed50bd11.tar.bz2
CUDA: Port test cases to Windows with MSVC host compiler
Diffstat (limited to 'Tests/Cuda')
-rw-r--r--Tests/Cuda/Complex/dynamic.cpp8
-rw-r--r--Tests/Cuda/Complex/dynamic.cu10
-rw-r--r--Tests/Cuda/Complex/main.cpp10
-rw-r--r--Tests/Cuda/Complex/mixed.cpp12
-rw-r--r--Tests/Cuda/Complex/mixed.cu12
5 files changed, 43 insertions, 9 deletions
diff --git a/Tests/Cuda/Complex/dynamic.cpp b/Tests/Cuda/Complex/dynamic.cpp
index d579f1e..3848ce7 100644
--- a/Tests/Cuda/Complex/dynamic.cpp
+++ b/Tests/Cuda/Complex/dynamic.cpp
@@ -1,5 +1,11 @@
-int dynamic_base_func(int x)
+#ifdef _WIN32
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT
+#endif
+
+EXPORT int dynamic_base_func(int x)
{
return x * x;
}
diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu
index ea52acb..a23dc25 100644
--- a/Tests/Cuda/Complex/dynamic.cu
+++ b/Tests/Cuda/Complex/dynamic.cu
@@ -3,9 +3,15 @@
#include <cuda.h>
#include <iostream>
+#ifdef _WIN32
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT
+#endif
+
int dynamic_base_func(int);
-int __host__ cuda_dynamic_host_func(int x)
+EXPORT int __host__ cuda_dynamic_host_func(int x)
{
return dynamic_base_func(x);
}
@@ -16,7 +22,7 @@ void DetermineIfValidCudaDevice()
{
}
-void cuda_dynamic_lib_func()
+EXPORT void cuda_dynamic_lib_func()
{
DetermineIfValidCudaDevice <<<1,1>>> ();
cudaError_t err = cudaGetLastError();
diff --git a/Tests/Cuda/Complex/main.cpp b/Tests/Cuda/Complex/main.cpp
index 32312d0..5a3f820 100644
--- a/Tests/Cuda/Complex/main.cpp
+++ b/Tests/Cuda/Complex/main.cpp
@@ -3,8 +3,14 @@
#include "file1.h"
#include "file2.h"
-int call_cuda_seperable_code(int x);
-int mixed_launch_kernel(int x);
+#ifdef _WIN32
+#define IMPORT __declspec(dllimport)
+#else
+#define IMPORT
+#endif
+
+IMPORT int call_cuda_seperable_code(int x);
+IMPORT int mixed_launch_kernel(int x);
int main(int argc, char** argv)
{
diff --git a/Tests/Cuda/Complex/mixed.cpp b/Tests/Cuda/Complex/mixed.cpp
index 205f091..bd32e51 100644
--- a/Tests/Cuda/Complex/mixed.cpp
+++ b/Tests/Cuda/Complex/mixed.cpp
@@ -1,6 +1,14 @@
+#ifdef _WIN32
+#define EXPORT __declspec(dllexport)
+#define IMPORT __declspec(dllimport)
+#else
+#define EXPORT
+#define IMPORT
+#endif
+
int dynamic_base_func(int);
-int cuda_dynamic_host_func(int);
+IMPORT int cuda_dynamic_host_func(int);
int file3_launch_kernel(int);
int dynamic_final_func(int x)
@@ -8,7 +16,7 @@ int dynamic_final_func(int x)
return cuda_dynamic_host_func(dynamic_base_func(x));
}
-int call_cuda_seperable_code(int x)
+EXPORT int call_cuda_seperable_code(int x)
{
return file3_launch_kernel(x);
}
diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu
index 45b412f..7051de0 100644
--- a/Tests/Cuda/Complex/mixed.cu
+++ b/Tests/Cuda/Complex/mixed.cu
@@ -4,10 +4,18 @@
#include "file1.h"
#include "file2.h"
+#ifdef _WIN32
+#define EXPORT __declspec(dllexport)
+#define IMPORT __declspec(dllimport)
+#else
+#define EXPORT
+#define IMPORT
+#endif
+
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-void __host__ cuda_dynamic_lib_func();
+IMPORT void __host__ cuda_dynamic_lib_func();
static
__global__
@@ -17,7 +25,7 @@ void mixed_kernel(result_type& r, int x)
result_type_dynamic rd = file2_func(x);
}
-int mixed_launch_kernel(int x)
+EXPORT int mixed_launch_kernel(int x)
{
cuda_dynamic_lib_func();