[Dune] [Dune-Commit] dune-common r6227 - trunk/dune/common
Markus Blatt
Markus.Blatt at iwr.uni-heidelberg.de
Thu Nov 4 16:18:57 CET 2010
Hey Martin,
I am not 100% sure, but I think MPI_INITIALIZED is not part of the older
MPI standards (e.g. 1.1, 1.0). Therefore this might break the code
with some MPI implementations. Have you checked by using e.g. lam?
Regards,
Markus
On Thu, Nov 04, 2010 at 11:19:26AM +0100, mnolte at dune-project.org wrote:
> Author: mnolte
> Date: 2010-11-04 11:19:25 +0100 (Thu, 04 Nov 2010)
> New Revision: 6227
>
> Modified:
> trunk/dune/common/mpihelper.hh
> Log:
> assert MPI_INITIALIZED returns the state we expect
>
>
> Modified: trunk/dune/common/mpihelper.hh
> ===================================================================
> --- trunk/dune/common/mpihelper.hh 2010-11-03 15:37:16 UTC (rev 6226)
> +++ trunk/dune/common/mpihelper.hh 2010-11-04 10:19:25 UTC (rev 6227)
> @@ -202,14 +202,27 @@
> int rank_;
> int size_;
> void prevent_warning(int){}
> +
> + static bool wasInitialized ()
> + {
> + int wasInitialized = -1;
> + MPI_Initialized( &wasInitialized );
> + return bool( wasInitialized );
> + }
>
> //! \brief calls MPI_Init with argc and argv as parameters
> MPIHelper(int& argc, char**& argv)
> {
> rank_ = -1;
> size_ = -1;
> +
> + assert( !wasInitialized() );
> static int is_initialized = MPI_Init(&argc, &argv);
> prevent_warning(is_initialized);
> +
> + MPI_Init(&argc, &argv);
> + assert( wasInitialized() );
> +
> MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
> MPI_Comm_size(MPI_COMM_WORLD,&size_);
>
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
>
--
Markus Blatt, Interdisciplinary Center for Scientific Computing,
University Heidelberg, Im Neuenheimer Feld 368, D-69120 Heidelberg
'Mathematics knows no races or geographic boundaries; for
mathematics, the cultural world is one country' - David Hilbert
More information about the Dune
mailing list