OpenMM on colab

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
lewis martin
Posts: 63
Joined: Tue Mar 06, 2018 8:56 pm

OpenMM on colab

Post by lewis martin » Tue May 12, 2020 8:11 pm

Hi all,
Sorry, not an OpenMM question directly. Has anyone had consistent success running OpenMM in a colab instance? I've maxed out all my GPUs but of course still want to work on other scripts!

The most recent success I've seen is at: https://github.com/molmod/openmm-tutori ... e_colab.md

Presently that doesn't work - leads to a 'runtime has crashed' - it looks like because the packages get installed in python3.7 but colab (and the instructions given there) wants to work in 3.6. Changing `python=3.6` to 3.7 doesn't work - I think the system python is 3.6 and that can't be changed.

So I tried using a miniconda specific to 3.6, but installing openmm wants python3.7. Is there a way to install openmm using conda that doesn't require 3.7? Thanks!

User avatar
lewis martin
Posts: 63
Joined: Tue Mar 06, 2018 8:56 pm

Re: OpenMM on colab

Post by lewis martin » Tue May 12, 2020 10:40 pm

Managed to get around the python version issue by specifying the a python3.6 build explicitly:

Code: Select all

!time conda install -y -q -c conda-forge -c omnia/label/cuda101 -c omnia openmm=7.4.1=py36_cuda101_rc_1
This appears to install correctly, and the simtk package is present in the right directory. However after this it just fails to recognise that openmm is installed:

Code: Select all

import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
import simtk.testInstallation
simtk.testInstallation.main()
output:

Code: Select all

---------------------------------------------------------------------------

ModuleNotFoundError                       Traceback (most recent call last)

<ipython-input-28-ad74050948f0> in <module>()
      1 import sys
      2 sys.path.append('/usr/local/lib/python3.6/site-packages/')
----> 3 import simtk.testInstallation
      4 simtk.testInstallation.main()

ModuleNotFoundError: No module named 'simtk'
I'll keep trying for now.

User avatar
lewis martin
Posts: 63
Joined: Tue Mar 06, 2018 8:56 pm

Re: OpenMM on colab

Post by lewis martin » Tue May 12, 2020 10:55 pm

OK, solution that should persist if they change CUDA/python version.
You have to reset the runtime after installing to recognise installed packages.

Full sequence is:

Code: Select all

!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh && bash Miniconda3-4.5.4-Linux-x86_64.sh -bfp /usr/local
!time conda install -y -q -c conda-forge -c omnia/label/cuda101 -c omnia openmm=7.4.1=py36_cuda101_rc_1
Reset the runtime

Code: Select all

import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
import simtk.testInstallation
simtk.testInstallation.main()
One day colab will use a different version of CUDA and python. Check in colab with

Code: Select all

!nvcc --version
. In that case, change the cuda flags that openmm uses (assuming openmm has version consistent with whatever colab is using), e.g.:

Code: Select all

!time conda install -y -q -c conda-forge -c omnia/label/cuda102 -c omnia openmm=7.4.1=py36_cuda102_rc_1
and when they change the python version, you can look for the build code for openmm with that python by scanning through

Code: Select all

conda search -c omnia openmm
Also update

Code: Select all

sys.path.append('/usr/local/lib/python3.7/site-packages/')
to the next python colab is using.

POST REPLY