[Dune-devel] The importance of MPIHelper in sequential programs

Oliver Sander oliver.sander at tu-dresden.de
Fri Oct 19 21:19:16 CEST 2018


Dear Dune,

I often find myself in the situation of writing purely sequential Dune programs.
They use grids like UGGrid or YaspGrid, but they are not supposed to be run in
a distributed setting ever.

I nevertheless have to begin each such program with

  MPIHelper::instance(argc, argv);

This is because I do have MPI installed on my machine, and Dune has picked it up.
Next, most grids have a CollectiveCommunication object somewhere, and the constructor
of this will throw an exception if MPI_Init hasn't been called previously.

While this is easy to understand from a developer point of view, it still strikes
me as odd from the user POV.  Why should I init MPI in a program that will never
actually use it (except for deep under the hood, of course)?  On the other hand
I have to admit that I do not know an obvious solution to this problem.
Have the constructor of CollectiveCommunication call MPI_Init if necessary?
Make it fall back to a sequential implementation if the communicator size is 1?

Anyhow, I'd be curious to hear other people's opinions on this.

Cheers,
Oliver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20181019/a4d475a1/attachment.sig>


More information about the Dune-devel mailing list