[petsc-dev] PETSC_DIR and PETSC_ARCH: used to distinguish between multiple applications ?

Barry Smith bsmith at mcs.anl.gov
Sun Apr 23 21:10:08 CDT 2017

  There are two ways to build different versions of PETSc needed by other packages.

1)   Use PETSC_DIR and PETSC_ARCH to distinguish different installs. For example to build a version of PETc that uses hypre and one that doesn't you can do one install with for example PETSC_ARCH=arch-basic and another with PETSC_ARCH=arch-hypre where one adds --download-hypre to the second install.

   export PETSC_ARCH=arch-basic

   export PETSC_ARCH=arch-hypre
    ./configure --download-hypre

the other approach is to use

2)  the ./configure --prefix option with each build, for example 

   ./configure --prefix=/Users/me/petsc-basic 
   make install 


   ./configure --prefix=/Users/me/petsc-hypre --download-hypre
   make install

  They are actually really similar, the only difference is that when using the first case the libraries are in 


    while in the second case they are in


    and there is not PETSC_ARCH

    The approach with --prefix is more conventional, since it is used with gnu packages. The $PETSC_ARCH approach has less 
directory duplication since everything is in the $PETSC_DIR directory.


> On Apr 23, 2017, at 7:08 PM, Kevin Buckley <kevin.buckley.ecs.vuw.ac.nz at gmail.com> wrote:
> Been a while since I have(re)installed a PETSc, but I have just
> come into install it as a dependecy for a different package to
> that for which I have installed it in the past.
> The original package has a requirement for
>  --with-clanguage=cxx
> whereas the current one doesn't, but it does have a requirement for
> different external packages, eg hypre.
> In terms of laying out PETSc, can (should ?) one use PETSC_DIR
> and PETSC_ARCH: to combine everything PETSc-related under one,
> top-level, say
> /path/to/PETSC/3.7.5
> with subdirs, or do the differing requirements demand two different "top-level "
> /path/to/PETSC/3.7.5/Package1
> /path/to/PETSC/3.7.5/Package2
> hierachies, each then with duplicated files across the two?
> Any pointers welcome,
> Kevin
> ---
> Kevin M. Buckley
> eScience Consultant
> School of Engineering and Computer Science
> Victoria University of Wellington
> New Zealand

More information about the petsc-dev mailing list