spack+PETSc+LaMEM安装和编译

473 字
2 分钟
spack+PETSc+LaMEM安装和编译

spack+PETSc+LaMEM安装和编译#

环境预装,该软件安装和编译,需要提前搭建好网络环境

spack安装和配置#

前提环境#

sudo apt update
sudo apt install build-essential gfortran clang-18
git clone https://github.com/spack/spack.git ~/spack
cd ~/spack
. share/spack/setup-env.sh
spack compiler find

安装PETSc#

spack install petsc@3.22.5 +mumps +suite-sparse -hypre -hdf5 -shared -debug
## 上面那个测试的时候部分功能不通过,下面这是另一个完整版的,不一定百分百能全部通过(未测试)
spack install petsc@3.22.5 +mumps +suite-sparse +superlu-dist -hypre -hdf5 -shared -debug
## 下面是test通过率
Test Summary: | Pass Fail Total Time
LaMEM Testsuite | 91 13 104 5m26.2s
t1_FB1_Direct | 3 3 6.7s
t2_FB2_MG | 1 1 2.0s
t3_Subduction | 4 4 38.6s
t4_Localisation | 3 1 4 12.9s
t5_Permeability | 1 1 0.7s
t6_AdjointGradientScalingLaws_p2 | 1 1 2 0.5s
t7_AdjointGradientInversion | 5 5 7.7s
t8_AdjointGradients | 6 4 10 10.7s
t9_PhaseDiagrams | 1 1 11.6s
t10_Compressibility | 4 4 7.7s
t11_Subgrid | 1 1 0.2s
t12_Temperature_diffusion | 3 3 3.3s
t13_Rheology0D | 9 9 6.1s
t14_1DStrengthEnvelope | 8 8 3.4s
t15_RTI | 1 1 5.7s
t16_PhaseTransitions | 7 7 45.4s
t17_InflowOutflow | 3 1 4 15.0s
t18_SimpleShear | 4 4 1.4s
t19_CompensatedInflow | 2 2 34.4s
t20_FSSA | 1 1 6.4s
t21_Passive_Tracer | 2 2 4.3s
t22_RidgeGeom | 2 2 1.0s
t23_Permeable | 1 1 24.3s
t24_Erosion_Sedimentation | 2 2 26.0s
t25_APS_Healing | 1 1 0.2s
t26_Dike | 6 6 17.8s
t27_T-dep_Conductivity | 1 1 21.6s
t28_HeatRecharge | 2 2 0.9s
t29_PermeableSides_VelBoxes | 1 1 1.0s
t30_Timestep_Schedule | 1 1 0.4s
t31_geomIO | 2 2 1.4s
t32_BC_velocity | 2 2 2.5s
t33_Initial_APS | 6 6 4.6s

提示,出现该报错,直接方向键上键,回车等待重新下载

error
error

安装成功

success
success

环境设置#

复制下面的命令直接粘贴复制到命令行回车

echo '
if command -v spack &> /dev/null; then
export PETSC_DIR=$(spack location -i petsc)
export PETSC_OPT=$PETSC_DIR
export PETSC_DEB=$PETSC_DIR
export PETSC_ARCH=""
fi' >> ~/.bashrc
source ~/.bashrc

LaMEM编译#

#首先下载
git clone https://github.com/UniMainzGeo/LaMEM.git ./LaMEM
#然后输入这个命令
spack load petsc
#前往LaMEM/src目录,
cd LaMEM/src
# 编译
make mode=opt all

配置#

#配置
echo 'export PATH="$HOME/LaMEM/bin/opt:$PATH"' >> ~/.bashrc
source ~/.bashrc

测试#

sudo snap install julia --classic
#成功后输入julia --version,看看有没有版本号
julia --version
#前往测试目录
cd ../test/
#运行测试
make test

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!

赞助
spack+PETSc+LaMEM安装和编译
https://blog.sunkme.com/posts/spackpetsclamem安装和编译/
作者
Abu
发布于
2026-03-23
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
Abu
生命不息,折腾不止!
目录

目录