From 3a5d60bc1c2c655665324c0650e9db1c0b4a578d Mon Sep 17 00:00:00 2001 From: hedaoyuan Date: Sun, 16 Oct 2016 14:40:03 +0800 Subject: [PATCH] compile test_Tensor.cu with CPU --- paddle/math/tests/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/paddle/math/tests/CMakeLists.txt b/paddle/math/tests/CMakeLists.txt index ccc3deac7..c239289ee 100644 --- a/paddle/math/tests/CMakeLists.txt +++ b/paddle/math/tests/CMakeLists.txt @@ -14,8 +14,14 @@ add_simple_unittest(test_sparseMatrixCompare) add_simple_unittest(test_perturbation) add_simple_unittest(test_CpuGpuVector) add_simple_unittest(test_Allocator) -if(COMPILER_SUPPORT_CXX11) - LIST(APPEND CUDA_NVCC_FLAGS -std=c++11) - CUDA_ADD_EXECUTABLE(test_Tensor test_Tensor.cu) - link_paddle_test(test_Tensor) -endif() +if(WITH_GPU) + if(COMPILER_SUPPORT_CXX11) + LIST(APPEND CUDA_NVCC_FLAGS -std=c++11) + CUDA_ADD_EXECUTABLE(test_Tensor test_Tensor.cu) + link_paddle_test(test_Tensor) + endif() +else() + compile_cu_as_cpp(test_Tensor.cu) + add_unittest(test_Tensor test_Tensor.cu) +endif(WITH_GPU) + -- GitLab