2016年5月23日 星期一

安裝GROMACS-5.1.2在Ubuntu Gnome

在Ubuntu Gnome14.04 自行編譯GROMACS-5.1.2。雖然用apt-get也可以安裝,但自行編譯可以依照某些環境客製化。過程根據Installaion Guide分成下面四大步驟:
  1. 設定環境
    1. apt-get install cmake
    2. apt-get install libboost-dev
    3. apt-get install libxml2-dev
  2. 下載原始碼
    1. wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-5.1.2.tar.gz
  3. 編譯程式
    1. tar zxvf gromacs-5.1.2.tar.gz && cd gromacs-5.1.2
    2. mkdir build && cd build
    3. cmake .. -DGMX_BUILD_OWN_FFTW=ON -DCMAKE_INSTALL_PREFIX=/pkg/gromacs-5.1.2
    4. make -j 2 >& make.log &
    5. make check
  4. 安裝與執行
    1. make install
    2. source /pkg/gromacs-5.1.2/bin/GMXRC
    3. gmx -version
GROMACS-5.1.2的Release Notes,說明文件(PDFHTML)、FAQTurtorials


步驟1 設定環境

安裝的時候必須要有cmake 2.8.8以後的版本,還會要用到Boost
# apt-get install cmake
# cmake --version
cmake version 2.8.12.2


步驟2 下載原始碼

這邊下載,只需要Source code
# wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-5.1.2.tar.gz
# md5sum gromacs-5.1.2.tar.gz 
614d0be372f1a6f1f36382b7a6fcab98  gromacs-5.1.2.tar.gz

解壓縮並到build資料夾
# tar zxvf gromacs-5.1.2.tar.gz && cd gromacs-5.1.2
# mkdir build && cd build


步驟3 編譯程式

預設安裝是/usr/local/gromacs,在這邊想要安裝到/pkg/gromacs-5.1.2,使用內建的fftw,但不用到CUDA的GPU來計算。首先是編譯前讓cmake來產生編譯所需的Makefile
# cmake .. -DGMX_BUILD_OWN_FFTW=ON -DCMAKE_INSTALL_PREFIX=/pkg/gromacs-5.1.2
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc

-- Check for working C compiler: /usr/bin/cc -- works
...
...
CMake Warning at CMakeLists.txt:906 (message):
  mdrun supports native GPU acceleration on NVIDIA hardware with compute
  capability >= 2.0 (Fermi or later).  This requires the NVIDIA CUDA toolkit,
  which was not found.  Its location can be hinted by setting the
  CUDA_TOOLKIT_ROOT_DIR CMake option (does not work as an environment
  variable).  The typical location would be /usr/local/cuda[-version].  Note
  that CPU or GPU acceleration can be selected at runtime.

  1 NVIDIA GPU(s) found in the system:
  GPU 0: GeForce 9400M
  Compute capability information not available, consult the NVIDIA website:
  https://developer.nvidia.com/cuda-gpus

-- Configuring done
-- Generating done
-- Build files have been written to: /root/gromacs/gromacs-5.1.2/build
這個步驟約莫一分鐘

再來則是編譯程式,在此把編譯過程記錄檔存到make.log; -j 2代表用兩個核心來編譯
# make -j 2 >& make.log &
總過花了約七分半

編譯完成後驗證程式有沒有正確編出來
# make check
[  0%] Built target view_objlib
[  1%] Built target fftwBuild
[  2%] Built target mdrun_objlib
[100%] Built target libgromacs
[100%] Built target gmx
Scanning dependencies of target gmxtests
[100%] Built target gmxtests
Scanning dependencies of target tests
[100%] Built target tests
Scanning dependencies of target run-ctest
[100%] Running all tests
Test project /root/gromacs/gromacs-5.1.2/build
    Start 1: regressiontests/simple
1/6 Test #1: regressiontests/simple ...........   Passed    1.59 sec
    Start 2: regressiontests/complex
2/6 Test #2: regressiontests/complex ..........   Passed   28.82 sec
    Start 3: regressiontests/kernel
3/6 Test #3: regressiontests/kernel ...........   Passed   39.30 sec
    Start 4: regressiontests/freeenergy
4/6 Test #4: regressiontests/freeenergy .......   Passed   14.01 sec
    Start 5: regressiontests/pdb2gmx
5/6 Test #5: regressiontests/pdb2gmx ..........   Passed   16.66 sec
    Start 6: regressiontests/rotation
6/6 Test #6: regressiontests/rotation .........   Passed    2.72 sec
100% tests passed, 0 tests failed out of 6

Total Test time (real) = 103.10 sec
[100%] Built target run-ctest
Scanning dependencies of target unittests-notice
[100%] Unit tests disabled
NOTE: Unit tests have not been run. You need to set GMX_BUILD_UNITTESTS=ON if you want to build and run them.
[100%] Built target unittests-notice
Scanning dependencies of target check
[100%] Built target check
總共花了快兩分鐘在測試上面。Unit tesing是給開發者用來快速測試某些某些模組使用,一般使用者不會需要用到。

步驟4 安裝與執行

# make install
[  1%] Built target fftwBuild
[ 98%] Built target libgromacs
[ 98%] Built target template
[100%] Built target mdrun_objlib
[100%] Built target view_objlib
[100%] Built target gmx
Install the project...
-- Install configuration: "Release"
-- Installing: /pkg/gromacs-5.1.2/share/gromacs/COPYING
...
-- Set runtime path of "/pkg/gromacs-5.1.2/lib/x86_64-linux-gnu/libgromacs.so.1.2.0" to "$ORIGIN/../lib/x86_64-linux-gnu"
...
-- Installing: /pkg/gromacs-5.1.2/bin/gmx
-- Set runtime path of "/pkg/gromacs-5.1.2/bin/gmx" to "$ORIGIN/../lib/x86_64-linux-gnu"
-- Installing: /pkg/gromacs-5.1.2/bin
-- Installing: /pkg/gromacs-5.1.2/bin/gmx-completion.bash
-- Installing: /pkg/gromacs-5.1.2/bin/gmx-completion-gmx.bash
可以看到都安裝到/pkg/gromacs-5.1.2下面,而不是預設的/usr/local/gromacs、整個安裝完的空間是29M

安裝完成要跑程式之前要先設定環境變數
$ source /pkg/gromacs-5.1.2/bin/GMXRC

用GROMACS的控制程式gmx看安裝的細節
$ gmx -version
                      :-) GROMACS - gmx, VERSION 5.1.2 (-:

                            GROMACS is written by:
     Emile Apol      Rossen Apostolov  Herman J.C. Berendsen    Par Bjelkmar   
 Aldert van Buuren   Rudi van Drunen     Anton Feenstra   Sebastian Fritsch 
  Gerrit Groenhof   Christoph Junghans   Anca Hamuraru    Vincent Hindriksen
 Dimitrios Karkoulis    Peter Kasson        Jiri Kraus      Carsten Kutzner  
    Per Larsson      Justin A. Lemkul   Magnus Lundborg   Pieter Meulenhoff 
   Erik Marklund      Teemu Murtola       Szilard Pall       Sander Pronk   
   Roland Schulz     Alexey Shvetsov     Michael Shirts     Alfons Sijbers  
   Peter Tieleman    Teemu Virolainen  Christian Wennberg    Maarten Wolf   
                           and the project leaders:
        Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2015, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out http://www.gromacs.org for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS:      gmx, VERSION 5.1.2
Executable:   /pkg/gromacs-5.1.2/bin/gmx
Data prefix:  /pkg/gromacs-5.1.2
Command line:
  gmx -version

GROMACS version:    VERSION 5.1.2
Precision:          single
Memory model:       64 bit
MPI library:        thread_mpi
OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = 32)
GPU support:        disabled
OpenCL support:     disabled
invsqrt routine:    gmx_software_invsqrt(x)
SIMD instructions:  SSE4.1
FFT library:        fftw-3.3.4-sse2
RDTSCP usage:       disabled
C++11 compilation:  enabled
TNG support:        enabled
Tracing support:    disabled
Built on:           一  5月 23 13:28:05 CST 2016
Built by:           xxx@ooo [CMAKE]
Build OS/arch:      Linux 3.16.0-55-generic x86_64
Build CPU vendor:   GenuineIntel
Build CPU brand:    Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz
Build CPU family:   6   Model: 23   Stepping: 10
Build CPU features: apic clfsh cmov cx8 cx16 lahf_lm mmx msr pdcm pse sse2 sse3 sse4.1 ssse3
C compiler:         /usr/bin/cc GNU 4.8.4
C compiler flags:    -msse4.1    -Wundef -Wextra -Wno-missing-field-initializers -Wno-sign-compare -Wpointer-arith -Wall -Wno-unused -Wunused-value -Wunused-parameter  -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  -Wno-array-bounds 
C++ compiler:       /usr/bin/c++ GNU 4.8.4
C++ compiler flags:  -msse4.1   -std=c++0x  -Wundef -Wextra -Wno-missing-field-initializers -Wpointer-arith -Wall -Wno-unused-function  -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  -Wno-array-bounds 
Boost version:      1.55.0 (internal)
可以看到安裝的是5.1.2 single precision版本

2016-May-24 更新關於測試的部分

上面再沒有安裝libxml2-dev之前,測試只有六項;安裝完libxml2-dev再重新編譯後,測試有下列20項。
# make check
[  0%] Built target mdrun_objlib
[  0%] Built target gmock
[  0%] Built target fftwBuild
[ 87%] Built target libgromacs
[ 88%] Built target testutils
[ 89%] Built target mdrun-test
[ 89%] Built target testutils-test
[ 89%] Built target gmxlib-test
[ 90%] Built target mdlib-test
[ 90%] Built target onlinehelp-test-shared
[ 91%] Built target commandline-test
[ 92%] Built target fft-test
[ 92%] Built target math-test
[ 93%] Built target random-test
[ 94%] Built target onlinehelp-test
[ 94%] Built target options-test
[ 94%] Built target utility-test
[ 95%] Built target fileio-test
[ 97%] Built target simd-test
[ 98%] Built target legacy-tools-test
[ 98%] Built target gmxpreprocess-test
[ 98%] Built target correlations-test
[ 98%] Built target analysisdata-test-shared
[ 98%] Built target analysisdata-test
[ 98%] Built target selection-test
[100%] Built target trajectoryanalysis-test
[100%] Built target mdrun-mpi-test
[100%] Built target tests
[100%] Running all tests
Test project /root/gromacs/gromacs-5.1.2/build
      Start  1: TestUtilsUnitTests
 1/20 Test  #1: TestUtilsUnitTests ...............   Passed    0.01 sec
      Start  2: GmxlibTests
 2/20 Test  #2: GmxlibTests ......................   Passed    0.01 sec
      Start  3: MdlibUnitTest
 3/20 Test  #3: MdlibUnitTest ....................   Passed    0.01 sec
      Start  4: CommandLineUnitTests
 4/20 Test  #4: CommandLineUnitTests .............   Passed    0.02 sec
      Start  5: FFTUnitTests
 5/20 Test  #5: FFTUnitTests .....................   Passed    0.08 sec
      Start  6: MathUnitTests
 6/20 Test  #6: MathUnitTests ....................   Passed    0.01 sec
      Start  7: RandomUnitTests
 7/20 Test  #7: RandomUnitTests ..................   Passed    0.01 sec
      Start  8: OnlineHelpUnitTests
 8/20 Test  #8: OnlineHelpUnitTests ..............   Passed    0.02 sec
      Start  9: OptionsUnitTests
 9/20 Test  #9: OptionsUnitTests .................   Passed    0.01 sec
      Start 10: UtilityUnitTests
10/20 Test #10: UtilityUnitTests .................   Passed    0.02 sec
      Start 11: FileIOTests
11/20 Test #11: FileIOTests ......................   Passed    0.01 sec
      Start 12: SimdUnitTests
12/20 Test #12: SimdUnitTests ....................   Passed    0.06 sec
      Start 13: LegacyToolsTests
13/20 Test #13: LegacyToolsTests .................   Passed    0.03 sec
      Start 14: GmxPreprocessTests
14/20 Test #14: GmxPreprocessTests ...............   Passed    0.11 sec
      Start 15: CorrelationsTest
15/20 Test #15: CorrelationsTest .................   Passed    0.26 sec
      Start 16: AnalysisDataUnitTests
16/20 Test #16: AnalysisDataUnitTests ............   Passed    0.05 sec
      Start 17: SelectionUnitTests
17/20 Test #17: SelectionUnitTests ...............   Passed    0.16 sec
      Start 18: TrajectoryAnalysisUnitTests
18/20 Test #18: TrajectoryAnalysisUnitTests ......   Passed    0.42 sec
      Start 19: MdrunTests
19/20 Test #19: MdrunTests .......................   Passed    2.82 sec
      Start 20: MdrunMpiTests
20/20 Test #20: MdrunMpiTests ....................   Passed    0.18 sec

100% tests passed, 0 tests failed out of 20

Label Time Summary:
GTest                 =   1.24 sec
IntegrationTest       =   2.85 sec
MpiIntegrationTest    =   0.18 sec
UnitTest              =   1.24 sec

Total Test time (real) =   4.30 sec
[100%] Built target run-ctest
[100%] Regression tests not available
NOTE: Regression tests have not been run. If you want to run them from the build system, get the correct version of the regression tests package and set REGRESSIONTEST_PATH in CMake to point to it, or set REGRESSIONTEST_DOWNLOAD=ON.
[100%] Built target regressiontests-notice

[100%] Built target check

_EOF_

沒有留言:

張貼留言