A Discrete-Event Network Simulator
API
mpi-test-fixtures.h File Reference

Common methods for MPI examples. More...

#include <iomanip>
#include <sstream>
#include <ios>
+ Include dependency graph for mpi-test-fixtures.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ns3::Ptr< T >
 Smart pointer class similar to boost::intrusive_ptr. More...
 
class  ns3::SinkTracer
 

Namespaces

 ns3
 Every class exported by the ns3 library is enclosed in the ns3 namespace.
 

Macros

#define RANK0COUT(x)
 Write to std::cout only from rank 0. More...
 
#define RANK0COUTAPPEND(x)
 

Detailed Description

Common methods for MPI examples.

Since MPI output is coming from multiple processors it is the ordering between the processors is non-deterministic. For regression testing the output is sorted to force a deterministic ordering. Methods include here add line number to support this sorting.

Testing output is also grepped so only lines with "TEST" are included. Some MPI launchers emit extra text to output which must be excluded for regression comparisons.

Definition in file mpi-test-fixtures.h.

Macro Definition Documentation

◆ RANK0COUT

#define RANK0COUT (   x)
Value:
do \
if (SinkTracer::GetWorldRank () == 0) \
{ \
std::cout << "TEST : "; \
std::ios_base::fmtflags f( std::cout.flags() ); \
std::cout << std::setfill('0') << std::setw(5) << SinkTracer::GetLineCount (); \
std::cout.flags( f ); \
std::cout << " : " << x; \
} \
while (false)
double f(double x, void *params)
Definition: 80211b.c:70

Write to std::cout only from rank 0.

Number line for sorting output of parallel runs.

Parameters
xThe output operators.

Definition at line 55 of file mpi-test-fixtures.h.

Referenced by ReportRank(), and ns3::SinkTracer::Verify().

◆ RANK0COUTAPPEND

#define RANK0COUTAPPEND (   x)
Value:
do \
if (SinkTracer::GetWorldRank () == 0) \
{ \
std::cout << x ; \
} \
while (false)

Definition at line 67 of file mpi-test-fixtures.h.

Referenced by ReportRank().