140 (void)argc; (void)argv;
149 int rank ()
const {
return 0; }
153 int size ()
const {
return 1; }
157 FakeMPIHelper(
const FakeMPIHelper&);
158 FakeMPIHelper& operator=(
const FakeMPIHelper);
192 return MPI_COMM_WORLD;
203 return MPI_COMM_SELF;
244 int rank ()
const {
return rank_; }
248 int size ()
const {
return size_; }
253 bool initializedHere_;
254 void prevent_warning(
int){}
257 MPIHelper(
int& argc,
char**& argv)
258 : initializedHere_(false)
260 int wasInitialized = -1;
261 MPI_Initialized( &wasInitialized );
266 static int is_initialized = MPI_Init(&argc, &argv);
267 prevent_warning(is_initialized);
268 initializedHere_ =
true;
271 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
272 MPI_Comm_size(MPI_COMM_WORLD,&size_);
274 assert( rank_ >= 0 );
275 assert( size_ >= 1 );
277 dverb <<
"Called MPI_Init on p=" << rank_ <<
"!" << std::endl;
282 int wasFinalized = -1;
283 MPI_Finalized( &wasFinalized );
284 if(!wasFinalized && initializedHere_)
287 dverb <<
"Called MPI_Finalize on p=" << rank_ <<
"!" <<std::endl;
291 MPIHelper(
const MPIHelper&);
292 MPIHelper& operator=(
const MPIHelper);
301 typedef FakeMPIHelper MPIHelper;
Implements an utility class that provides collective communication methods for sequential programs.
Implements an utility class that provides MPI's collective communication methods.
Standard Dune debug streams.
Definition of macros controlling symbol visibility at the ABI level.
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition: stdstreams.hh:114
Dune namespace.
Definition: alignedallocator.hh:14
Definition: communication.hh:45
Collective communication interface and sequential default implementation.
Definition: communication.hh:81
A fake mpi helper.
Definition: mpihelper.hh:70
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:91
static Communication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:112
int size() const
return rank of process, i.e. one
Definition: mpihelper.hh:153
static Communication< MPICommunicator > getCommunication()
Definition: mpihelper.hh:118
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:138
@ isFake
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition: mpihelper.hh:77
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:103
No_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:83
int rank() const
return rank of process, i.e. zero
Definition: mpihelper.hh:149
A real mpi helper.
Definition: mpihelper.hh:169
int size() const
return number of processes
Definition: mpihelper.hh:248
static Communication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:209
int rank() const
return rank of process
Definition: mpihelper.hh:244
@ isFake
Are we fake (i. e. pretend to have MPI support but are compiled without.
Definition: mpihelper.hh:176
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:182
static MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:190
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:201
static Communication< MPICommunicator > getCommunication()
Definition: mpihelper.hh:215
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:234