<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Cool, thanks Jorrit for the nice explanation :)
<div class=""><br class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Dr. Roland Guichard </div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Research Software Engineer</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
UCL-RITS</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Internal Extension: 86947</div>
External Number: 02031086947
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<br class="">
</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br class="">
</div>
<br class="Apple-interchange-newline">
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 5 Jul 2019, at 16:41, Jorrit Fahlke <<a href="mailto:jorrit@jorrit.de" class="">jorrit@jorrit.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Am Fr,  5. Jul 2019, 14:06:39 +0000 schrieb Guichard, Roland:<br class="">
<blockquote type="cite" class="">Thank you for the clarification. Some comments below:<br class="">
<br class="">
On 5 Jul 2019, at 14:38, Jö Fahlke <<a href="mailto:jorrit.fahlke@wwu.de" class="">jorrit.fahlke@wwu.de</a><<a href="mailto:jorrit.fahlke@wwu.de" class="">mailto:jorrit.fahlke@wwu.de</a>>> wrote:<br class="">
<br class="">
Am Fr,  5. Jul 2019, 12:28:51 +0000 schrieb Guichard, Roland:<br class="">
I see thanks.<br class="">
A quick question though, does it mean that there are several MPI initializations possible within Dune and the communicator that needs to be passed to the GridPtr (from dune-fem) is responsible for handling the mesh in parallel ?<br class="">
<br class="">
MPI_Init is only ever called once.<br class="">
<br class="">
<br class="">
Yes, but potentially through multiple ways. I mean by this that for instance<br class="">
the Dune::Fem::MPIManager::initialize( argc, argv ) implicitly calls the<br class="">
MPIHelper::instance( argc, argv ).<br class="">
</blockquote>
<br class="">
And MPIHelper::instance() ensures that it will create the internal MPIHelper<br class="">
singleton just once, see<br class="">
- <a href="https://gitlab.dune-project.org/core/dune-common/blob/master/dune/common/parallel/mpihelper.hh#L225" class="">
https://gitlab.dune-project.org/core/dune-common/blob/master/dune/common/parallel/mpihelper.hh#L225</a><br class="">
- <a href="https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables" class="">
https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables</a><br class="">
<br class="">
In addition, the constructor of the MPIHelper singleton checks whether<br class="">
MPI_Init() has been called previously, and if so won't call it itself, see<br class="">
<a href="https://gitlab.dune-project.org/core/dune-common/blob/master/dune/common/parallel/mpihelper.hh#L249" class="">https://gitlab.dune-project.org/core/dune-common/blob/master/dune/common/parallel/mpihelper.hh#L249</a><br class="">
That should catch any initializations done before MPIHelper::instance() has<br class="">
been called the first time.<br class="">
<br class="">
<blockquote type="cite" class="">I understand that managers are wrappers around the MPIHelper one. However what I don’t quiet get so far is that, in the code, MPI ranks and size are retrieved using direct MPI calls:<br class="">
<br class="">
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);<br class="">
MPI_Comm_size(MPI_COMM_WORLD, &numProcs);<br class="">
<br class="">
But since the managers provide that functionality I don’t see the point in doing this. Ideally and for readability, you would access anything you need through a single manager. And this also applies to the communicator.<br class="">
</blockquote>
<br class="">
If by "managers" you mean "grid managers": Some of those predate Dune, so<br class="">
began life on plain MPI.  They could be changed to get the MPI communicator<br class="">
from MPIHelper, but that's always going to be MPI_COMM_WORLD, so there's<br class="">
little point.  Others are actually independend of Dune, and Dune<br class="">
only provides a wrapper around them.  Since they don't know they're being used<br class="">
from inside Dune, they can't assume the presence of Dune::MPIHelper.  If their<br class="">
authors chose to hardcode them to use MPI_COMM_WORLD, then that is was Dune<br class="">
has to roll with.<br class="">
<br class="">
The purpose of Dune::MPIHelper was not the provide a general C++ abstraction<br class="">
over plain MPI.  Instead, it was meant to provide a very basic abstraction<br class="">
over the two cases of compiling with and without MPI, so the user can avoid<br class="">
the #ifdef's.<br class="">
<br class="">
<blockquote type="cite" class="">But that is merely my opinion.<br class="">
<br class="">
<br class="">
Though it is up to the grid manager implementation which MPI communicators are<br class="">
supported.  Some managers may implicitly assume MPI_COMM_WORLD, others may not<br class="">
support MPI at all (which is implicitly equivalent to MPI_COMM_SELF).<br class="">
<br class="">
Hm, do I need to understand managers in a larger scope that MPI only then ?<br class="">
<br class="">
<br class="">
For yet others it may be possible to specify the communicator when<br class="">
constructing the grid.  So if you obtained that communicator by splitting<br class="">
MPI_COMM_WORLD into two subsets of nodes, you will end up with two independent<br class="">
grids, each operating within one of the subsets.<br class="">
<br class="">
OK got that one.<br class="">
<br class="">
<br class="">
Regards,<br class="">
Jö.<br class="">
<br class="">
--<br class="">
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,<br class="">
University of Münster, Orleans-Ring 10, D-48149 Münster<br class="">
Tel: +49 251 83 35146 Fax: +49 251 83 32729<br class="">
<br class="">
This message is protected by DoubleROT13 encryption<br class="">
Attempting to decode it violates the DMCA/WIPO acts<br class="">
<br class="">
</blockquote>
<br class="">
-- <br class="">
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,<br class="">
University of Münster, Orleans-Ring 10, D-48149 Münster<br class="">
Tel: +49 251 83 35146 Fax: +49 251 83 32729<br class="">
<br class="">
Interpunktion, Orthographie und Grammatik der Email ist frei erfunden.<br class="">
Eine Übereinstimmung mit aktuellen oder ehemaligen Regeln wäre rein<br class="">
zufällig und ist nicht beabsichtigt.<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>