[Dune] MPIHelper.

Christian Engwer christi at uni-hd.de
Wed Sep 27 11:53:42 CEST 2006


Hi,

> 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 MPIHelper is not a singleton, then it is possible to instatiate
several MPIHelper objects. You could destroy one object, ad keep the
others, which would mean, that you call MPI_Finalize in the destroyed
object and can still use the other objects afterwards, although MPI is
not available anymore.

It should be possible to use a true singleton class for this problem,
which wouldn't involve a static object anymore.

Greeting Christian




More information about the Dune mailing list