From: Daniel Arndt Date: Tue, 1 Oct 2019 21:19:13 +0000 (+0000) Subject: Avoid using std::memset for device data X-Git-Tag: v9.2.0-rc1~997^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3287aa5f13c4de43b26dde8490b1858bcd297046;p=dealii.git Avoid using std::memset for device data --- 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