Page 1 of 1

Support both OpenMM 6.2 and 6.3

Posted: Mon Jun 15, 2015 1:30 pm
by zonca
Hi,

the signature for the function `computeNeighborListVoxelHash` changed in 6.3, it now requires the periodic box vectors instead of the box size.
what is the easiest way for plugins to support both versions of this function?

thanks!

Re: Support both OpenMM 6.2 and 6.3

Posted: Tue Jun 16, 2015 12:57 pm
by peastman
The simplest approach is probably just to use an #ifdef to control what arguments you pass based on the version you're compiling for.

Peter

Re: Support both OpenMM 6.2 and 6.3

Posted: Tue Jun 16, 2015 1:23 pm
by zonca
Thanks, how do I extract the current version of OpenMM at compilation time of a plugin?

Re: Support both OpenMM 6.2 and 6.3

Posted: Tue Jun 16, 2015 1:53 pm
by peastman
When OpenMM itself is compiled, the build script defines a set of constants for the version number (OPENMM_MAJOR_VERSION and OPENMM_MINOR_VERSION). You can do something similar when compiling your plugin: define constants to tell it what version to compile for.

Peter

Re: Support both OpenMM 6.2 and 6.3

Posted: Wed Jun 24, 2015 10:15 am
by zonca
I wonder if it would be reasonable to rely on the Python wrapper, something like:

Code: Select all

python -c "from simtk import openmm; print(openmm.version.short_version)"

Re: Support both OpenMM 6.2 and 6.3

Posted: Wed Jun 24, 2015 10:33 am
by jswails1
Assuming you can rely on the simtk.openmm package belonging to the same installation as the OpenMM build whose libraries you are linking, that should work fine.

A word of caution here, though, is that it's easy to install multiple versions of the OpenMM libraries on the same machine, but more difficult to keep corresponding versions of the Python bindings for all of them. The standard workflow of "configure, install to a prefix" will dump the Python libraries in the site-packages for Python. So if you compile 6.2, then 6.3 and don't take care to specially handle the simtk packages, then you will be left with only a single set of Python bindings for OpenMM corresponding to version 6.3 (even if you try to link to 6.2 libraries).

So long story short, this is OK if you have only one OpenMM build on your system or if you have a robust way of keeping different Python bindings for different versions separate and properly loaded with each of the OpenMM versions you have installed. Otherwise, you may run into problems.

Re: Support both OpenMM 6.2 and 6.3

Posted: Wed Jun 24, 2015 1:14 pm
by zonca
Thanks Jason,
I was actually more concerned about users that only use OpenMM C++ and don't even install the Python wrapper, do you have a feeling of what fraction of OpenMM users use only C++?

Re: Support both OpenMM 6.2 and 6.3

Posted: Wed Jun 24, 2015 1:38 pm
by peastman
I think "what you're building for" and "what you have installed" are two different questions. For example, you may have OpenMM 6.3 installed on your computer, but still want to build separate binaries that are compatible with both 6.2 and 6.3.

Peter