Skip to content

Commit

Permalink
Merge pull request #2346 from JasonRuonanWang/ssc-handshake
Browse files Browse the repository at this point in the history
added more explicit error messages for MpiHandsake
  • Loading branch information
JasonRuonanWang authored Jun 20, 2020
2 parents 44a08b8 + da1f68d commit 942438c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions source/adios2/helper/adiosMpiHandshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ void MpiHandshake::Test()
}
}

bool MpiHandshake::Check(const std::string &filename)
bool MpiHandshake::Check(const std::string &filename, const bool verbose)
{
int m_Verbosity = 1;

Test();

// check if RendezvousAppCount reached

if (m_WritersMap[filename].size() + m_ReadersMap[filename].size() !=
m_RendezvousAppCounts[filename])
{
if (m_Verbosity >= 10)
if (verbose)
{
std::cout << "MpiHandshake Rank " << m_WorldRank << " Stream "
<< filename << ": " << m_WritersMap[filename].size()
Expand Down Expand Up @@ -212,14 +210,15 @@ void MpiHandshake::Handshake(const std::string &filename, const char mode,
// wait and check if required RendezvousAppCount reached

auto startTime = std::chrono::system_clock::now();
while (!Check(filename))
while (!Check(filename, false))
{
std::this_thread::sleep_for(std::chrono::microseconds(100));
auto nowTime = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::seconds>(
nowTime - startTime);
if (duration.count() > timeoutSeconds)
{
Check(filename, true);
throw(std::runtime_error("Mpi handshake timeout on Rank" +
std::to_string(m_WorldRank) +
" for Stream " + filename));
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/helper/adiosMpiHandshake.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MpiHandshake

private:
static void Test();
static bool Check(const std::string &filename);
static bool Check(const std::string &filename, const bool verbose);
static size_t PlaceInBuffer(const size_t stream, const int rank);
static void PrintMaps();
static void PrintMaps(const int printRank, const std::string &filename);
Expand Down

0 comments on commit 942438c

Please sign in to comment.