#The GROMACS team recommends OpenMPI version 1.6 (or higher), MPICH version 1.4.1 (or higher), or your hardware vendor's MPI installation.
#说明gromacs支持intel cpu 的mpi加速,因此先确定是否安装 intel_Parallel_Studio_XE
tar -zxf gromacs-2018.3.tar.gz -C /opt/biosoft/
cd /opt/biosoft/gromacs-2018.3/
#Check that you have CMake version 3.4.3 or later
cmake --version
#cmake version 3.4.3
mkdir build
cd build/
source /opt/intel/compilers_and_libraries_2017.7.259/linux/bin/compilervars.sh intel64
export PATH=/opt/sysoft/gcc-4.9.3/bin/:$PATH
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/sysoft/gcc-4.9.3/lib64/:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/opt/sysoft/gcc-4.9.3/include/:$CPLUS_INCLUDE_PATH
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DREGRESSIONTEST_PATH=/home/train/data/software/Gromacs5.07/regressiontests-5.0.7/ -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs2018_3/
make
make check
#若出现如下:
#Failing SIMD math function ulp comparison between std::exp and expSingleAccuracy<MathOptimization::Unsafe>
#Requested ulp tolerance: 16
#Requested abs tolerance: 0
#Denormals can be 0: false
#Largest Ulp difference occurs for x=-86.983924865722656
#Ref values: 1.6724818069065022e-38
#SIMD values: 2.350988701644575e-38
#Ulp diff.: 4841987
#仅仅是用intel编译器算出来的值和gcc编译器算出来的值略有不同,不放心可以重新编译intel 编译器,再进行重新编译gromacs
make install
#mdrun_only_intel编译器重新编译
source /opt/intel/compilers_and_libraries_2017.7.259/linux/bin/compilervars.sh intel64
mkdir /opt/biosoft/gromacs_mdrunonly_2018_3
cd /opt/biosoft/gromacs-2018.3
mkdir build-normal
cd build-normal/
export PATH=/opt/sysoft/Python-2.7.11/bin/:$PATH
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs_mdrunonly_2018_3/
make
make install
cd ..
mkdir build-mdrun-only
cd build-mdrun-only/
cmake .. -DGMX_FFT_LIBRARY=mkl -DCMAKE_C_COMPILER=/opt/intel/bin/icc -DCMAKE_CXX_COMPILER=/opt/intel/bin/icc -DMKL_LIBRARIES=/opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/lib/ -DMKL_INCLUDE_DIR=/opt/intel/compilers_and_libraries_2017.7.259/linux/mkl/include/ -DGMX_GPU=ON -DGMX_MPI=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/ -DCUDA_HOST_COMPILER=/opt/intel/bin/icc -DGMX_SIMD=AVX_256 -DGMX_BUILD_MDRUN_ONLY=ON -DCMAKE_INSTALL_PREFIX=/opt/biosoft/gromacs_mdrunonly_2018_3/
make
make install
cd /home/train/data/software/Gromacs5.07/regressiontests-5.0.7
source /opt/biosoft/gromacs_mdrunonly_2018_3/bin/GMXRC
./gmxtest.pl all -np 2#若显示
#Index Reference This test Error Description
# 5 -2521.58 -2400.27 0.0246464 1aml.pdb with oplsaa using vsite=none and water=tip3p
# 6 -2521.58 -2400.27 0.0246464 1aml.pdb with oplsaa using vsite=none and water=tip4p
# 7 -2521.58 -2400.27 0.0246464 1aml.pdb with oplsaa using vsite=none and water=tip5p
# 8 -2265.25 -2126.91 0.0314959 1aml.pdb with oplsaa using vsite=h and water=tip3p
# 9 -2265.25 -2126.91 0.0314959 1aml.pdb with oplsaa using vsite=h and water=tip4p
# 10 -2265.25 -2126.91 0.0314959 1aml.pdb with oplsaa using vsite=h and water=tip5p
# There were 6/42 differences in final energy with the reference file
# pdb2gmx tests FAILED
#提示计算误差,不必担心是由于计算机本身的硬件决定
echo 'PATH=$PATH:/opt/biosoft/gromacs_mdrunonly_2018_3/bin/' >> ~/.bashrc
source ~/.bashrc