Skip to content

Commit

Permalink
Merge pull request #2656 from JasonRuonanWang/ssc
Browse files Browse the repository at this point in the history
Use ssc::Buffer for data buffers
  • Loading branch information
JasonRuonanWang authored Mar 23, 2021
2 parents 31ed12a + cb64b5c commit 4453d08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions source/adios2/engine/ssc/SscReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ void SscReader::BeginStepConsequentFixed()
void SscReader::BeginStepFlexible(StepStatus &status)
{
m_AllReceivingWriterRanks.clear();
m_Buffer.resize(1, 0);
m_Buffer.reserve(1);
m_Buffer[0] = 0;
m_GlobalWritePattern.clear();
m_GlobalWritePattern.resize(m_StreamSize);
m_LocalReadPattern.clear();
Expand Down Expand Up @@ -199,7 +200,7 @@ void SscReader::PerformGets()
{
totalDataSize += i.second.second;
}
m_Buffer.resize(totalDataSize);
m_Buffer.reserve(totalDataSize);
for (const auto &i : m_AllReceivingWriterRanks)
{
MPI_Win_lock(MPI_LOCK_SHARED, i.first, 0, m_MpiWin);
Expand Down Expand Up @@ -246,7 +247,7 @@ void SscReader::PerformGets()
{ \
continue; \
} \
helper::NdCopy<T>(m_Buffer.data() + b.bufferStart, b.start, \
helper::NdCopy<T>(m_Buffer.data<char>() + b.bufferStart, b.start, \
b.count, true, true, \
reinterpret_cast<char *>(br.data), br.start, \
br.count, true, true); \
Expand Down Expand Up @@ -277,7 +278,7 @@ void SscReader::EndStepFixed()
{
MPI_Win_free(&m_MpiWin);
SyncReadPattern();
MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
MPI_Win_create(m_Buffer.data(), m_Buffer.capacity(), 1, MPI_INFO_NULL,
m_StreamComm, &m_MpiWin);
}
if (m_MpiMode == "twosided")
Expand Down Expand Up @@ -484,7 +485,7 @@ void SscReader::SyncReadPattern()
{
totalDataSize += i.second.second;
}
m_Buffer.resize(totalDataSize);
m_Buffer.reserve(totalDataSize);

if (m_Verbosity >= 20)
{
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/engine/ssc/SscReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SscReader : public Engine
ssc::Buffer m_GlobalWritePatternBuffer;

ssc::RankPosMap m_AllReceivingWriterRanks;
std::vector<char> m_Buffer;
ssc::Buffer m_Buffer;
MPI_Win m_MpiWin;
MPI_Group m_WriterGroup;
MPI_Comm m_StreamComm;
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/engine/ssc/SscReader.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void SscReader::GetDeferredCommon(Variable<T> &variable, T *data)
if (b.shapeId == ShapeID::GlobalArray ||
b.shapeId == ShapeID::LocalArray)
{
helper::NdCopy<T>(m_Buffer.data() + b.bufferStart,
helper::NdCopy<T>(m_Buffer.data<char>() + b.bufferStart,
b.start, b.count, true, true,
reinterpret_cast<char *>(data),
vStart, vCount, true, true);
Expand Down

0 comments on commit 4453d08

Please sign in to comment.