本文记录在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 Build using GNU Compiler Collection
3.1.1 配置
export PETSC_ARCH=gnu-debug-dto
python3 ./configure --prefix=/data/3rdparty/gnu-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=gnu-debug-dto all
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=gnu-debug-dto install
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=gnu-debug-dto check
3.2 Build using Intel(R) oneAPI DPC++/C++ Compiler
3.2.1 配置
export PETSC_ARCH=intel-opt-dto
python3 ./configure --prefix=/data/3rdparty/intel-opt-dto --with-debugging=0 --with-cc=icx --with-cxx=icpx --with-fc=ifort --with-openmp=1 --with-mpi=0
3.2.2 编译安装
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=intel-opt-dto all
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=intel-opt-dto install
make PETSC_DIR=/data/3rdparty/petsc PETSC_ARCH=intel-opt-dto check
4 PETSc With MPI
附录I:Find PETSc for CMake
附录II:VS Code配置
-
CMake Kits
编辑'~/.local/share/CMakeTools/cmake-tools-kits.json'或者'.vscode/cmake-kits.json',如下
[
{
"name": "GCC 11.4.0 x86_64-linux-gnu",
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
},
"isTrusted": true
},
{
"name": "Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2",
"compilers": {
"C": "/opt/intel/oneapi/compiler/latest/bin/icx",
"CXX": "/opt/intel/oneapi/compiler/latest/bin/icpx"
},
"isTrusted": true
}
]