91 static MPICommunicator comm;
131 (void)argc; (void)argv;
140 int rank ()
const {
return 0; }
144 int size ()
const {
return 1; }
183 return MPI_COMM_WORLD;
194 return MPI_COMM_SELF;
227 int rank ()
const {
return rank_; }
231 int size ()
const {
return size_; }
236 bool initializedHere_;
237 void prevent_warning(
int){}
241 : initializedHere_(
false)
243 int wasInitialized = -1;
244 MPI_Initialized( &wasInitialized );
249 static int is_initialized = MPI_Init(&argc, &argv);
250 prevent_warning(is_initialized);
251 initializedHere_ =
true;
254 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
255 MPI_Comm_size(MPI_COMM_WORLD,&size_);
257 assert( rank_ >= 0 );
258 assert( size_ >= 1 );
260 dverb <<
"Called MPI_Init on p=" << rank_ <<
"!" << std::endl;
265 int wasFinalized = -1;
266 MPI_Finalized( &wasFinalized );
267 if(!wasFinalized && initializedHere_)
270 dverb <<
"Called MPI_Finalize on p=" << rank_ <<
"!" <<std::endl;
Implements an utility class that provides MPI's collective communication methods. ...
No_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:81
static CollectiveCommunication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:198
int size() const
return rank of process, i.e. one
Definition: mpihelper.hh:144
Standard Dune debug streams.
A real mpi helper.This helper should be used for parallel programs.
Definition: mpihelper.hh:159
int size() const
return number of processes
Definition: mpihelper.hh:231
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:217
Dune namespace.
Definition: alignment.hh:10
Definition of macros controlling symbol visibility at the ABI level.
Collective communication interface and sequential default implementation.
Definition: collectivecommunication.hh:78
static MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:181
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:173
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:192
int rank() const
return rank of process
Definition: mpihelper.hh:227
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition: stdstreams.hh:114
A fake mpi helper.
Definition: mpihelper.hh:67
int rank() const
return rank of process, i.e. zero
Definition: mpihelper.hh:140
Definition: collectivecommunication.hh:42
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:129
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:89
static CollectiveCommunication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:109
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition: mpihelper.hh:75
Implements an utility class that provides collective communication methods for sequential programs...
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:101