[MOAB-dev] [PATCH] Call MPI_Init if using MPI.
Tim Tautges
tautges at mcs.anl.gov
Wed Oct 28 17:48:56 CDT 2009
In my experience, using dummy MPI has been confusing. My experience is somewhat limited, since I only encountered it
with Zoltan (which uses something it calls sMPI, don't know if that's from somewhere else or homegrown).
One of the things that confused me in that case was that I had to initialize MPI, even though I had a serial application
that wanted to use Zoltan serially. I think the same confusion will exist with MOAB.
Finally, I don't see why a serial application need call MPI_Init, even for MOAB compiled for parallel, if none of the
functionality it uses is parallel. Looking at MOAB source, if the app doesn't pass any options which clearly indicate
parallel behavior, none of the MPI stuff ever gets called. We might still need to link to MPI from the serial app, but
I'm not even sure of that in the static linking case. Something in these statements must be wrong, though, if mbconvert
was failing due to not calling MPI_Init. Maybe I'll look at that...
- tim
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
>
--
================================================================
"You will keep in perfect peace him whose mind is
steadfast, because he trusts in you." Isaiah 26:3
Tim Tautges Argonne National Laboratory
(tautges at mcs.anl.gov) (telecommuting from UW-Madison)
phone: (608) 263-8485 1500 Engineering Dr.
fax: (608) 263-4499 Madison, WI 53706
More information about the moab-dev
mailing list