Linux Installation Instructions¶
Required software packages:¶
Fortran 2003/2008 compiler: gfortran >= 7.x, intel >= 19
Git source control management tool
Message Passing Interface (MPI): E.g. MPICH2, Open MPI, etc.
BLAS/LAPACK libraries
Hierarchical Data Format HDF5
METIS/ParMETIS (for unstructured grids)
Installation Instructions¶
Install Git. Git is usually installed by default on most modern operating systems. It is usually available through your package manager.
Install a Fortran compiler (see bullets above), MPI, BLAS/LAPACK and HDF5 libraries (Note that petsc can be configured to download and install these libraries automatically. E.g. -\-download-mpich=yes or -\-download-openmpi=yes, -\-download-hdf5=yes, -\-download-f-blas-lapack=yes)
Install PETSc
3.1. Clone petsc and check out the supported version:
git clone https://gitlab.com/petsc/petsc petsc cd petsc git checkout v3.18.3
3.2. Configure PETSc (see PETSc installation instructions).
./configure --with-mpi-dir=<dir> --with-hdf5-dir=<dir> --with-blas-lapack-dir=<dir>
or
./configure --download-mpich=yes --download-hdf5=yes --download-hdf5-fortran-bindings=yes --download-fblaslapack=yes
or (to add unstructured grid capability)
./configure --download-mpich=yes --download-hdf5=yes --download-hdf5-fortran-bindings=yes --download-fblaslapack=yes --download-metis=yes --download-parmetis=yes
or (for most users, compile an optimized executable with full capability)
./configure --CFLAGS='-O3' --CXXFLAGS='-O3' --FFLAGS='-O3' --with-debugging=no --download-mpich=yes --download-hdf5=yes --download-hdf5-fortran-bindings=yes --download-fblaslapack=yes --download-metis=yes --download-parmetis=yes
Note: To support HDF5 zlib compression, add
--download-hdf5-configure-arguments="--with-zlib=yes"
to the command line.- 3.3. Set the PETSC_DIR and PETSC_ARCH environment variables based on the PETSc installation location (PETSC_DIR) and architecture (PETSC_ARCH: hardware, compilers, etc.). See PETSc environment variables.
The environmental variables can be set in your
~/.bashrc
file by adding the following two lines somewhere in the file:export PETSC_DIR=/home/username/path_to_top_level_petsc export PETSC_ARCH=gnu-c-debug
Note: You can check what your
PETSC_ARCH
actually is (the above is just an example) by opening up the directory where PETSc is installed and looking in theconfigure.log
file for--PETSC_ARCH=
. After you update your.bashrc
file, either close the terminal and open a new one, or typesource ./.bashrc
for the changes to take effect.
3.4. Compile PETSc
cd $PETSC_DIR make all
or even better follow the ‘make’ instructions printed at the end of configuration. E.g.
xxx=========================================================================xxx Configure stage complete. Now build PETSc libraries with: make PETSC_DIR=/proj/geo002/petsc PETSC_ARCH=cray-xt4-pgi all xxx=========================================================================xxx
Download (clone) PFLOTRAN off Bitbucket.
git clone https://bitbucket.org/pflotran/pflotran
Compile PFLOTRAN (ensure that PETSC_DIR and PETSC_ARCH environment variables are properly defined, or PFLOTRAN will not compile)
cd pflotran/src/pflotran git checkout maint/v4.0 make pflotran