本文来源于https://github.com/SeisSol/PUMGen/wiki/How-to-compile-PUMGen
开始编译PUMGen之前,需要先按照https://blog.csdn.net/afgqwjgfjqwgfg/article/details/120308484中的步骤安装好HDF5;
HDF5
cd hdf5-1.8.21
CC=mpicc ./configure --enable-parallel --prefix=/path/to/hdf5
make -j $ncpu
make install
Where ncpu can be obtained by:
ncpu=$(lscpu | grep "^CPU(" | awk '{print $2}')
Simmetrix (optional)可选
The Sim Modeling Suite from Simmetrix is optional. To use it, you need a valid Simmetrix license for the Sim Modeling Suite library. If you have the license you should be able to download the library from http://simmetrix.com/index.php/support/support-downloads. See here for the installation process.
这个网站打开就是一个什么登录界面,太麻烦了,反正我没装。
PUMI
https://github.com/SCOREC/core
cd $HOME
git clone git@github.com:SCOREC/core.git
cd core
- 如果没有安装Simmetrix:
mkdir build && cd build
cmake .. \
-DCMAKE_C_COMPILER="`which mpicc`" \
-DCMAKE_CXX_COMPILER="`which mpiCC`" \
-DCMAKE_C_FLAGS="-O2 -g -Wall" \
-DCMAKE_CXX_FLAGS="-O2 -g -Wall" \
-DCMAKE_INSTALL_PREFIX=$path_to_pumi
make -j $ncpu
sudo make install
(depending of the mpi environement, you may need to used which mpicxx instead of which mpiCC)对应不同的MPI环境,需要选择使用which mpicxx 还是which mpiCC, 建议是如果不会报错就用原来的which mipCC,报错了再换 which mpicxx 试试。
- 如果安装了Simmetrix
mkdir build && cd build
cmake .. \
-DCMAKE_C_COMPILER="`which mpicc`" \
-DCMAKE_CXX_COMPILER="`which mpiCC`" \
-DCMAKE_C_FLAGS="-O2 -g -Wall" \
-DCMAKE_CXX_FLAGS="-O2 -g -Wall" \
-DCMAKE_INSTALL_PREFIX=$path_to_pumi \
-DENABLE_SIMMETRIX=ON \
-DSIM_MPI=$mpi_name \
-DSIMMETRIX_LIB_DIR=$path_to_SimModeler_lib \
-DSIMMODSUITE_INCLUDE_DIR=$path_to_SimModeler_include_dir
make -j $ncpu
make install
Where $mpi_name
is the mpi implementation (see the name of the preinstalled libSimPartitionedMesh-xxx.a, e.g. mpi, mpich3, openmpi3 or openmpi4. on supermucNG we use mpich3)
As an illustration, the different path could be:
export myLibs=(set your myLibs here)
export path_to_SimModeler=$myLibs/SimModelerLib/15.0-200822/
export mpi_name=mpich3
export path_to_pumi=$myLibs/core/
export path_to_SimModeler_lib=$path_to_SimModeler/lib/x64_rhel7_gcc48
export path_to_SimModeler_include_dir=$path_to_SimModeler/include
export path_to_hdf5=$HDF5_BASE
Where $myLibs
point to the folder where user libraries are installed.
netCDF (optional/deprecated)
标题都说不建议了,这一部分可以直接跳过。
NetCDF is required to convert old SeisSol meshes.
http://www.unidata.ucar.edu/downloads/netcdf/index.jsp (NetCDF-C Releases)
CPPFLAGS=-I/path/to/hdf5/include CC=mpicc LDFLAGS=-L/path/to/hdf5/lib LIBS=-ldl ./configure --disable-shared --prefix=/path/to/netcdf
make -j $ncpu
make install
Getting PUMGen
git clone https://github.com/SeisSol/PUMGen.git
cd PUMGen
git submodule update --init
Compiling PUMGen
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=$path_to_pumi -DSIMMETRIX=ON \
-DSIMMETRIX_ROOT=$path_to_SimModeler -DSIM_MPI=$mpi_name \
-DCMAKE_BUILD_TYPE=Release\
-DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc
make -j $ncpu
pumgen can be compiled with simmetrix using -DSIMMETRIX=OFF
.
The argument of -DCMAKE_C_COMPILER
and -DCMAKE_CXX_COMPILER
should match the compiler used for pumi.
如果没有安装Simmetrix的话,直接使用上面的
cmake .. -DCMAKE_PREFIX_PATH=$path_to_pumi -DSIMMETRIX=ON \
-DSIMMETRIX_ROOT=$path_to_SimModeler -DSIM_MPI=$mpi_name \
-DCMAKE_BUILD_TYPE=Release\
-DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc
会出错,需要将其改为:
cmake .. -DCMAKE_PREFIX_PATH=$path_to_pumi -DSIMMETRIX=OFF -DSIM_MPI=$mpi_name -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="`which mpicc`" -DCMAKE_CXX_COMPILER="`which mpiCC`"
make -j $ncpu
其中The argument of -DCMAKE_C_COMPILER
and -DCMAKE_CXX_COMPILER
should match the compiler used for pumi.
如果执行 make -j $ncpu
后出现 undefined reference to ompi_mpi_comm_world
之类的错误,最好回到安装OPENMPI
和mpich
那一步,重新编译,安装一遍,确保过程中没有问题,都正确安装了。
MPI环境: Ubuntu 20.04下安装和配置MPI - 知乎
OpenMPI : openmpi入门1-安装与测试 - 灰信网(软件开发博客聚合),
编译和安装最好分别进行:
make
make install #权限不够加 sudo
成功执行make -j $ncpu
之后:
安装:sudo make install
此时在命令行输入pumgen
,就会出现pumgen命令
的参数介绍了。
到这里应该就成功安装好PUMGen了。