Skip to content

Commit

Permalink
Changes to MallocV to take into consideration the memory space of a v…
Browse files Browse the repository at this point in the history
…ariable
  • Loading branch information
anagainaru committed Nov 14, 2023
1 parent 2d16eb3 commit 92bd27f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/adios2/toolkit/format/buffer/malloc/MallocV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "MallocV.h"
#include "adios2/helper/adiosFunctions.h"
#include "adios2/toolkit/format/buffer/BufferV.h"

#include <algorithm>
Expand Down Expand Up @@ -74,7 +75,12 @@ size_t MallocV::AddToVec(const size_t size, const void *buf, size_t align, bool
m_InternalBlock = (char *)realloc(m_InternalBlock, NewSize);
m_AllocatedSize = NewSize;
}
memcpy(m_InternalBlock + m_internalPos, buf, size);
#ifdef ADIOS2_HAVE_GPU_SUPPORT
if (MemSpace == MemorySpace::GPU)
helper::CopyFromGPUToBuffer(m_InternalBlock, m_internalPos, buf, MemSpace, size);
#endif
if (MemSpace == MemorySpace::Host)
memcpy(m_InternalBlock + m_internalPos, buf, size);

if (DataV.size() && !DataV.back().External &&
(m_internalPos == (DataV.back().Offset + DataV.back().Size)))
Expand Down

0 comments on commit 92bd27f

Please sign in to comment.