Skip to content

Commit

Permalink
Set the layout when the memory space is set
Browse files Browse the repository at this point in the history
  • Loading branch information
anagainaru committed Sep 23, 2024
1 parent 9daf5ca commit 04aac83
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions source/adios2/core/VariableBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ MemorySpace VariableBase::GetMemorySpace(const void *ptr)

void VariableBase::SetMemorySpace(const MemorySpace mem)
{
#if defined(ADIOS2_HAVE_KOKKOS) || defined(ADIOS2_HAVE_GPU_SUPPORT)
ArrayOrdering layout = m_BaseLayout;
#endif
#ifdef ADIOS2_HAVE_GPU_SUPPORT
if (m_MemSpace != MemorySpace::Detect && m_MemSpace != mem)
{
Expand All @@ -119,8 +122,14 @@ void VariableBase::SetMemorySpace(const MemorySpace mem)
ExistingMemSpace + " and cannot received a " +
NewMemSpace + " buffer");
}
if (mem == MemorySpace::GPU && m_ArrayLayout == ArrayOrdering::Auto)
SetArrayLayout(ArrayOrdering::ColumnMajor);
if (mem == MemorySpace::GPU)
layout = ArrayOrdering::ColumnMajor;
#endif
#if defined(ADIOS2_HAVE_KOKKOS) || defined(ADIOS2_HAVE_GPU_SUPPORT)
// set the layout based on the buffer memory space
// skipping throwing an exception for a mismatch
if (m_ArrayLayout == ArrayOrdering::Auto)
SetArrayLayout(layout);
#endif
m_MemSpace = mem;
}
Expand Down

0 comments on commit 04aac83

Please sign in to comment.