From: Daniel Arndt Date: Fri, 11 May 2018 12:10:47 +0000 (+0200) Subject: Fix CUDA test X-Git-Tag: v9.1.0-rc1~1148^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=229e23b95ed3607e9fb923bb6831919fcf862cb6;p=dealii.git Fix CUDA test --- diff --git a/cmake/macros/macro_deal_ii_pickup_tests.cmake b/cmake/macros/macro_deal_ii_pickup_tests.cmake index 93ad5bc0b1..8efe48707c 100644 --- a/cmake/macros/macro_deal_ii_pickup_tests.cmake +++ b/cmake/macros/macro_deal_ii_pickup_tests.cmake @@ -86,7 +86,7 @@ MACRO(DEAL_II_PICKUP_TESTS) IF(DEAL_II_WITH_CUDA) FIND_PACKAGE(CUDA) - SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++11 -arch=sm_35) + SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++11 -arch=sm_35 -Xcompiler ${OpenMP_CXX_FLAGS}) ENDIF() FIND_PACKAGE(Perl REQUIRED) diff --git a/tests/cuda/solver_02.cu b/tests/cuda/solver_02.cu index 296afe3549..225bbd4088 100644 --- a/tests/cuda/solver_02.cu +++ b/tests/cuda/solver_02.cu @@ -55,10 +55,8 @@ void test(Utilities::CUDA::Handle &cuda_handle) // Generate a random solution and then compute the rhs dealii::Vector sol_ref(size); - std::default_random_engine generator; - std::normal_distribution<> distribution(10., 2.); for (auto &val : sol_ref) - val = distribution(generator); + val = random_value(5.,15.); dealii::Vector rhs(size); matrix.vmult(rhs, sol_ref); @@ -72,8 +70,9 @@ void test(Utilities::CUDA::Handle &cuda_handle) rhs_dev.import(rhs_host, VectorOperation::insert); LinearAlgebra::CUDAWrappers::Vector solution_dev(size); + const std::array solver_names {"Cholesky", "LU_dense", "LU_host"}; - for (auto solver_type: {"Cholesky", "LU_dense", "LU_host"}) + for (auto solver_type: solver_names) { // Solve on the device CUDAWrappers::SolverDirect::AdditionalData data(solver_type); @@ -91,7 +90,7 @@ void test(Utilities::CUDA::Handle &cuda_handle) for (unsigned int i = 0; i < size; ++i) AssertThrow(std::abs(solution_host[i] - sol_ref[i]) < 1e-12, ExcInternalError()); - std::cout<