summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda/WithC/cuda.cu
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Cuda/WithC/cuda.cu')
-rw-r--r--Tests/Cuda/WithC/cuda.cu16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/Cuda/WithC/cuda.cu b/Tests/Cuda/WithC/cuda.cu
new file mode 100644
index 0000000..d1be2d4
--- /dev/null
+++ b/Tests/Cuda/WithC/cuda.cu
@@ -0,0 +1,16 @@
+#include <iostream>
+
+#include <cuda.h>
+
+extern "C" int use_cuda(void)
+{
+ int nDevices = 0;
+ cudaError_t err = cudaGetDeviceCount(&nDevices);
+ if (err != cudaSuccess) {
+ std::cerr << "Failed to retrieve the number of CUDA enabled devices"
+ << std::endl;
+ return 1;
+ }
+ std::cout << "Found " << nDevices << " CUDA enabled devices" << std::endl;
+ return 0;
+}