Go to the documentation of this file.
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;
208 static Communication<MPICommunicator>
214 static Communication<MPICommunicator>
244 int rank ()
const {
return rank_; }
248 int size ()
const {
return size_; }
253 bool initializedHere_;
254 void prevent_warning(
int){}
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;
Implements an utility class that provides MPI's collective communication methods.
int size() const
return rank of process, i.e. one
Definition: mpihelper.hh:153
Implements an utility class that provides collective communication methods for sequential programs.
Definition of macros controlling symbol visibility at the ABI level.
FakeMPIHelper MPIHelper
If no MPI is available FakeMPIHelper becomes the MPIHelper.
Definition: mpihelper.hh:301
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18
A fake mpi helper.
Definition: mpihelper.hh:69
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:103
static Communication< MPICommunicator > getCommunication()
Definition: mpihelper.hh:118
int rank() const
return rank of process, i.e. zero
Definition: mpihelper.hh:149
Definition: communication.hh:45
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:91
@ isFake
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition: mpihelper.hh:77
No_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:83
Collective communication interface and sequential default implementation.
Definition: communication.hh:80
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:138
Standard Dune debug streams.
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition: stdstreams.hh:114
static Communication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:112
Dune namespace.
Definition: alignedallocator.hh:13