您的位置:首页 > 娱乐 > 明星 > Windows下编译安装PETSc

Windows下编译安装PETSc

2024/12/23 2:40:29 来源:https://blog.csdn.net/qq_26221775/article/details/141072156  浏览:    关键词:Windows下编译安装PETSc

本文记录在Windows下使用MinGW-w64编译安装PETSc的流程。

0、环境

操作系统Windows 11
MSYS2msys2-x86_64-20240507

1、开发环境

首先,下载并安装MSYS2,然后编辑PATH环境变量,添加mingw64相关路径:C:\msys64\mingw64\bin。
然后,下载并安装 msmpisetup.exe msmpisdk.msi 。

2、依赖

打开MSYS2 MINGW64控制台,备份/etc/pacman.d/mirrorlist.mingw64,

cp /etc/pacman.d/mirrorlist.mingw64 /etc/pacman.d/mirrorlist.mingw64.backup

然后编辑/etc/pacman.d/mirrorlist.mingw64以添加国内开源镜像源,并更新软件包数据库,

# Tsinghua
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64

pacman -Sy

运行以下命令安装依赖包,

pacman -S autoconf automake-wrapper bison bsdcpio make git \
mingw-w64-x86_64-toolchain patch python flex \
pkg-config pkgfile tar unzip mingw-w64-x86_64-cmake \
mingw-w64-x86_64-msmpi mingw-w64-x86_64-openblas mingw-w64-x86_64-jq

3. 下载PETSc源码

git clone -b release https://gitlab.com/petsc/petsc.git petsc
cd ./petsc/
git checkout v3.21.4

4、编译配置

export PETSC_ARCH=arch-mswin-c-debug-dmo
/usr/bin/python ./configure --prefix=/opt/petsc/arch-mswin-c-debug-dmo --with-debugging=1 --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --with-openmp=1 --with-mpiexec='/C/Program\ Files/Microsoft\ MPI/Bin/mpiexec'
export PETSC_ARCH=arch-mswin-c-opt-dmo
/usr/bin/python ./configure --prefix=/opt/petsc/arch-mswin-c-opt-dmo --with-debugging=0 --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --with-openmp=1 --with-mpiexec='/C/Program\ Files/Microsoft\ MPI/Bin/mpiexec'

 

5、编译与安装 

make PETSC_DIR=/mingw64/src/petsc PETSC_ARCH=arch-mswin-c-debug-dmo all
make PETSC_DIR=/mingw64/src/petsc PETSC_ARCH=arch-mswin-c-debug-dmo install
make PETSC_DIR=/mingw64/src/petsc PETSC_ARCH=arch-mswin-c-opt-dmo all
make PETSC_DIR=/mingw64/src/petsc PETSC_ARCH=arch-mswin-c-opt-dmo install

网络资料

PETScicon-default.png?t=N7T8https://petsc.org/release/

MSYS2icon-default.png?t=N7T8https://www.msys2.org/

PETSCc安装与常见问题icon-default.png?t=N7T8https://blog.csdn.net/qq_36130886/article/details/121731836

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com