- Debian 7.7預設的gcc是4.7.2,但是GROMACS必須要4.8.1以上,而且必須要支援c++11 implementation,在這邊用的是自行編譯的gcc 6.4.0
- Debian 7.7預設的cmake是2.8.9,但GROMACS必須要3.4.3以上,在這邊用的是cmake 3.10.2
步驟一:設定環境變數
$ export PATH=/pkg1/local/gcc-6.4.0/bin:$PATH
$ export LD_LIBRARY_PATH=/pkg1/local/gcc-6.4.0/lib:/pkg1/local/lib
$ export LDFLAGS="-static-libgcc -static-libstdc++"
$ which gcc g++
/pkg/local/gcc-6.4.0/bin/gcc
/pkg/local/gcc-6.4.0/bin/g++
步驟二:解開原始碼並且創造好要編譯的空間
$ wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-2018.tar.gz
$ md5sum gromacs-2018.tar.gz
6467ffb1575b8271548a13abfba6374c gromacs-2018.tar.gz
$ tar zxf gromacs-2018.tar.gz && cd cd gromacs-2018
$ mkdir build && cd build
步驟三:將gmx程式編譯成fully static executable
$ /pkg1/chem/GROMACS/cmake-3.10.2-Linux-x86_64/bin/cmake .. \
-DCMAKE_INSTALL_PREFIX=/pkg1/chem/GROMACS/2018-double-gcc640 \
-DCMAKE_C_COMPILER=/pkg1/local/gcc-6.4.0/bin/gcc \
-DCMAKE_CXX_COMPILER=/pkg1/local/gcc-6.4.0/bin/g++ \
-DGMX_BUILD_OWN_FFTW=ON \
-DGMX_GPU=OFF \
-DGMX_SIMD=SSE4.1 \
-DGMX_DOUBLE=ON \
-DGMX_DEFAULT_SUFFIX=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DGMX_PREFER_STATIC_LIBS=ON \
-DGMX_BUILD_SHARED_EXE=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DREGRESSIONTEST_DOWNLOAD=OFF
$ make -j 20
$ ldd bin/gmx
not a dynamic executable
$ make install
$ source /pkg1/chem/GROMACS/2018-double-gcc640/bin/GMXRC
$ du -h `which gmx`
33M /pkg1/chem/GROMACS/2018-double-gcc640/bin/gmx
這邊放置GROMACS的位置是/pkg1/chem/GROMACS/2018-double-gcc640編譯完成的執行檔gmx大小是33M,而且是fully static executable
步驟四:測試安裝的程式碼是否正確
$ wget http://gerrit.gromacs.org/download/regressiontests-2018.tar.gz
$ md5sum regressiontests-2018.tar.gz
5a609bea6b6777072063be9e665121ef regressiontests-2018.tar.gz
$ tar zxf regressiontests-2018.tar.gz && cd regressiontests-2018
$ source /pkg1/chem/GROMACS/2018-double-gcc640/bin/GMXRC
$ ./gmxtest.pl -nosuffix -double all >& gmxtest.log &
$ cat gmxtest.log | grep PASS | grep -v ^PASSED
All 16 simple tests PASSED
All 51 complex tests PASSED
All 142 kernel tests PASSED
All 10 freeenergy tests PASSED
All 12 rotation tests PASSED
All 0 extra tests PASSED
All 48 pdb2gmx tests PASSED
All 7 essential dynamics tests PASSED
$ cat gmxtest.log | grep -i FAIL -c
0
_EOF_
沒有留言:
張貼留言