[Dune] MPIHelper.

Markus Blatt mblatt at plagula.de
Wed Sep 27 11:36:24 CEST 2006


Hi,

On Tue, Sep 26, 2006 at 06:14:36PM +0200, Robert Kloefkorn wrote:
> 
> kleine Änderung in MPIHelper. So wie die singleton variable
> implementiert war, hätte man diese in .cc file tun müssen. Da das ganze
> File aber von HAVE_MPI abhängt, ist das in diesem Fall blöd.
> Ich habe das mal geändert. Ich hoffe es ergeben sich für niemanden
> Konfikte. Ansonsten auf revision 4709 zurückgreifen.
> 

Wow, you react quicker than I can think ;-)

I took another look at the MPI standard and I think we can even do it
without a singleton at all.
There is the function MPI_Initialized which can be called before
MPI_Init to see whether MPI is already inititialized. Instead of the
singleton one could just check the result of this function and call
MPI_Init to initialize MPI if it was not initialized already.
Once the scope of MPIHelper ends MPI_Finalized will be called.

If we do this change I would also like to implement Christians idea of
changing the naming convention:

Instead of MPIHelper we call this ParallelEnvironment. The pendant of
MPIHelper will be in namespace Dune::mpi and the FakeMPIHelper will be
in Dune directly (or maybe better in Dune::FakeParallel)

Usage would then be:

int main(int argc, char** argv){
  using Dune::mpi::ParallelEnvironment;
  ParallelEnvironment env(argc, argv);

 // Do the parallel stuff

}


Comments?

Cheers,

Markus




More information about the Dune mailing list