[Dune] MPI Handling in dgfparser

Markus Blatt Markus.Blatt at iwr.uni-heidelberg.de
Sun Jul 16 16:56:12 CEST 2006


I have to correct myself:

On Sun, Jul 16, 2006 at 04:19:04PM +0200, Markus Blatt wrote:
>
> Still this can lead to funny situations in a program, as the variable
> might go out off scope (and MPI_Finalize might be called). Or a funny
> user might think of using the MPIHelper in to different nonoverlapping
> blocks then MPI_Init might be called again after MPI_Finalize:
> 
> int main(int argc, char** argv){
>     {
>       MPIHelper h = MPIHelper::instance(argc, argv);
>       // Maybe use YaspGrid here
>     }
>     // MPI_Finalize was called, so the next block will never run!
>     {
>       MPIHelper h = MPIHelper::instance(argc, argv);
>       // Maybe use AluGrid here
>     }
> }
>

On second thought this is not a problem for a correctly implemented
singleton as the instance will be deleted at the very end of the
program.
 
> Or maybe the user just calls MPIHelper::instance without storing
> it. Then the programm does nothing.
>

Also only in lousy implementations an issue.




More information about the Dune mailing list