本文记录在Linux编译安装PETSc的流程。
1 下载代码
git clone https://gitlab.com/petsc/petsc.git
cd ./petsc
git checkout v3.21.4
2 安装依赖
3 PETSc Without MPI
3.1 Debug版本
3.1.1 配置
export PETSC_ARCH=arch-linux-c-debug-dto
python3 ./configure --prefix=/data/3rdparty/arch-linux-c-debug-dto --with-debugging=1 --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-openmp=1 --with-mpi=0
3.1.2 编译安装
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-debug-dto all
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-debug-dto install
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-debug-dto check
3.2 Release版本
3.2.1 配置
export PETSC_ARCH=arch-linux-c-opt-dto
python3 ./configure --prefix=/data/3rdparty/arch-linux-c-opt-dto --with-debugging=0 --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-openmp=1 --with-mpi=0
3.2.2 编译安装
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-opt-dto all
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-opt-dto install
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=arch-linux-c-opt-dto check
4 PETSc With MPI
附录I:Find PETSc for CMake
FindPETSC.cmake
参考资料
PETSchttps://petsc.org/release/