[Dune] Should we use #ifdef HAVE_MPI in parallel GMSH Reader

Markus Blatt markus at dr-blatt.de
Thu Nov 27 10:14:10 CET 2014


Hi,

up front:

Do not use #ifdef HAVE_MPI, but #if HAVE_MPI. We are using a trick to
enable MPI only if the compilation flags include our MPI flags. To
accomplish this HAVE_MPI will always be defined if your system
provides even DUNE does not activate it.

The same (#if instead of #ifdef) holds for the following defines
HAVE_DUNE_BOOST
HAVE_GMP
HAVE_UMFPACK
HAVE_ALUGRID
HAVE_ALBERTA
HAVE_UG
HAVE_PARMETIS
HAVE_SUPERLU
HAVE_PETSC

On Thu, Nov 27, 2014 at 09:42:48AM +0100, Aleksejs Fomins wrote:
> I have at some point written a parallel curvilinear GMSH reader, which
> reads the GMSH file in blocks.
> 
> For that purpose, I use mpihelper everywhere for collective
> communication. I have written the code, defining the mpihelper only if
> HAVE_MPI=true. At the moment, the code will not work, if HAVE_MPI=false,
> and that I would like to change.
> 
> I have heard that even if there is no mpi in the system, Dune is capable
> of faking it to an extent. I see 2 solutions
> 

As long as you do not call any MPI routines directly, but use
MPI_Helper, etc that is true. We use template specializations to
provide sequential fallbacks.

> 1) Delete all #ifdef HAVE_MPI statements, and use mpihelper even if
> there is no mpi. In that case the question is if the fake helper can
> successfully fake things like
> 
> mpihelper_.getCollectiveCommunication().allgather(...);
> 
> necessary for communication and
> 
> Dune::MPIHelper::getCommunicator();
> 
> necessary for ParMetis
> 

That is the way to go, if you do not call any MPI functions directly.

Markus

-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141127/35ee87f0/attachment.sig>


More information about the Dune mailing list