References:
[1] Bandopadhyaym "Tools in Scientific Computing" https://www.youtube.com/watch?v=gFOpFKr9S2I&list=PLbRMhDVUMngccapOgCr2Tm5sn_cuHeAf6&index=1, Lectures 29-38
Installation on Windows Subsystem for Linux (version 3.18.5, updated 3/3/23)
[I'm currently learning how to use PETSc, so obviously the first part will be some directions on how to compile PETSc. I'm going to start with the simplest example and then move to more complicated setups.]
Using our standard directory structure, we want to download PETSc into
mkdir ~/opt/petsc
cd ~/opt/petsc
wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-with-docs-3.18.5.tar.gz
cd ~/opt/petsc/petsc-3.18.5
./configure --with-cc=gcc \
--with-cxx=g++ \
--with-fc=gfortran \
--download-mpich \
--download-fblaslapack
make PETSC_DIR=$HOME/opt/petsc/petsc-3.18.5 PETSC_ARCH=arch-linux-c-debug all
Installation on Windows Subsystem for Linux (for Firedrake, under development)
sudo apt install libxml2-dev
sudo apt install libcurl4-openssl-dev
export PETSC_DIR=$HOME/opt/petsc/petsc-3.18.5
export PETSC_ARCH=arch-linux-wsl-dev
../configure --download-bison \
--download-chaco \
--download-cmake \
--download-eigen=/home/ragasej1/opt/firedrake/src/eigen-3.3.3.tgz \
--download-hdf5 \
--download-hypre \
--download-ml \
--download-mpich \
--download-mumps \
--download-ptscotch \
--download-scalapack \
--download-superlu_dist \
--with-c2html=0 \
--with-debugging=0 \
--with-fortran-bindings=0 \
--with-shared-libraries=1
make PETSC_DIR=/home/ragasej1/opt/petsc/petsc-3.18.5 PETSC_ARCH=arch-linux-wsl-dev all
make PETSC_DIR=/home/ragasej1/opt/petsc/petsc-3.18.5 PETSC_ARCH=arch-linux-wsl-dev check