Pages

20 January 2012

55. Building/compiling OpenMM4.0 from source on debian testing

Pre-requisites:
sudo apt-get install swig doxygen openjdk-7-jdk

Also, patience...the build can be temperamental. However, go through the steps enough times and it will work. Why, I don't know.

Also:
1. download (see error 4 below) py-dom-xpath-0.1 from here:
https://code.google.com/p/py-dom-xpath/downloads/list

sudo apt-get install python-setuptools
wget https://py-dom-xpath.googlecode.com/files/py-dom-xpath-0.1.tar.gz


2. Unzip it
3. Change to the directory py-dom-xpath-0.1/ and run
sudo python setup.py install

And
add this to your ~/.bashrc or /etc/profile

export LD_LIBRARY_PATH=/lib/openmm:/usr/lib/nvidia-cuda-toolkit:/usr/lib/nvidia:$LD_LIBRARY_PATH
export OPENMM_PLUGIN_DIR=/usr/local/openmm/lib/plugins
export OPENMM_ROOT_DIR=/usr/local/openmm
Finally (and this is truly ridiculous):

mkdir ~/tmp/OpenMM4.0-Source/docs/UsersGuide
cp OpenMM4.0-Source/docs/OpenMMUsersGuide.pdf OpenMM4.0-Source/docs/UsersGuide/


Start here:

As usual we'll do our work in ~/tmp
so
mkdir ~/tmp 
if that directory doesn't exist

To download the OpenMM4.0-Source.zip file you need to register at simtk.org

Put the file in ~/tmp

Run:
cd ~/tmp
unzip OpenMM4.0-Source.zip
cd OpenMM4.0-Source/
cmake CMakeList.txt
make OpenMM
sudo make install

If all goes well (it took me three hours to iron out the details...) you'll see
[..]
-- Installing: /usr/local/openmm/include/openmm/internal/AmoebaUreyBradleyForceImpl.h
-- Installing: /usr/local/openmm/include/openmm/internal/AmoebaTorsionTorsionForceImpl.h
-- Installing: /usr/local/openmm/include/openmm/internal/AmoebaStretchBendForceImpl.h
-- Installing: /usr/local/openmm/lib/libOpenMMAmoeba.so
-- Removed runtime path from "/usr/local/openmm/lib/libOpenMMAmoeba.so"
-- Installing: /usr/local/openmm/lib/plugins/libOpenMMAmoebaCuda.so
-- Removed runtime path from "/usr/local/openmm/lib/plugins/libOpenMMAmoebaCuda.so"
-- Installing: /usr/local/openmm/lib/plugins/libOpenMMAmoebaSerialization.so
-- Removed runtime path from "/usr/local/openmm/lib/plugins/libOpenMMAmoebaSerialization.so"
-- Installing: /usr/local/openmm/include/openmm/RPMDIntegrator.h
-- Installing: /usr/local/openmm/include/openmm/RpmdKernels.h
-- Installing: /usr/local/openmm/lib/libOpenMMRPMD.so
-- Removed runtime path from "/usr/local/openmm/lib/libOpenMMRPMD.so"
-- Installing: /usr/local/openmm/lib/plugins/libOpenMMRPMDOpenCL.so
-- Removed runtime path from "/usr/local/openmm/lib/plugins/libOpenMMRPMDOpenCL.so"
-- Installing: /usr/local/openmm/include/openmm/serialization/SerializationNode.h
-- Installing: /usr/local/openmm/include/openmm/serialization/SerializationProxy.h
-- Installing: /usr/local/openmm/include/openmm/serialization/XmlSerializer.h
-- Installing: /usr/local/openmm/lib/libOpenMMSerialization.so
-- Removed runtime path from "/usr/local/openmm/lib/libOpenMMSerialization.so"


And you're are done! SUCCESS!



Errors and solutions:
I hate cmake, possibly because I don't really understand it.
Anyway, every time you hit one of the errors below you need to do the following after fixing it:
make clean
cmake CMakeList.txt
make OpenMM
or you'll get error # 6

1. Doxygen missing:

Symptom:
Swig version must be 1.3.39 or greater! (You have 0.0.0)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindDoxygen.cmake:80 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  wrappers/python/CMakeLists.txt:82 (find_package)
Solution:
sudo apt-get install doxygen

2. Swig missing:
Symptom:
Swig version must be 1.3.39 or greater! (You have 0.0.0)
-- Java version 1.6.0.24 configured successfully!
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Java (missing: Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE)
  (found version "1.6.0.24")
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindJava.cmake:174 (find_package_handle_standard_args)
  wrappers/python/CMakeLists.txt:85 (find_package)
Solution:
sudo apt-get install swig

3. Java found and missing at the same time
Symptom:
-- Java version 1.6.0.24 configured successfully!
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Java (missing: Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE)
  (found version "1.6.0.24")
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindJava.cmake:174 (find_package_handle_standard_args)
  wrappers/python/CMakeLists.txt:85 (find_package)
Solution:
sudo apt-get install openjdk-7-jdk

4. No module named xpath
Symptom:
Execution time: 1072 milliseconds
Memory used: 21270968
NamePool contents: 89 entries in 86 chains. 6 prefixes, 6 URIs
[ 87%] Creating OpenMM Python swig input files...
Traceback (most recent call last):
  File "/home/me/tmp/OpenMM4.0-Source/python/src/swig_doxygen/swigInputBuilder.py", line 15, in <module>
    import xpath
ImportError: No module named xpath
make[2]: *** [python/src/swig_doxygen/swig_lib/python/pythonprepend.i] Error 1
make[1]: *** [wrappers/python/CMakeFiles/BuildModule.dir/all] Error 2
make: *** [all] Error 2
Solution:
Download py-dom-xpath-0.1.tar.gz:

wget https://py-dom-xpath.googlecode.com/files/py-dom-xpath-0.1.tar.gz

Untar (tar -xvf) in ~/tmp
cd py-dom-xpath-0.1/
sudo python setup.py install

What didn't work:
sudo apt-get install libxml-xpath-perl
sudo apt-get install libghc-hxt-xpath-dev

5. Missing OpenMMUsersGuide.pdf
Symptom:
-- Installing: /usr/local/openmm/docs/API Reference.html
CMake Error at cmake_install.cmake:119 (FILE):
  file INSTALL cannot find
  "/home/me/tmp/OpenMM4.0-Source/docs/UsersGuide/OpenMMUsersGuide.pdf".

make: *** [install] Error 1

Solution:
WTF??? The build can fail over something so trivial???
Anyway,
mkdir ~/tmp/OpenMM4.0-Source/docs/UsersGuide
cp ~/tmp/OpenMM4.0-Source/docs/OpenMMUsersGuide.pdf ~/tmp/OpenMM4.0-Source/docs/UsersGuide/

6. Linking CXX shared library libOpenMM.so failure
Symptom:
[  6%] Building CXX object CMakeFiles/OpenMM.dir/src/cuda/kCalculateLocalForces.cu_OpenMMCuda_generated.cpp.o
Linking CXX shared library libOpenMM.so
CMakeFiles/OpenMM.dir/src/cuda/kCalculateCDLJForces.cu_OpenMMCuda_generated.cpp.o: In function `__device_stub__Z29kFindBlockBoundsCutoff_kernelv()':
kCalculateCDLJForces.cu_OpenMMCuda_generated.cpp:(.text+0x200): multiple definition of `__device_stub__Z29kFindBlockBoundsCutoff_kernelv()'
CMakeFiles/OpenMM.dir/src/cuda/kCalculateNonbondedSoftcore.cu_OpenMMFreeEnergyCuda_generated.cpp.o:kCalculateNonbondedSoftcore.cu_OpenMMFreeEnergyCuda_generated.cpp:(.text+0x1b0): first defined here
[..]
CMakeFiles/OpenMM.dir/src/cuda/kCalculateAmoebaCudaUtilities.cu_OpenMMAmoebaCuda_generated.cpp.o: In function `kFindInteractionsWithinBlocksPeriodic_kernel(unsigned int*)':
kCalculateAmoebaCudaUtilities.cu_OpenMMAmoebaCuda_generated.cpp:(.text+0x1d0): multiple definition of `kFindInteractionsWithinBlocksPeriodic_kernel(unsigned int*)'
CMakeFiles/OpenMM.dir/src/cuda/kCalculateNonbondedSoftcore.cu_OpenMMFreeEnergyCuda_generated.cpp.o:kCalculateNonbondedSoftcore.cu_OpenMMFreeEnergyCuda_generated.cpp:(.text+0x3a0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [libOpenMM.so] Error 1
make[1]: *** [CMakeFiles/OpenMM.dir/all] Error 2
make: *** [all] Error 2

Solution:
You had one of errors 1-5, you solved it and tried to run make again. You need to do

make clean
cmake CMakeList.txt

first before proceeding with make or you end up with this error.


7 comments:

  1. I can't agree more with you. This is one of the most frustrating compile I've ever done. The OpenMM people should clean up the install process. There's not even a list of required software really, or at least I could not find it.

    Thank you for your hard work. I got frustrated at could not find the plugin part and almost give up.

    ReplyDelete
  2. cool thanks for the tip on using py-dom-xpath-0.1

    ... actually this app's install is much easier than many,
    if U really want a challenge try to compile from sources vlc

    take care - Scott Stensland

    ReplyDelete
  3. I can't install the xpath module in my Ubuntu 10.0.4 64bits. I'd tried this option first (sudo python setup.py install) and the error was:
    /usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
    warnings.warn(msg)
    running install
    running build
    running build_py
    Traceback (most recent call last):
    File "setup.py", line 71, in
    test_suite='tests',
    File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
    File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
    File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
    File "/usr/lib/python2.6/distutils/command/install.py", line 615, in run
    self.run_command('build')
    File "/usr/lib/python2.6/distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
    File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
    File "/usr/lib/python2.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
    File "/usr/lib/python2.6/distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
    File "/usr/lib/python2.6/distutils/dist.py", line 994, in run_command
    cmd_obj.ensure_finalized()
    File "/usr/lib/python2.6/distutils/cmd.py", line 117, in ensure_finalized
    self.finalize_options()
    File "/home/samuel/Desktop/py-dom-xpath-0.1/setuptools-0.6c9-py2.6.egg/setuptools/command/build_py.py", line 18, in finalize_options
    AttributeError: Distribution instance has no attribute 'exclude_package_data'
    Secondly, I tried sudo apt-get install libghc-hxt-xpath-dev but there were many dependecies problems and the package was installed broken. Since these two both options weren't successfull are there another alternative way to install xpath?
    Thanks for this post,
    Samuel Pita

    ReplyDelete
    Replies
    1. Off-hand I can't really tell.
      I did a bit of googling on "AttributeError: Distribution instance has no attribute 'exclude_package_data'". This (http://svn.python.org/projects/sandbox/trunk/setuptools/setuptools.txt) shows that exclude_package_data was added at some stage. The version of setuptools in debian testing is 0.6.24-1 -- and it seems that 0.6c9 is ancient (https://launchpad.net/ubuntu/+source/python-setuptools/+changelog)
      You might just want to sudo apt-get autoremove python-setuptools, then install manually from here: http://pypi.python.org/pypi/setuptools

      If you can't get it to work, since it's python you might want to read through setup.py to see where it puts the files and do it manually. I might have time to have a look at it in the coming week.

      As for alternatives, you might have to hit the ubuntu forums.

      Delete
  4. Hello,
    I tried to install OpenMM 4.1 on Ubuntu 11.10
    the make OpenMM works well but when issuing
    make install
    it keeps stopping with the error message:
    .....

    Linking CXX executable ../../../TestReferenceVirtualSites
    [ 20%] Built target TestReferenceVirtualSites
    [ 20%] Building (Device) NVCC Dependency File: /home/aneamtu/tmp/OpenMM4.1-Source/src/cuda/kCalculateCustomBondForces.cu_OpenMMCuda_generated.cpp.NVCC-depend
    [ 20%] Building (Device) NVCC Dependency File: /home/aneamtu/tmp/OpenMM4.1-Source/src/cuda/kCalculateCustomNonbondedForces.cu_OpenMMCuda_generated.cpp.NVCC-depend
    [ 20%] Converting NVCC dependency to CMake (/home/aneamtu/tmp/OpenMM4.1-Source/src/cuda/kCalculateCustomNonbondedForces.cu_OpenMMCuda_generated.cpp.depend)
    [ 20%] Building (Device) NVCC -cubin File: /home/aneamtu/tmp/OpenMM4.1-Source/src/cuda/kCalculateCustomNonbondedForces.cu_OpenMMCuda_generated.cpp.NVCC-cubin.txt
    nvcc fatal : Option '-cubin' is not allowed when compiling for multiple GPU code instances
    make[2]: *** [src/cuda/kCalculateCustomNonbondedForces.cu_OpenMMCuda_generated.cpp.NVCC-cubin.txt] Error 255
    make[1]: *** [platforms/cuda/sharedTarget/CMakeFiles/OpenMMCuda.dir/all] Error 2
    make: *** [all] Error 2
    .....
    any comment appreciated

    Tahnks,
    Andrei

    ReplyDelete
    Replies
    1. Andrei,
      I'll try sorting out the compilation and will post if I succeed (give it a week or so)
      Off the top of my head: "Option '-cubin' is not allowed when compiling for multiple GPU code instances". You might want to try cmake -i CMakeLists.txt to make it a bit more interactive and see what your options are.

      Delete
    2. Andrei, try this: http://verahill.blogspot.com.au/2012/06/compiling-openmm-41-on-debian-testing.html

      I also got it to work without ncurses ccmake, but this method was easier. If you really need to just use cmake, a hint towards the right solution is using -DCUDA_BUILD_CUBIN="OFF"

      Delete