Skip to content

Commit

Permalink
Update memory selection when there is a layout mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
anagainaru committed Sep 23, 2024
1 parent cae0a45 commit 9daf5ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions bindings/CXX11/adios2/cxx11/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ class Engine
auto bufferView = static_cast<AdiosView<U>>(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);
}
Expand Down Expand Up @@ -424,9 +422,7 @@ class Engine
auto bufferView = static_cast<AdiosView<U>>(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);
}
Expand Down
4 changes: 4 additions & 0 deletions source/adios2/core/VariableBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9daf5ca

Please sign in to comment.