要用到liggghts做有限元模拟,需要再centos系统上安装相关库。总结如下:
1.GCC升级
安装centos-release-scl-rh sudo yum install centos-release-scl-rh
安装devtoolset-8-build sudo yum install devtoolset-8-build
安装devtoolset-8-gdb sudo yum install devtoolset-8-gdb
设置开机启动 source /opt/rh/devtoolset-8/enable
vim /etc/profile把 source /opt/rh/devtoolset-8/enable 放到文件profile末尾 重启后,gcc就更新为新版本
2.python安装
下载合适的python版本后执行命令。
./configure --prefix=/usr/local/python3 --enable-optimizations
make && make install
建立软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
修改环境变量
然后source ~/.bash_profile
切换python版本
1.sudo update-alternatives --config python ##会显示已安装的所有python版本,输入数字选择默认版本
2.python -V ##查看当前版本
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1 ##设置python2优先级为1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2 ##设置python3优先级为2
3.MPI源码安装
安装过程参考博客:
https://blog.csdn.net/qq_43259903/article/details/131805431
在root用户下使用mpirun命令需要修改.bashrc,在文件最后添加如下两行:
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
4.VTK安装
下载需要的vtk版本,执行如下命令,在本命令中需要将并行MPI打开。
cmake -DCMAKE_BUILD_TYPE=Release -DVTK_USE_MPI:BOOL=ON -S /root/VTK-9.2.6 -B /root/VTK-9.2.6/build
make
make install
5.LIGGGHTS安装
cmake -DCMAKE_BUILD_TYPE=Release -S /root/LIGGGHTS-PUBLIC-master/src -B /root/LIGGGHTS-PUBLIC-master/src/build
make
make install
在Linux系统下安装库,安装好cmake后,最好使用源码安装,避免出现错误。