11 const char PFX[] =
">>> ";
17 const std::string& name,
18 std::ostream& output_stream,
19 unsigned long table_size )
20 : enableOutput( enabled ), tableName( name ), ostr( output_stream ), maxSize( table_size ), haveMPI( false )
23 MPI_Comm_rank( MPI_COMM_WORLD, &
mpiRank );
30 : enableOutput( enabled ), tableName( name ), ostr( std::cerr ), maxSize( table_size )
36 MPI_Initialized( &have_init );
40 MPI_Comm_rank( MPI_COMM_WORLD, &
mpiRank );
56 std::list< DRange >::const_iterator i;
64 bool wrote_zero =
false;
68 assert( i->begin <= i->end );
70 h = processed.
insert( h, i->begin, i->end );
74 if( i->end ) h = processed.
insert( h, i->begin + 1, i->end );
81 unprocessed =
subtract( unprocessed, processed );
82 if( unprocessed.
empty() )
return;
87 unsigned long b = j->first;
88 unsigned long e = j->second;
89 if( b == 1 && !wrote_zero ) b = 0;
91 ostr <<
PFX <<
tableName <<
" : range not read/written: [" << b <<
"," << e <<
"]" << std::endl;
100 DRange ins = { begin, begin + count - 1,
static_cast< long unsigned >(
mpiRank ) };
115 ostr <<
": Out of bounds write on rank " <<
mpiRank <<
": [" << ins.
begin <<
"," << ins.
end
116 <<
"] >= " <<
maxSize << std::endl;
119 std::list< DRange >::iterator i;
122 if( i->end >= ins.
begin && i->begin <= ins.
end )
125 if( i->rank == ins.
rank )
132 ostr <<
": Conflicting write for ranks " << i->rank <<
" and " << ins.
rank;
134 ostr <<
": [" << i->begin <<
"," << i->end <<
"] and [" << ins.
begin <<
"," << ins.
end <<
"]" << std::endl;
148 MPI_Comm_size( MPI_COMM_WORLD, &commsize );
149 int count = 3 *
dataSet.size();
150 std::vector< int > displs( commsize ), counts( commsize );
151 MPI_Gather( &count, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, MPI_COMM_WORLD );
153 for(
int i = 1; i < commsize; ++i )
154 displs[i] = displs[i - 1] + counts[i - 1];
155 int total = ( displs.back() + counts.back() ) / 3;
158 std::vector< DRange > send(
dataSet.size() ), recv( total );
160 MPI_Gatherv( (
void*)&send[0], 3 * send.size(), MPI_UNSIGNED_LONG, (
void*)&recv[0], &counts[0], &displs[0],
161 MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD );
165 for(
int i = count; i < total; ++i )