From 9daf5cae0ad603e876503c3180905c4cb6c8b2f8 Mon Sep 17 00:00:00 2001 From: anagainaru Date: Sun, 15 Sep 2024 18:40:21 -0400 Subject: [PATCH] Update memory selection when there is a layout mismatch --- bindings/CXX11/adios2/cxx11/Engine.h | 4 ---- source/adios2/core/VariableBase.cpp | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/CXX11/adios2/cxx11/Engine.h b/bindings/CXX11/adios2/cxx11/Engine.h index 26fd076a9f..4f7a3fae36 100644 --- a/bindings/CXX11/adios2/cxx11/Engine.h +++ b/bindings/CXX11/adios2/cxx11/Engine.h @@ -218,9 +218,7 @@ class Engine auto bufferView = static_cast>(data); #if defined(ADIOS2_HAVE_KOKKOS) || defined(ADIOS2_HAVE_GPU_SUPPORT) auto bufferMem = bufferView.memory_space(); - auto bufferLayout = bufferView.layout(); variable.SetMemorySpace(bufferMem); - variable.SetArrayLayout(bufferLayout); #endif Put(variable, bufferView.data(), launch); } @@ -424,9 +422,7 @@ class Engine auto bufferView = static_cast>(data); #if defined(ADIOS2_HAVE_KOKKOS) || defined(ADIOS2_HAVE_GPU_SUPPORT) auto bufferMem = bufferView.memory_space(); - auto bufferLayout = bufferView.layout(); variable.SetMemorySpace(bufferMem); - variable.SetArrayLayout(bufferLayout); #endif Get(variable, bufferView.data(), launch); } diff --git a/source/adios2/core/VariableBase.cpp b/source/adios2/core/VariableBase.cpp index 67758beeb5..f069be9d49 100644 --- a/source/adios2/core/VariableBase.cpp +++ b/source/adios2/core/VariableBase.cpp @@ -57,6 +57,8 @@ void VariableBase::SetArrayLayout(const ArrayOrdering layout) UpdateLayout(m_Shape); UpdateLayout(m_Count); UpdateLayout(m_Start); + UpdateLayout(m_MemoryStart); + UpdateLayout(m_MemoryCount); return; } if (m_ArrayLayout != layout) @@ -117,6 +119,8 @@ void VariableBase::SetMemorySpace(const MemorySpace mem) ExistingMemSpace + " and cannot received a " + NewMemSpace + " buffer"); } + if (mem == MemorySpace::GPU && m_ArrayLayout == ArrayOrdering::Auto) + SetArrayLayout(ArrayOrdering::ColumnMajor); #endif m_MemSpace = mem; }