[petsc-dev] dealing with MPIUNi

Barry Smith bsmith at mcs.anl.gov
Fri Feb 26 15:05:55 CST 2010

   Ok, it is still a mess as a special case but I don't see a way  
around it if we want users to be able to use the mpi.h and mpif.h  
directly. So it is back to adding the -Iinclude/mpiuni to the search  
directories. But there is never a libmpiuni.a

   Make sure to pull BuildSystem also,


  I'll just have to tolerate the filth

On Feb 25, 2010, at 4:19 PM, Barry Smith wrote:

> After listening to our discussion of the half-plant/half animal  
> handling of MPIUni I have adopted the plant :-) model.
> Background: All the packages in PETSc/packages and BuildSystem/ 
> config/packages have the following paradigm except MPI and BlasLapack.
> 1) PETSc can be built --with-package or --with-package=0
> 2) If --with-package=0 then there is no PETSC_HAVE_package defined,  
> no extra libraries to link against and no extra include paths to  
> look in
> BlasLapack breaks this paradigm in only one way! You cannot use -- 
> with-blaspack=0
> MPI breaks the paradigm more completely. You can use --with-mpi=0  
> BUT if you use --with-mpi=0 then PETSC_HAVE_MPI is STILL  
> defined!!!!!! There is an extra library to link against and an extra  
> include path to look in.
> The two possible solutions to resolve this perverse beast are
> 1) make mpiuni be a --download-mpiuni replacement for MPI, as we do  
> --download-c-blaslapack (this would replace the current --with-mpi=0  
> support).
> 2) better supporting --with-mpi=0 without breaking the paradigm
>  I agree with Matt that 1 is the more elegant solution, since it  
> fits the paradigm perfectly. But having --with-mpi=0 is easier and  
> more understandable to the user then explaining about downloading a  
> dummy MPI.
>  Thus I have implemented and pushed 2). When you use --with-mpi=0
> 1) the macro PETSC_HAVE_MPI is not set
> 2) the list of include directories is not added to
> 3) the list of linked against libraries is not added to.
> I have implemented 2) and 3) by having in petsc.h (fortran also)
> #if defined(PETSC_HAVE_MPI)
> #include "mpi.h"
> #else
> #include "mpiuni/mpi.h"
> #endif
> and putting the dummy MPI stubs always into the PETSc libraries for  
> both single library and multiple library PETSc installs.
> Note: this means one cannot have an include "mpi.h" in the uni case  
> which bothered me initially but then Lisandro convinced me it was  
> not a bad thing.
> The actual code changes to implement this were, of course, tiny. It  
> is not perfect (only --download-mpiuni would be perfect :-), but it  
> is better than before.
> Sorry Matt,
>   Barry

More information about the petsc-dev mailing list