GetDP (a “General environment for the treatment of Discrete Problems”) 是用于求解多物理场微分方程数值解的科学软件环境,可以用于求解物理问题(电磁、热等),其包含多种数值方法,包括有限元法、积分法等。 它可以处理各种维度(1D、2D 或 3D)和时间状态(静态、瞬态或谐波)等问题。
本文是官方文档的翻译整理,实测在3a5000+7a2000+loongnix20环境下可用。
具体环境如下:
topeet@topeet-pc:~$ neofetch
##### topeet@topeet-pc
####### ----------------
##O#O## OS: Loongnix GNU/Linux 20 (DaoXiangHu) loongarch64
####### Kernel: 4.19.0-19-loongson-3
########### Uptime: 8 mins
############# Packages: 1943 (dpkg)
############### Shell: bash 5.0.3
################ Terminal: /dev/pts/0
################# CPU: Loongson-3A5000-H (4)
##################### GPU: Loongson Technology LLC Device 7a36
##################### Memory: 531MiB / 16153MiB
#################
需要安装的包有
libopenblas-dev
python3-dev
petsc
slepc
官方文档之前的准备,安装openblas
sudo apt install libopenblas libopenblas-dev python3-dev
第一步:编译gmsh最小运行库
git clone https://gitlab.onelab.info/gmsh/gmsh.git
cd gmsh
mkdir lib
cd lib
cmake -DDEFAULT=0 -DENABLE_PARSER=1 -DENABLE_POST=1 -DENABLE_ANN=1 -DENABLE_BLAS_LAPACK=1 -DENABLE_BUILD_LIB=1 -DENABLE_PRIVATE_API=1 ..
# Notes:
# * replace -DENABLE_BUILD_LIB=1 with -DENABLE_BUILD_SHARED=1 to build a shared library
# * if you don't have root access, add -DCMAKE_INSTALL_PREFIX=path-to-install
# * for a list of all available configuration options see http://getdp.info/doc/texinfo/getdp.html#Compiling-the-source-code
make lib
# Notes:
# * use `make shared` for the shared library
sudo make install/fast
# Notes:
# * remove "sudo" if you don't have root access
cd ../..
第二步:编译petsc
curl -L -O https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.0.tar.gz
tar zxvf petsc-3.16.0.tar.gz
cd petsc-3.16.0
export PETSC_DIR=$PWD
export PETSC_ARCH=real_mumps_seq
./configure --with-clanguage=cxx --with-debugging=0 --with-mpi=0 --with-mpiuni-fortran-binding=0 --download-mumps=yes --with-mumps-serial --with-shared-libraries=0 --with-x=0 --with-ssl=0 --with-scalar-type=real
# Notes:
# * if your compilers are not found, specify them explicitly: e.g. --FC=/path/to/f90 for the fortran compiler
# * if the BLAS/LAPACK libraries are not installed in standard locations, you will have to specify their location by hand with options --with-blas-lib=/path/to/libblas and --with-lapack-lib=/path/to/liblapack
# * as a last recourse (but this will severely degrade performance), you can use generic non-optimized BLAS/LAPACK libraries by using the option --download-fblaslapack=1
make
cd ..
第三步:编译slepc
curl -L -O https://slepc.upv.es/download/distrib/slepc-3.16.0.tar.gz
tar zxvf slepc-3.16.0.tar.gz
cd slepc-3.16.0
export SLEPC_DIR=$PWD
./configure
make
cd ..
第四步:编译共享内存(shared-memory) GetDP
git clone https://gitlab.onelab.info/getdp/getdp.git
cd getdp
mkdir bin
cd bin
cmake -DENABLE_BLAS_LAPACK=0 ..
# Notes:
# * -DENABLE_BLAS_LAPACK=0 forces GetDP to use the same BLAS/LAPACK libraries as the ones used by PETSc
# * use option -DCMAKE_PREFIX_PATH=non-standard-install-path;other-non-standard-install-path if you have libraries installed in non-standard locations
# * use options -DPETSC_DIR=... -DPETSC_ARCH=... if the corresponding environment variables are not set properly
make
cd ../..
参考链接:
https://gitlab.onelab.info/getdp/getdp/-/wikis/GetDP-compilation