Skip to content

Commit

Permalink
moved MPI clean up back to MpiHandshake
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonRuonanWang committed Jun 30, 2020
1 parent 6e326aa commit 830a608
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
37 changes: 16 additions & 21 deletions source/adios2/helper/adiosMpiHandshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,6 @@ std::map<std::string, std::map<int, std::set<int>>> MpiHandshake::m_ReadersMap;
std::map<int, int> MpiHandshake::m_AppsSize;
std::set<int> MpiHandshake::m_RanksToReceive;

MpiHandshake::~MpiHandshake()
{
// clean up MPI requests

for (auto &rs : m_RecvRequests)
{
for (auto &r : rs)
{
MPI_Status status;
int success;
MPI_Test(&r, &success, &status);
if (!success)
{
MPI_Cancel(&r);
}
}
}
m_RecvRequests.clear();
}

size_t MpiHandshake::PlaceInBuffer(size_t stream, int rank)
{
return rank * m_MaxStreamsPerApp * m_ItemSize + stream * m_ItemSize;
Expand Down Expand Up @@ -270,7 +250,22 @@ void MpiHandshake::Handshake(const std::string &filename, const char mode,
}
}

std::cout << "Rank " << m_WorldRank << " completed ..." << std::endl;
// clean up MPI requests

for (auto &rs : m_RecvRequests)
{
for (auto &r : rs)
{
MPI_Status status;
int success;
MPI_Test(&r, &success, &status);
if (!success)
{
MPI_Cancel(&r);
}
}
}
m_RecvRequests.clear();

++m_StreamID;
}
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/helper/adiosMpiHandshake.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace helper
class MpiHandshake
{
public:
~MpiHandshake();

/**
* Start the handshake operations and wait until the rendezvous conditions
* are reached, or timeout.
Expand Down

0 comments on commit 830a608

Please sign in to comment.