Installation of PETSC 3.8.2 on High Sierra (10.13)
[as done by Boris in Dec. 2017]


————————————————————
1) MacPorts installations
 
a) Install mpich-gcc6 from MacPorts. You might have to install and/or update Macports before that. It will also install gcc7.
I uninstalled all other macports before, as I did a fresh install of the OS. 
 
port install mpich-gcc6

Make sure that this is actually selected, as you might have older installations present:

MacBook-BorisKaus-5:~ kausb$ port select mpi

Directories of the binaries are:

/opt/local/bin/mpicc-mpich-gcc6
/opt/local/bin/mpicxx-mpich-gcc6
/opt/local/bin/mpif90-mpich-gcc6

 
Similarly, installing P4EST requires autoconf and automake, splint, which are installed from MacPorts (together with cmake, not fully sure that this one is required)

————————————————————
2) Install PETSC

The current version of LaMEM is still running PETSc 3.7.*. (similar installation instructions apply).
These instructions apply to version 3.8.2

a) Make sure that there are no “leftover” mpi files from other/older MPI installations 

b) Set the directory:
export PETSC_DIR=$PWD from the petsc directory

c) Install PETSc with:

note: sometimes you have to delete existing directories with
sudo rm -rf arch-darwin-c-*


==== PETSC 3.7.7

OPTIMIZED:
./configure --prefix=/opt/petsc/petsc-3.7.7-opt --download-fblaslapack=1 --with-debugging=0 --COPTFLAGS="-g -O3" --FOPTFLAGS="-g -O3" --CXXOPTFLAGS="-g -O3" --with-large-file-io=1 --with-shared-libraries=0 --download-metis=1 --download-parmetis=1 --download-ml=1 --download-hypre=1 --download-scalapack=1 --download-mumps=1 --download-superlu_dist=1 --with-cc=/opt/local/bin/mpicc --with-fc=/opt/local/bin/mpif90 --with-cxx=/opt/local/bin/mpicxx  --download-zlib=1 --download-suitesparse=1 --download-hdf5=1  --download-pastix=1


DEBUG:
./configure --prefix=/opt/petsc/petsc-3.7.7-deb --download-fblaslapack=1 --with-debugging=1 --COPTFLAGS="-g -O0" --FOPTFLAGS="-g -O0" --CXXOPTFLAGS="-g -O0" --with-large-file-io=1 --with-shared-libraries=0 --download-metis=1 --download-parmetis=1 --download-ml=1 --download-hypre=1 --download-scalapack=1 --download-mumps=1 --download-superlu_dist=1 --with-cc=/opt/local/bin/mpicc --with-fc=/opt/local/bin/mpif90 --with-cxx=/opt/local/bin/mpicxx  --download-zlib=1 --download-suitesparse=1 --download-hdf5=1




==== PETSC 3.8.2

OPTIMIZED:
./configure --prefix=/opt/petsc/petsc-3.8.2-opt --download-fblaslapack=1 --with-debugging=0 --COPTFLAGS="-g -O3" --FOPTFLAGS="-g -O3" --CXXOPTFLAGS="-g -O3" --with-large-file-io=1 --with-shared-libraries=0 --download-metis=1 --download-parmetis=1 --download-ml=1 --download-hypre=1 --download-scalapack=1 --download-mumps=1 --download-superlu_dist=1 --with-cc=/opt/local/bin/mpicc --with-fc=/opt/local/bin/mpif90 --with-cxx=mpicxx --download-p4est=1 --download-p4est-configure-arguments="--enable-shared=0 --enable-mpi" --download-zlib=1 --download-suitesparse=1 --download-hdf5=1


DEBUG:
./configure --prefix=/opt/petsc/petsc-3.8.2-deb --download-fblaslapack=1 --with-debugging=1 --COPTFLAGS="-g -O0" --FOPTFLAGS="-g -O0" --CXXOPTFLAGS="-g -O0" --with-large-file-io=1 --with-shared-libraries=0 --download-metis=1 --download-parmetis=1 --download-ml=1 --download-hypre=1 --download-scalapack=1 --download-mumps=1 --download-superlu_dist=1 --with-cc=/opt/local/bin/mpicc --with-fc=/opt/local/bin/mpif90 --with-cxx=mpicxx --download-p4est=1 --download-p4est-configure-arguments="--enable-shared=0 --enable-mpi" --download-zlib=1 --download-suitesparse=1 --download-hdf5=1


Things should compile fine. Remember that you might need to use “sudo” to install the final code and use your root password.

————————————————————
3) Development environment
I stopped using Eclipse, and instead use Visual Studio Code, which is a simple download. It can do debugging with PETSc as well; Tobias Baumann put instructions for that somewhere.





===============================================================================                                                                               Compilers:
  C Compiler:         /opt/local/bin/mpicc   -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fvisibility=hidden -g -O3
  C++ Compiler:       /opt/local/bin/mpicxx  -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fvisibility=hidden -g -O3
  Fortran Compiler:   /opt/local/bin/mpif90  -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g -O3
Linkers:
  Static linker:   /opt/local/bin/ar cr
  Dynamic linker:   /opt/local/bin/mpicc  -dynamiclib -single_module -undefined dynamic_lookup -multiply_defined suppress   -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fvisibility=hidden -g -O3
MPI:
make:
BLAS/LAPACK: -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lflapack -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lfblas
fblaslapack:
cmake:
  Arch:
hdf5:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lz
SuperLU_DIST:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lsuperlu_dist
metis:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lmetis
parmetis:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lparmetis
hypre:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -L/opt/local/lib/mpich-gcc6 -L/opt/local/lib/gcc6/gcc/x86_64-apple-darwin17/6.4.0 -L/opt/local/lib/gcc6 -lHYPRE -lmpicxx -lstdc++
scalapack:
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lscalapack
MUMPS:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord
X:
  Includes: -I/opt/X11/include
  Library:  -Wl,-rpath,/opt/X11/lib -L/opt/X11/lib -lX11
ml:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -L/opt/local/lib/mpich-gcc6 -L/opt/local/lib/gcc6/gcc/x86_64-apple-darwin17/6.4.0 -L/opt/local/lib/gcc6 -lml -lmpicxx -lstdc++
pthread:
valgrind:
  Includes: -I/usr/local/include
SuiteSparse:
  Includes: -I/opt/petsc/petsc-3.7.7-opt/include
  Library:  -Wl,-rpath,/opt/petsc/petsc-3.7.7-opt/lib -L/opt/petsc/petsc-3.7.7-opt/lib -lumfpack -lklu -lcholmod -lbtf -lccolamd -lcolamd -lcamd -lamd -lsuitesparseconfig
ssl:
  Library:  -lssl -lcrypto
PETSc:
  PETSC_ARCH: arch-darwin-c-opt
  PETSC_DIR: /Users/kausb/Software/PETSC/petsc-3.7.7
  Scalar type: real
  Precision: double
  Clanguage: C
  shared libraries: disabled
  Integer size: 32
  Memory alignment: 16
xxx=========================================================================xxx
 Configure stage complete. Now build PETSc libraries with (gnumake build):
   make PETSC_DIR=/Users/kausb/Software/PETSC/petsc-3.7.7 PETSC_ARCH=arch-darwin-c-opt all
xxx=========================================================================xxx
