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

Tim Tautges tautges at mcs.anl.gov
Wed Oct 28 20:15:33 CDT 2009



Jed Brown wrote:

>> 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.
> 
> It is just there so that MPI_Initialized() returns correct results.
> PETSc uses this to determine whether to call MPI_Finalize() when the
> user calls PetscFinalize().  This seems circular, but it's important so
> that user code does not need to behave differently when running in
> serial (doesn't even need to know).
> 

Huh?  MPI_Init needs to be called so that MPI_Initialized returns correct results?  So it doesn't return correct results 
if you haven't called MPI_Init?  Why even have the function then?  I thought it was supposed to work before MPI_Init too.

And for Petsc, if it requires calling PetscFinalize, why doesn't it keep some state to tell whether it was Petsc that 
called MPI_Init?  Should Petsc be calling Finalize even when it didn't call MPI_Init?


> 
> You can't do anything sensible in parallel without being passed a
> communicator (it's actually quite bad that MPI_COMM_WORLD is hard-coded
> all over moab/parallel, though I don't personally have an application
> that requires proper handling of communicators).  In my opinion,
> implicit use of MPI_COMM_WORLD is okay when parallel options are given
> but the program doesn't pass in a communicator.
> 

Yeah, we'll get that cleaned up eventually.

- tim

> 
> 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