Env:centos7.9
依赖包:
cmake-3.23.2
fftw-3.3.10
openmpi-4.1.0
gromacs-2018.4
安装cmake 3.x:
https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2.tar.gz
[root@ceshi install]# tar xf cmake-3.23.2.tar.gz #解压
[root@ceshi install]# ls
cmake-3.23.2 cmake-3.23.2.tar.gz fftw-3.3.10.tar.gz gromacs-2018.4.tar.gz openmpi-4.1.0.tar.gz
[root@ceshi install]# cd cmake-3.23.2/ #进入解压后目录
[root@ceshi cmake-3.23.2]# ls
Auxiliary CMakeGraphVizOptions.cmake CompileFlags.cmake CTestConfig.cmake Help README.rst Utilities
bootstrap CMakeLists.txt configure CTestCustom.cmake.in Licenses Source
CMakeCPack.cmake CMakeLogo.gif CONTRIBUTING.rst DartConfig.cmake Modules Templates
CMakeCPackOptions.cmake.in cmake_uninstall.cmake.in Copyright.txt doxygen.config Packaging Tests
[root@ceshi cmake-3.23.2]# ./bootstrap --prefix=/ceshi/app/cmake-3.23.2 -- -DCMAKE_USE_OPENSSL=OFF #构建
[root@ceshi install]# make
[root@ceshi cmake-3.23.2]# make install #安装
[root@ceshi cmake-3.23.2]# ln -s /ceshi/app/cmake-3.23.2/bin/cmake /usr/bin/ #软链接
[root@ceshi cmake-3.23.2]# ls /usr/bin/cmake
/usr/bin/cmake
[root@ceshi cmake-3.23.2]# cmake --version #查看版本
cmake version 3.23.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
安装FFTW:
http://fftw.org/fftw-3.3.10.tar.gz
[root@ceshi install]# tar xf fftw-3.3.10.tar.gz #解压
[root@ceshi install]# ls
cmake-3.23.2 cmake-3.23.2.tar.gz fftw-3.3.10 fftw-3.3.10.tar.gz gromacs-2018.4.tar.gz openmpi-4.1.0.tar.gz
[root@ceshi install]# cd fftw-3.3.10/ #进入解压后目录
[root@ceshi fftw-3.3.10]# ls
aclocal.m4 cmake.config.h.in config.sub COPYRIGHT FFTW3ConfigVersion.cmake.in kernel Makefile.in README tests
api CMakeLists.txt configure depcomp fftw.pc.in libbench2 missing README-perfcnt.md threads
AUTHORS compile configure.ac dft genfft ltmain.sh mpi reodft TODO
bootstrap.sh config.guess CONVENTIONS doc INSTALL m4 NEWS simd-support tools
ChangeLog config.h.in COPYING FFTW3Config.cmake.in install-sh Makefile.am rdft support
[root@ceshi fftw-3.3.10]# ./configure --prefix=/ceshi/app/fftw-3.3.10 --enable-sse2 --enable-avx --enable-float --enable-shared #构建
[root@ceshi fftw-3.3.10]# make #编译
[root@ceshi fftw-3.3.10]# make install #安装
export CMAKE_PREFIX_PATH=/ceshi/app/fftw-3.3.10 #设置fftw变量
安装openmpi:
https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz
[root@ceshi install]# tar xf openmpi-4.1.0.tar.gz #解压
[root@ceshi install]# ls
cmake-3.23.2 cmake-3.23.2.tar.gz fftw-3.3.10 fftw-3.3.10.tar.gz gromacs-2018.4.tar.gz openmpi-4.1.0 openmpi-4.1.0.tar.gz
[root@ceshi install]# cd openmpi-4.1.0/ #进入解压后目录
[root@ceshi openmpi-4.1.0]# ls
aclocal.m4 autogen.pl configure contrib examples LICENSE Makefile.in NEWS opal oshmem README.JAVA.txt VERSION
AUTHORS config configure.ac Doxyfile INSTALL Makefile.am Makefile.ompi-rules ompi orte README test
[root@ceshi openmpi-4.1.0]# ./configure --prefix=/ceshi/app/openmpi-4.1.0 #构建
[root@ceshi openmpi-4.1.0]# make #编译
[root@ceshi openmpi-4.1.0]# make install #安装
设置环境变量:
export PATH=$PATH:/ceshi/app/openmpi-4.1.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/ceshi/app/openmpi-4.1.0/lib
安装gromcas:
http://ftp.gromacs.org/pub/gromacs/gromacs-2018.4.tar.gz
[root@ceshi install]# tar xf gromacs-2018.4.tar.gz #解压
[root@ceshi install]# ls
cmake-3.23.2 cmake-3.23.2.tar.gz fftw-3.3.10 fftw-3.3.10.tar.gz gromacs-2018.4 gromacs-2018.4.tar.gz openmpi-4.1.0 openmpi-4.1.0.tar.gz
[root@ceshi install]# cd gromacs-2018.4/ #进入解压后目录
[root@ceshi gromacs-2018.4]# ls
admin AUTHORS cmake CMakeLists.txt COPYING CPackInit.cmake CTestConfig.cmake docs INSTALL README scripts share src tests
[root@ceshi gromacs-2018.4]# mkdir build #创建构建目录
[root@ceshi gromacs-2018.4]# cd build/
注:
说明编译时没有利用CPU的SIMD指令集(正常情况理应自动检测并利用),这样编译出来的mdrun的运行速度往往比理想情况慢N倍。此时需要重新编译,在使用cmake3的时候明确指定要用的指令集,比如如果你的CPU支持AVX2指令集(XEON v3系列及之后都支持)就加上-DGMX_SIMD=AVX2_256
我用的是虚拟机测试的,需要改为-DGMX_SIMD=AVX2_128
[root@ceshi build]# cmake .. -DCMAKE_INSTALL_PREFIX=/ceshi/app/gromacs-2018.4 -DGMX_BUILD_OWN_FFTW=ON -DGMX_SIMD=AVX2_128 -DGMX_MPI=ON #构建
[root@ceshi build]# cmake .. -DCMAKE_INSTALL_PREFIX=/ceshi/app/gromacs-2018.4 -DGMX_BUILD_OWN_FFTW=ON -DGMX_SIMD=AVX2_128 -DGMX_MPI=ON -Wno-dev #构建
[root@ceshi build]# make install #安装
[root@ceshi build]# source /ceshi/app/gromacs-2018.4/bin/GMXRC #source环境
验证:
[root@ceshi build]# gmx_mpi --version