From 3287aa5f13c4de43b26dde8490b1858bcd297046 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 1 Oct 2019 21:19:13 +0000 Subject: [PATCH] Avoid using std::memset for device data --- include/deal.II/base/partitioner.templates.h | 30 ++++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index da662e10de..1938284a7e 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -513,18 +513,30 @@ namespace Utilities "vector_operation argument was passed to " "import_from_ghosted_array_start as is passed " "to import_from_ghosted_array_finish.")); + +# if (defined(DEAL_II_COMPILER_CUDA_AWARE)) + if (std::is_same::value) + { + cudaMemset(ghost_array.data(), + 0, + sizeof(Number) * ghost_array.size()); + } + else +# endif + { # ifdef DEAL_II_WITH_CXX17 - if constexpr (std::is_trivial::value) + if constexpr (std::is_trivial::value) # else - if (std::is_trivial::value) + if (std::is_trivial::value) # endif - std::memset(ghost_array.data(), - 0, - sizeof(Number) * ghost_array.size()); - else - std::fill(ghost_array.data(), - ghost_array.data() + ghost_array.size(), - 0); + std::memset(ghost_array.data(), + 0, + sizeof(Number) * ghost_array.size()); + else + std::fill(ghost_array.data(), + ghost_array.data() + ghost_array.size(), + 0); + } return; } # endif -- 2.39.5