[petsc-maint #38919] Re: stupid, stupid, stupid MPI.py

Barry Smith bsmith at mcs.anl.gov
Mon Dec 14 13:06:26 CST 2009

    Ok, after tracing through the code I finally understand.

    If --with-batch is used (which means programs cannot be run so the  
shared library check can not be done) then --with-mpi-shared is used  
to say if the MPI libraries are shared or not (instead of testing).

    The text is MPI.py is TERRIBLE and confusing. First

     help.addArgument('MPI', '-with-mpi- 
shared=<bool>',                           nargs.ArgBool(None, None,  
'Try to use shared MPI libraries'))

   It does not "Try to use shared libraries". It is a flag to indicate  
if the libraries are shared or not.

   def checkSharedLibrary(self):
     '''Check that the libraries for MPI are shared libraries'''
       self.shared = self.libraries.checkShared('#include <mpi.h> 
\n','MPI_Init','MPI_Initialized','MPI_Finalize',checkLink =  
self.checkPackageLink,libraries = self.lib, defaultArg = 'with-mpi- 
shared', executor = self.mpiexec)
     except RuntimeError, e:
       if self.framework.argDB['with-shared']:
         raise RuntimeError('Shared libraries cannot be built using  
MPI provided.\nEither rebuild with --with-shared=0 or rebuild MPI with  
shared library support')
       self.framework.logPrint('MPI libraries cannot be used with  
shared libraries')
       self.shared = 0

    It does not check "that the libraries are shared" it just sets a  
flag indicating if they are shared or not.

    I will change the docs to make things clear and introduce a -- 
download-mpich-shared to tell it to make the shared libraries.

    Now everyone should be happy,

    Will push my fixes shortly.


On Dec 14, 2009, at 10:40 AM, Matthew Knepley wrote:

> On Mon, Dec 14, 2009 at 10:39 AM, Lisandro Dalcín  
> <dalcinl at gmail.com> wrote:
> On Mon, Dec 14, 2009 at 1:33 PM, Matthew Knepley <knepley at gmail.com>  
> wrote:
> > On Mon, Dec 14, 2009 at 10:28 AM, Lisandro Dalcín  
> <dalcinl at gmail.com> wrote:
> >>
> >> On Mon, Dec 14, 2009 at 11:34 AM, Matthew Knepley <knepley at gmail.com 
> >
> >> wrote:
> >> >
> >> > If we are using shared libraries, and the MPI shared library  
> was broken,
> >> > the
> >> > configure failed. This option was added
> >> > to allow the user to turn off that check.
> >> >
> >>
> >> What does 'broken' means? How can the lib be broken for  
> configure, but
> >> not for linking PETSc or user programs?
> >
> > It would also be broken there too, and fall back to the static  
> libraries.
> >
> Sorry, I'm still confused. What does 'broken' means? Sorry about my
> ignorance: In the case of a corrupted (whatever that could mean)
> shared lib file, does the linker fall back to use a static lib?
> I believe so. I know that is why I put this in. The shared lib test  
> would break, since
> they were not functional, but the library overall would work.
>   Matt
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
> -- 
> What most experimenters take for granted before they begin their  
> experiments is infinitely more interesting than any results to which  
> their experiments lead.
> -- Norbert Wiener

More information about the petsc-dev mailing list