| 1 | #!/bin/bash
|
|---|
| 2 | set -u # NOTE: Do not set -e as it will cause this script to fail when there are errors in underlying Python scripts
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 | ## Constants
|
|---|
| 6 | #
|
|---|
| 7 | VER="3.12.3"
|
|---|
| 8 |
|
|---|
| 9 | PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
|
|---|
| 10 | PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
|
|---|
| 11 |
|
|---|
| 12 | # Download source
|
|---|
| 13 | $ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
|
|---|
| 14 |
|
|---|
| 15 | # Unpack source
|
|---|
| 16 | tar -zxvf petsc-${VER}.tar.gz
|
|---|
| 17 |
|
|---|
| 18 | # Cleanup
|
|---|
| 19 | rm -rf ${PREFIX} ${PETSC_DIR}
|
|---|
| 20 | mkdir ${PETSC_DIR}
|
|---|
| 21 |
|
|---|
| 22 | # Move source to $PETSC_DIR
|
|---|
| 23 | mv petsc-${VER}/* ${PETSC_DIR}
|
|---|
| 24 | rm -rf petsc-${VER}
|
|---|
| 25 |
|
|---|
| 26 | # Configure
|
|---|
| 27 | #
|
|---|
| 28 | # - Added -fallow-argument-mismatch option to FFLAGS in order to clear "Error:
|
|---|
| 29 | # Rank mismatch between actual argument at [...]"
|
|---|
| 30 | # - Added -fallow-invalid-boz option to FFLAGS in order to clear "Error: BOZ
|
|---|
| 31 | # literal constant at [...]"
|
|---|
| 32 | #
|
|---|
| 33 | cd ${PETSC_DIR}
|
|---|
| 34 | ./config/configure.py \
|
|---|
| 35 | --prefix="${PREFIX}" \
|
|---|
| 36 | --PETSC_DIR="${PETSC_DIR}" \
|
|---|
| 37 | --FFLAGS="-fallow-argument-mismatch -fallow-invalid-boz" \
|
|---|
| 38 | --with-debugging=0 \
|
|---|
| 39 | --with-valgrind=0 \
|
|---|
| 40 | --with-x=0 \
|
|---|
| 41 | --with-ssl=0 \
|
|---|
| 42 | --with-pic=1 \
|
|---|
| 43 | --with-mpiexec="/c/PROGRA~1/MICROS~1/Bin/mpiexec.exe" \
|
|---|
| 44 | --with-mpi-lib="-L${MSMPI_ROOT}/lib -lmsmpi" \
|
|---|
| 45 | --with-mpi-include="${MSMPI_ROOT}/include" \
|
|---|
| 46 | --with-metis-dir=${METIS_ROOT} \
|
|---|
| 47 | --with-parmetis-dir=${PARMETIS_ROOT} \
|
|---|
| 48 | --with-blas-lib="-L${BLAS_ROOT}/lib -lblas" \
|
|---|
| 49 | --known-64-bit-blas-indices=0 \
|
|---|
| 50 | --with-lapack-lib="-L${LAPACK_ROOT}/lib -llapack" \
|
|---|
| 51 | --with-scalapack-dir=${SCALAPACK_ROOT} \
|
|---|
| 52 | --with-mumps-dir=${MUMPS_ROOT}
|
|---|
| 53 |
|
|---|
| 54 | # Compile and install
|
|---|
| 55 | make
|
|---|
| 56 | make install
|
|---|
| 57 |
|
|---|
| 58 | # NOTE:
|
|---|
| 59 | # - Hack to recover from failed installation (appears to happen only on Windows
|
|---|
| 60 | # when reproducing symbolic links in destination directory) rather than
|
|---|
| 61 | # trying to patch src/config/install.py
|
|---|
| 62 | #
|
|---|
| 63 | if [ $? -ne 0 ]; then
|
|---|
| 64 | make install
|
|---|
| 65 | fi
|
|---|