Skip to content

Commit

Permalink
Add more verbosity to eckit_test_mpi to diagnose intermittent failures (
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed May 6, 2024
1 parent 527e118 commit 3a9f8f7
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions tests/mpi/eckit_test_mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,9 @@ CASE("test_probe") {

comm.barrier();

std::stringstream errstr;
bool error = false;

auto count = nproc;
while (count > 0) {
auto status = comm.probe(comm.anySource(), comm.anyTag());
Expand All @@ -952,18 +955,30 @@ CASE("test_probe") {
EXPECT(sz == 1);

comm.receive(&data[status.source()], sz, status.source(), status.tag());
errstr << "[test_probe:" << irank << "] receive data["<<status.source()<<"] = " << data[status.source()] << " -- EXPECTED: " << status.source() << '\n';
if( data[status.source()] != status.source()) {
error = true;
}
--count;
}

for (int i = 0; i < nproc; i++) {
EXPECT(i == data[i]);
if (error) {
errstr << "[test_probe:" << irank << "] data = [ ";
for( auto& v: data ) {
errstr << v << " ";
}
errstr << " ]\n";
std::cout << errstr.str() << std::endl;
}

std::vector<mpi::Status> sts = comm.waitAll(requests);

for (auto& st : sts) {
EXPECT(st.error() == 0);
}

comm.barrier();
EXPECT(!error);
}

CASE("test_iProbe") {
Expand All @@ -982,6 +997,9 @@ CASE("test_iProbe") {

comm.barrier();

std::stringstream errstr;
bool error = false;

auto count = nproc;
while (count > 0) {
auto status = comm.iProbe(comm.anySource(), comm.anyTag());
Expand All @@ -996,19 +1014,30 @@ CASE("test_iProbe") {
EXPECT(sz == 1);

comm.receive(&data[status.source()], sz, status.source(), status.tag());

errstr << "[test_iProbe:" << irank << "] receive data["<<status.source()<<"] = " << data[status.source()] << " -- EXPECTED: " << status.source() << '\n';
if( data[status.source()] != status.source()) {
error = true;
}
--count;
}

for (int i = 0; i < nproc; i++) {
EXPECT(i == data[i]);
if (error) {
errstr << "[test_iProbe:" << irank << "] data = [ ";
for( auto& v: data ) {
errstr << v << " ";
}
errstr << " ]\n";
std::cout << errstr.str() << std::endl;
}

std::vector<mpi::Status> sts = comm.waitAll(requests);

for (auto& st : sts) {
EXPECT(st.error() == 0);
}

comm.barrier();
EXPECT(!error);
}

//----------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 3a9f8f7

Please sign in to comment.