summaryrefslogtreecommitdiffstats
path: root/ml/dlib/dlib/cmake_utils/test_for_cuda
diff options
context:
space:
mode:
Diffstat (limited to 'ml/dlib/dlib/cmake_utils/test_for_cuda')
-rw-r--r--ml/dlib/dlib/cmake_utils/test_for_cuda/CMakeLists.txt14
-rw-r--r--ml/dlib/dlib/cmake_utils/test_for_cuda/cuda_test.cu21
2 files changed, 35 insertions, 0 deletions
diff --git a/ml/dlib/dlib/cmake_utils/test_for_cuda/CMakeLists.txt b/ml/dlib/dlib/cmake_utils/test_for_cuda/CMakeLists.txt
new file mode 100644
index 000000000..5f6af245e
--- /dev/null
+++ b/ml/dlib/dlib/cmake_utils/test_for_cuda/CMakeLists.txt
@@ -0,0 +1,14 @@
+
+cmake_minimum_required(VERSION 2.8.12)
+project(cuda_test)
+
+include_directories(../../dnn)
+add_definitions(-DDLIB_USE_CUDA)
+
+# Override the FindCUDA.cmake setting to avoid duplication of host flags if using a toolchain:
+option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" OFF)
+find_package(CUDA 7.5 REQUIRED)
+set(CUDA_HOST_COMPILATION_CPP ON)
+list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__;-D_MWAITXINTRIN_H_INCLUDED;-D_FORCE_INLINES")
+
+cuda_add_library(cuda_test STATIC cuda_test.cu )
diff --git a/ml/dlib/dlib/cmake_utils/test_for_cuda/cuda_test.cu b/ml/dlib/dlib/cmake_utils/test_for_cuda/cuda_test.cu
new file mode 100644
index 000000000..fb1ffe0da
--- /dev/null
+++ b/ml/dlib/dlib/cmake_utils/test_for_cuda/cuda_test.cu
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 Davis E. King (davis@dlib.net)
+// License: Boost Software License See LICENSE.txt for the full license.
+
+#include "cuda_utils.h"
+#include "cuda_dlib.h"
+
+
+// ------------------------------------------------------------------------------------
+
+__global__ void cuda_add_arrays(const float* a, const float* b, float* out, size_t n)
+{
+ out[0] += a[0]+b[0];
+}
+
+void add_arrays()
+{
+ cuda_add_arrays<<<512,512>>>(0,0,0,0);
+}
+
+// ------------------------------------------------------------------------------------
+