Skip to content

Commit

Permalink
overlap data transfer with application activities for SSC readers
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonRuonanWang committed Jun 16, 2020
1 parent ba786bb commit ecf78fb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
45 changes: 28 additions & 17 deletions source/adios2/engine/ssc/SscReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ void SscReader::GetOneSidedPostPush()
{
TAU_SCOPED_TIMER_FUNC();
MPI_Win_post(m_MpiAllWritersGroup, 0, m_MpiWin);
MPI_Win_wait(m_MpiWin);
}

void SscReader::GetOneSidedFencePush()
{
TAU_SCOPED_TIMER_FUNC();
MPI_Win_fence(0, m_MpiWin);
MPI_Win_fence(0, m_MpiWin);
}

void SscReader::GetOneSidedPostPull()
Expand All @@ -75,7 +73,6 @@ void SscReader::GetOneSidedPostPull()
MPI_Get(m_Buffer.data() + i.second.first, i.second.second, MPI_CHAR,
i.first, 0, i.second.second, MPI_CHAR, m_MpiWin);
}
MPI_Win_complete(m_MpiWin);
}

void SscReader::GetOneSidedFencePull()
Expand All @@ -87,21 +84,17 @@ void SscReader::GetOneSidedFencePull()
MPI_Get(m_Buffer.data() + i.second.first, i.second.second, MPI_CHAR,
i.first, 0, i.second.second, MPI_CHAR, m_MpiWin);
}
MPI_Win_fence(0, m_MpiWin);
}

void SscReader::GetTwoSided()
{
TAU_SCOPED_TIMER_FUNC();
std::vector<MPI_Request> requests;
for (const auto &i : m_AllReceivingWriterRanks)
{
requests.emplace_back();
m_MpiRequests.emplace_back();
MPI_Irecv(m_Buffer.data() + i.second.first, i.second.second, MPI_CHAR,
i.first, 0, m_StreamComm, &requests.back());
i.first, 0, m_StreamComm, &m_MpiRequests.back());
}
MPI_Status statuses[requests.size()];
MPI_Waitall(requests.size(), requests.data(), statuses);
}

StepStatus SscReader::BeginStep(const StepMode stepMode,
Expand All @@ -121,23 +114,25 @@ StepStatus SscReader::BeginStep(const StepMode stepMode,
++m_CurrentStep;
if (m_MpiMode == "twosided")
{
GetTwoSided();
MPI_Status statuses[m_MpiRequests.size()];
MPI_Waitall(m_MpiRequests.size(), m_MpiRequests.data(), statuses);
m_MpiRequests.clear();
}
else if (m_MpiMode == "onesidedfencepush")
{
GetOneSidedFencePush();
MPI_Win_fence(0, m_MpiWin);
}
else if (m_MpiMode == "onesidedpostpush")
{
GetOneSidedPostPush();
MPI_Win_wait(m_MpiWin);
}
else if (m_MpiMode == "onesidedfencepull")
{
GetOneSidedFencePull();
MPI_Win_fence(0, m_MpiWin);
}
else if (m_MpiMode == "onesidedpostpull")
{
GetOneSidedPostPull();
MPI_Win_complete(m_MpiWin);
}
}

Expand Down Expand Up @@ -227,10 +222,26 @@ void SscReader::EndStep()
MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
m_StreamComm, &m_MpiWin);
}
if (m_Verbosity >= 5)

if (m_MpiMode == "twosided")
{
std::cout << "SscReader::EndStep, World Rank " << m_StreamRank
<< ", Reader Rank " << m_ReaderRank << std::endl;
GetTwoSided();
}
else if (m_MpiMode == "onesidedfencepush")
{
GetOneSidedFencePush();
}
else if (m_MpiMode == "onesidedpostpush")
{
GetOneSidedPostPush();
}
else if (m_MpiMode == "onesidedfencepull")
{
GetOneSidedFencePull();
}
else if (m_MpiMode == "onesidedpostpull")
{
GetOneSidedPostPull();
}
}

Expand Down
1 change: 1 addition & 0 deletions source/adios2/engine/ssc/SscReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SscReader : public Engine
MPI_Group m_MpiAllWritersGroup;
MPI_Comm m_StreamComm;
std::string m_MpiMode = "twosided";
std::vector<MPI_Request> m_MpiRequests;

int m_StreamRank;
int m_StreamSize;
Expand Down

0 comments on commit ecf78fb

Please sign in to comment.