MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / CheckRcvStats

Function CheckRcvStats

Src/Base/AMReX_FabArrayBase.cpp:2572–2615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2570#ifdef BL_USE_MPI
2571
2572bool
2573CheckRcvStats (Vector<MPI_Status>& recv_stats, const Vector<std::size_t>& recv_size, int tag)
2574{
2575 for (int i = 0, n = static_cast<int>(recv_size.size()); i < n; ++i) {
2576 if (recv_size[i] > 0) {
2577 std::size_t count = 0;
2578 int tmp_count = 0;
2579
2580 const int comm_data_type = ParallelDescriptor::select_comm_data_type(recv_size[i]);
2581 if (comm_data_type == 1) {
2582 MPI_Get_count(&recv_stats[i],
2583 ParallelDescriptor::Mpi_typemap<char>::type(),
2584 &tmp_count);
2585 count = tmp_count;
2586 } else if (comm_data_type == 2) {
2587 MPI_Get_count(&recv_stats[i],
2588 ParallelDescriptor::Mpi_typemap<unsigned long long>::type(),
2589 &tmp_count);
2590 count = sizeof(unsigned long long) * tmp_count;
2591 } else if (comm_data_type == 3) {
2592 MPI_Get_count(&recv_stats[i],
2593 ParallelDescriptor::Mpi_typemap<ParallelDescriptor::lull_t>::type(),
2594 &tmp_count);
2595 count = sizeof(ParallelDescriptor::lull_t) * tmp_count;
2596 } else {
2597 amrex::Abort("TODO: message size is too big");
2598 }
2599
2600 if (count != recv_size[i]) {
2601 if (amrex::Verbose()) {
2602 amrex::AllPrint() << "ERROR: Proc. " << ParallelContext::MyProcSub()
2603 << " received " << count << " bytes of data from Proc. "
2604 << recv_stats[i].MPI_SOURCE
2605 << " with tag " << recv_stats[i].MPI_TAG
2606 << " error " << recv_stats[i].MPI_ERROR
2607 << ", but the expected size is " << recv_size[i]
2608 << " with tag " << tag << "\n";
2609 }
2610 return false;
2611 }
2612 }
2613 }
2614 return true;
2615}
2616
2617#endif
2618

Callers 5

Comm_finishFunction · 0.85
FillBoundary_finishMethod · 0.85
ParallelCopy_finishMethod · 0.85
FillBoundaryFunction · 0.85
ParallelCopy_finishFunction · 0.85

Calls 5

select_comm_data_typeFunction · 0.85
AbortFunction · 0.85
AllPrintClass · 0.85
MyProcSubFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected