From 5e7e6170eb945f85a1c7274e37960392bfd1b0fa Mon Sep 17 00:00:00 2001 From: Jan Ciesko Date: Thu, 28 Jul 2022 17:22:39 -0600 Subject: [PATCH 1/2] Fix missing record->m_destroy functor assignement in ViewMapping --- src/core/Kokkos_RemoteSpaces_ViewMapping.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp b/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp index 202dccc8..d656939f 100644 --- a/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp +++ b/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp @@ -1204,11 +1204,22 @@ class ViewMapping { } #endif + const std::string &alloc_name = + static_cast const &>( + arg_prop) + .value; + // Only initialize if the allocation is non-zero. // May be zero if one of the dimensions is zero. if (alloc_size && alloc_prop::initialize) { - // Construct values - record->m_destroy.construct_shared_allocation(); + // Assume destruction is only required when construction is requested. + // The ViewValueFunctor has both value construction and destruction + // operators. + record->m_destroy = functor_type( + static_cast const + &>(arg_prop) + .value, + (value_type *)m_handle.ptr, m_offset.span(), alloc_name); } return record; From dcb90650c7ce12a3079adefd51918cbff4d99722 Mon Sep 17 00:00:00 2001 From: Jan Ciesko Date: Mon, 1 Aug 2022 10:35:02 -0600 Subject: [PATCH 2/2] Move setting alloc_name into if-body --- src/core/Kokkos_RemoteSpaces_ViewMapping.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp b/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp index d656939f..6effef77 100644 --- a/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp +++ b/src/core/Kokkos_RemoteSpaces_ViewMapping.hpp @@ -1204,14 +1204,14 @@ class ViewMapping { } #endif - const std::string &alloc_name = - static_cast const &>( - arg_prop) - .value; - // Only initialize if the allocation is non-zero. // May be zero if one of the dimensions is zero. if (alloc_size && alloc_prop::initialize) { + const std::string &alloc_name = + static_cast const &>( + arg_prop) + .value; + // Assume destruction is only required when construction is requested. // The ViewValueFunctor has both value construction and destruction // operators.