[MOAB-dev] [PATCH] Call MPI_Init if using MPI.

Mark Miller miller86 at llnl.gov
Wed Oct 28 16:44:40 CDT 2009


Hi Jed,

You mentioned this on visit-users as well. So, I am going to comment on
it.

I think dummying up a serial MPI 'implementation' is actually
non-trivial in general. That is why products like Morph-MPI exist. 

Most HPC codes I have worked on have parallel-specific code blocks of
one form or another. That isn't so much to address MPI-linkage issues in
serial as it is to address situations in which the actual logic and work
to be done is different in serial and parallel.

In fact PETSC is the ONLY HPC code I am aware of that does this. And, I
recall many years ago running into MPI name collisions when using it in
Ale3d. For some reason, Ale3d's MPI_Init() call wound up resolving to
PETSC's dummy implementation.

I think it is a problem in general for different MPI implementations to
'live' in the same executable, even if one of them is a 'serial dummy'.
And, there isn't necessarily any reason to expect that a parallel
application is always going to use a given parallel-capable library, in
parallel as well. HDF5 is a great example. We  at LLNL don't use is it
in parallel though it is used from parallel apps. If HDF5 had taken the
dummy MPI approach, that would present a serious problem.

Mark


On Wed, 2009-10-28 at 13:29, Jed Brown wrote:
> Tim Tautges wrote:
> > IMO, this should be internal to MOAB proper, not in the tools.  That
> > way, serial applications outside of MOAB aren't responsible for
> > MPI_Init'ing.
> 
> That patch was just duct-tape.  You can have an MBInit()/MBFinalize()
> pair but of course you need to accomodate the case where the user
> retains control over initializing MPI.
> 
> I am strongly in favor of using dummy MPI implementations for serial
> builds.  Almost all MPI functions can be implemented as macros when the
> communicator is guaranteed to have size 1.  This gets rid of all the
> messy preprocessor stuff.  If some code must be run in serial, you just
> check the size of your communicator and error if it is larger than 1.
> 
> $PETSC_DIR/include/mpiuni/mpi.h may be suitable as a drop-in replacement.
> 
> 
> Jed
-- 
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86 at llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F)  (530)-753-8511 (!!LLNL BUSINESS ONLY!!)



More information about the moab-dev mailing list