Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not import PlumedForce #10

Closed
juanmit opened this issue Sep 11, 2017 · 47 comments
Closed

can not import PlumedForce #10

juanmit opened this issue Sep 11, 2017 · 47 comments

Comments

@juanmit
Copy link

juanmit commented Sep 11, 2017

Hi Peter,

I think I successfully installed the openmmplumed because it says %100 on the built target.
And I tried to export LD_LIBRARY_PATH=/usr/local/lib/plumed.

However, I can not import PlumedFOrce and it says "No module named openmmplumed".
Are there anything I missed in the installation process? Thanks for helping.

--Hongbin

@juanmit
Copy link
Author

juanmit commented Sep 11, 2017

I realized the PLUMED_BUILD_PYTHON_WRAPPERS is off by default.

I changed it to ON and run "make PythonInstall" and the errors become

/bin/sh: 1: SWIG_EXECUTABLE-NOTFOUND: not found
python/CMakeFiles/PythonInstall.dir/build.make:51: recipe for target 'python/PlumedPluginWrapper.cpp' failed
make[3]: *** [python/PlumedPluginWrapper.cpp] Error 127
CMakeFiles/Makefile2:469: recipe for target 'python/CMakeFiles/PythonInstall.dir/all' failed
make[2]: *** [python/CMakeFiles/PythonInstall.dir/all] Error 2
CMakeFiles/Makefile2:477: recipe for target 'python/CMakeFiles/PythonInstall.dir/rule' failed
make[1]: *** [python/CMakeFiles/PythonInstall.dir/rule] Error 2
Makefile:265: recipe for target 'PythonInstall' failed
make: *** [PythonInstall] Error 2

Thanks for helping.
--Hongbin

@peastman
Copy link
Member

/bin/sh: 1: SWIG_EXECUTABLE-NOTFOUND: not found

That means it couldn't find SWIG. Have you installed it? Is SWIG_EXECUTABLE set correctly?

@juanmit
Copy link
Author

juanmit commented Sep 11, 2017

Thanks for replying.
I reinstalled&updated it with conda, and I got
"[100%] Built target PythonInstall " .

However, every time I import openmmplumed, I get
ImportError: libOpenMMPlumed.so: cannot open shared object file: No such file or directory

And I can see the file in the build/lib dir. It just can not read it. Should I change some path?

--Hongbin

@peastman
Copy link
Member

make PythonInstall should have installed a copy of that library inside the Python lib directory. Can you look and see if it's there? On my computer that's ~/miniconda3/lib, but I have a Mac, so it might be different on your computer.

It's also possible the error message is incorrect: the file is there, but it couldn't be opened because it depends on something else that's missing. For example, make sure the PLUMED library directory is in your LD_LIBRARY_PATH. You can use ldd to check whether its dependencies can be found.

@juanmit
Copy link
Author

juanmit commented Sep 12, 2017

I double checked my anaconda dir, and there were no libOpenMMPlumed.so found there.
However, I could successfully import openmmplumed after I copied the libOpenMMPlumed.so file from the build dir to ~/anaconda/lib.

I am not quite sure if it will solve all the issues on my work-station(ubuntu), and I am going to do some quick distance meta-dynamics simulations to see the performance. Thanks a lot for helping.
--Hongbin

@peastman
Copy link
Member

Check the output from 'make PythonInstall' carefully. It should be copying that file to somewhere. Make sure no errors are being reported.

@juanmit
Copy link
Author

juanmit commented Sep 12, 2017

I think I made a mistake.

I typed in " run python install" (no errors) instead of "make PythonInstall"(shows the following errors)

[100%] Generating PlumedPluginWrapper.cpp
/home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0/include/swig/OpenMMSwigHeaders.i:2000: Warning 401: Nothing known about base class 'std::exception'. Ignored.
running build
running build_py
copying openmmplumed.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_openmmplumed' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0/include -I/media/sdb/hongbin/openmm_plumed/openmm-plumed-master/openmmapi/include -I/home/hongbin/anaconda/include/python2.7 -c PlumedPluginWrapper.cpp -o build/temp.linux-x86_64-2.7/PlumedPluginWrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
g++ -pthread -shared -L/home/hongbin/anaconda/lib -Wl,-rpath=/home/hongbin/anaconda/lib,--no-as-needed build/temp.linux-x86_64-2.7/PlumedPluginWrapper.o -L/home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0/lib -L/media/sdb/hongbin/openmm_plumed/openmm-plumed-master/build2 -L/home/hongbin/anaconda/lib -lOpenMM -lOpenMMPlumed -lpython2.7 -o build/lib.linux-x86_64-2.7/_openmmplumed.so
running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.7/openmmplumed.py -> /home/hongbin/anaconda/lib/python2.7/site-packages
copying build/lib.linux-x86_64-2.7/_openmmplumed.so -> /home/hongbin/anaconda/lib/python2.7/site-packages
byte-compiling /home/hongbin/anaconda/lib/python2.7/site-packages/openmmplumed.py to openmmplumed.pyc
running install_egg_info
Removing /home/hongbin/anaconda/lib/python2.7/site-packages/OpenMMPlumed-1.0-py2.7.egg-info
Writing /home/hongbin/anaconda/lib/python2.7/site-packages/OpenMMPlumed-1.0-py2.7.egg-info
[100%] Built target PythonInstall

And the running tests show Exception: Specified a Platform for a Context which does not support all required kernels

Moreover, the openmm simulations without plumed run well without any errors.
And for some reasons, the combination of openmm7.1 + cuda8.0 on ubuntu 15.04 always fails at very beginning. is that the problem from ubuntu versions?

--Hongbin

@peastman
Copy link
Member

It looks like make PythonInstall worked correctly. It didn't report any errors, and it copied the files:

copying build/lib.linux-x86_64-2.7/openmmplumed.py -> /home/hongbin/anaconda/lib/python2.7/site-packages
copying build/lib.linux-x86_64-2.7/_openmmplumed.so -> /home/hongbin/anaconda/lib/python2.7/site-packages

It didn't mention anything about CUDA or OpenCL, though, so I gather you have PLUMED_BUILD_CUDA_LIB and PLUMED_BUILD_OPENCL_LIB turned off? Which test produced the error message you mentioned?

@juanmit
Copy link
Author

juanmit commented Sep 12, 2017

I have PLUMED_BUILD_CUDA_LIB and PLUMED_BUILD_OPENCL_LIB on. See followings.

CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /media/sdb/hongbin/openmm_plumed/openmm-plumed-master/build2
CUDA_BUILD_CUBIN OFF
CUDA_BUILD_EMULATION OFF
CUDA_HOST_COMPILER /usr/bin/cc
CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_SEPARABLE_COMPILATION OFF
CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-7.5
CUDA_VERBOSE_BUILD OFF
OPENCL_INCLUDE_DIR /usr/include
OPENCL_LIBRARY /usr/lib/x86_64-linux-gnu/libOpenCL.so
OPENMM_DIR /home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0
PLUMED_BUILD_CUDA_LIB ON
PLUMED_BUILD_OPENCL_LIB ON
PLUMED_BUILD_PYTHON_WRAPPERS ON
PLUMED_INCLUDE_DIR /usr/local/include/plumed
PLUMED_LIBRARY_DIR /usr/local/lib
PYTHON_EXECUTABLE /home/hongbin/anaconda/bin/python
SWIG_EXECUTABLE /home/hongbin/anaconda/bin/swig

The testing systems: Before I run openmm-plumed to do NMR restraints simulations, I have done several similar gromacs+plumed simulations before. See followings. The error message is

Exception: Specified a Platform for a Context which does not support all required kernels

import openmmplumed
from openmmplumed import PlumedForce
from plumed import plumed_script

class Tee(object):
def init(self, name, mode):
self.file = open(name, mode)
self.stdout = sys.stdout
def write(self, data):
self.file.write(data)
self.stdout.write(data)
gpu_id = sys.argv[1]
gro = GromacsGroFile('eq1.gro')
top = GromacsTopFile('topol.top', periodicBoxVectors=gro.getPeriodicBoxVectors())
system = top.createSystem(nonbondedMethod=PME, nonbondedCutoff=1*nanometer, constraints=HBonds)
system.addForce(PlumedForce(plumed_script))

integrator = mm.LangevinIntegrator(300unit.kelvin, 91.0/unit.picoseconds,2.0unit.femtoseconds)
integrator.setConstraintTolerance(0.00001)
platform = mm.Platform.getPlatformByName('CUDA')
properties = {'CudaPrecision': 'mixed','CudaDeviceIndex': gpu_id}

@juanmit
Copy link
Author

juanmit commented Sep 15, 2017

Hi Peter,

I re-installed everything and no errors there. But the simulation still gives me:
Exception: Specified a Platform for a Context which does not support all required kernels

And without doing system.addForce(PlumedForce(plumed_script)), everything works fine.
Please let me know what to do to solve this issue. Thanks a lot.

--Hongbin

@peastman
Copy link
Member

Try this:

from simtk.openmm import *
print(pluginLoadedLibNames)
print(Platform.getPluginLoadFailures())

What does that print?

@juanmit
Copy link
Author

juanmit commented Sep 15, 2017

In [1]: from simtk.openmm import *

In [2]: print(pluginLoadedLibNames)
('libOpenMMCPU.so', 'libOpenMMPME.so', 'libOpenMMCUDA.so', 'libOpenMMOpenCL.so', 'libOpenMMRPMDCUDA.so', 'libOpenMMDrudeCUDA.so', 'libOpenMMAmoebaCUDA.so', 'libOpenMMRPMDOpenCL.so', 'libOpenMMDrudeOpenCL.so', 'libOpenMMRPMDReference.so', 'libOpenMMDrudeReference.so', 'libOpenMMAmoebaReference.so')

In [3]: print(Platform.getPluginLoadFailures())
()

Should I expect libOpenMMPlumedReference.so ??
But I can do:
import openmmplumed
from openmmplumed import PlumedForce

@peastman
Copy link
Member

That looks like the libraries for the Plumed plugin haven't been installed. First verify what directory it's loading the plugins from:

print(version.openmm_library_path)

Now check that directory. Are the Plumed plugin libraries there?

@juanmit
Copy link
Author

juanmit commented Sep 15, 2017

The output is:
/home/hongbin/anaconda/lib
Looking for plumed files within this directory shows the following:
./python2.7/site-packages/openmmplumed.py
./python2.7/site-packages/_openmmplumed.so
./python2.7/site-packages/openmmplumed.pyc

@juanmit
Copy link
Author

juanmit commented Sep 15, 2017

We have tried a lot different CMAKE_INSTALL_PREFIX, and still can not merge the plumed plugins libraries to openMM. Our ccmake file is attached.

Is there anything we can do to solve this issue? Thanks a lot for helping.

CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0
CUDA_BUILD_CUBIN OFF
CUDA_BUILD_EMULATION OFF
CUDA_HOST_COMPILER /usr/bin/cc
CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_SEPARABLE_COMPILATION OFF
CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-7.5
CUDA_VERBOSE_BUILD OFF
OPENCL_INCLUDE_DIR /usr/include
OPENCL_LIBRARY /usr/lib/x86_64-linux-gnu/libOpenCL.so
OPENMM_DIR /home/hongbin/anaconda/pkgs/openmm-7.0.1-py27_0
PLUMED_BUILD_CUDA_LIB ON
PLUMED_BUILD_OPENCL_LIB ON
PLUMED_BUILD_PYTHON_WRAPPERS ON
PLUMED_INCLUDE_DIR /usr/local/include/plumed
PLUMED_LIBRARY_DIR /usr/local/lib
PYTHON_EXECUTABLE /home/hongbin/anaconda/bin/python
SWIG_EXECUTABLE /home/hongbin/anaconda/bin/swig

@peastman
Copy link
Member

It's possible conda is splitting up the files in a way that doesn't match the expected directory structure. If that's the case, though, there's an easy workaround. Add a call to Platform.loadPluginsFromDirectory() at the start of your code. Point it to whatever directory the Plumed plugins have gotten put into and tell it to load them from there.

@juanmit
Copy link
Author

juanmit commented Sep 25, 2017

I used Platform.loadPluginsFromDirectory() as you mentioned to load the OpenMMPlumed**.so files, and it worked well. Thank you very much for helping with everything.
--Hongbin

@juanmit juanmit closed this as completed Sep 25, 2017
@sstolzenberg
Copy link

Dear All,

banging my head while trying to build openmm-plumed - could somebody help me?

I have successfully compiled cmake-3.10.0, plumed-2.3.3, and openmm-7.1.1
locally (i.e. with --prefix) on our in-house cluster (I do not have admin rights).

For openmm-plumed, I set the following options (no OpenCL, just CUDA with toolkit 7.0) after
ccmake /home/sstolzen/mypackages/openmm-plumed
started from within an empty directory
/home/sstolzen/mypackages/openmm-plumed/build

CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /home/sstolzen/mypackages/openmm-7.1.1
CUDA_HOST_COMPILER /usr/bin/cc
CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-7.0
CUDA_USE_STATIC_CUDA_RUNTIME ON
CUDA_rt_LIBRARY /usr/lib/x86_64-linux-gnu/librt.so
OPENMM_DIR /home/sstolzen/mypackages/openmm-7.1.1
PLUMED_BUILD_CUDA_LIB ON
PLUMED_BUILD_OPENCL_LIB OFF
PLUMED_BUILD_PYTHON_WRAPPERS ON
PLUMED_INCLUDE_DIR /home/sstolzen/mypackages/plumed-2.3.3/include/plumed
PLUMED_LIBRARY_DIR /home/sstolzen/mypackages/plumed-2.3.3/lib/plumed
PYTHON_EXECUTABLE /home/sstolzen/sw/miniconda2/bin/python
SWIG_EXECUTABLE /home/sstolzen/sw/miniconda2/bin/swig

after I "configured" again and "generated" with error messages, I execute

make install

and get the following error message:
/////////////////////
make install
[ 5%] Linking CXX shared library libOpenMMPlumed.so
/usr/bin/ld: cannot find -lplumed
collect2: error: ld returned 1 exit status
CMakeFiles/OpenMMPlumed.dir/build.make:172: recipe for target 'libOpenMMPlumed.so' failed
make[2]: *** [libOpenMMPlumed.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/OpenMMPlumed.dir/all' failed
make[1]: *** [CMakeFiles/OpenMMPlumed.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
/////////////////////

I don't seem to find "ibOpenMMPlumed.so" anywhere

  • is ccmake trying to copy it to /usr/local/lib?

Thanks!
Best,
Sebastian

@peastman
Copy link
Member

/usr/bin/ld: cannot find -lplumed

That means the linker wasn't able to find Plumed to link against. You specified

PLUMED_LIBRARY_DIR /home/sstolzen/mypackages/plumed-2.3.3/lib/plumed

What's contained in that directory? Is libplumed.so there?

@sstolzenberg
Copy link

Great, thanks, Peter!

Solution is to change
PLUMED_LIBRARY_DIR
to
/home/sstolzen/mypackages/plumed-2.3.3/lib
in which libplumed.so resides.

Which python import commands do I have to use to able to use PlumedForce within an openmm/python session, i.e. to make the example code work:

////////////
script = """
d: DISTANCE ATOMS=1,10
METAD ARG=d SIGMA=0.2 HEIGHT=0.3 PACE=500"""
system.addForce(PlumedForce(script))
////////////

Thanks again,
Sebastian

@peastman
Copy link
Member

from openmmplumed import PlumedForce

I should add that to the readme.

@sstolzenberg
Copy link

OK, that means something is potentially wrong with my installation (I cannot import or even manually find this module).

"openmmplumed" should reside somewhere in
CMAKE_INSTALL_PREFIX
should it not?

(I had to build OpenMM from a linux binary, so not directly via conda)

Thanks!
Sebastian

@peastman
Copy link
Member

Did you make PythonInstall? What was the output from it?

@sstolzenberg
Copy link

sstolzenberg commented Oct 25, 2017

great, thanks Peter!

in addition, adding the library paths for both plumed and openmm to the environment variable
LD_LIBRARY_PATH
was necessary to make it work.

Thanks again,
Sebastian

@aakognole
Copy link

Hi Peter,
I am getting following error for installing the plugin.

$ make install
[100%] Linking CXX executable TestCudaPlumedForce
/usr/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
platforms/cuda/tests/CMakeFiles/TestCudaPlumedForce.dir/build.make:98: recipe for target 'platforms/cuda/tests/TestCudaPlumedForce' failed
make[2]: *** [platforms/cuda/tests/TestCudaPlumedForce] Error 1
CMakeFiles/Makefile2:348: recipe for target 'platforms/cuda/tests/CMakeFiles/TestCudaPlumedForce.dir/all' failed
make[1]: *** [platforms/cuda/tests/CMakeFiles/TestCudaPlumedForce.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

As at 100% I get this error and if I run make PythonInstall after that it works successfully. But openmm is not able to load the plugin.

So I used Platform.loadPluginsFromDirectory() option as you have suggested. With that the plugin is activated and I can add PlumedForce(script), but it gives the error mentioned previously

Exception: Specified a Platform for a Context which does not support all required kernels

I can't figure how to resolve this. Please help.
Thanks,
Abhishek.

@peastman
Copy link
Member

The relevant part of the error log is

 /usr/bin/ld: cannot find -lcuda

That means it couldn't find the CUDA library to link against. Make sure you have CUDA_TOOLKIT_ROOT_DIR set correctly.

@aakognole
Copy link

I have set the correct path to CUDA_TOOLKIT_ROOT_DIR. Please see following ccmake input

CMAKE_BUILD_TYPE
CMAKE_INSTALL_PREFIX /home/akognole/modules/miniconda2/pkgs/openmm-7.1.1-py27_0
CUDA_HOST_COMPILER /usr/bin/cc
CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_TOOLKIT_ROOT_DIR /opt/cuda/8.0.44
CUDA_USE_STATIC_CUDA_RUNTIME ON
CUDA_rt_LIBRARY /usr/lib/x86_64-linux-gnu/librt.so
OPENMM_DIR /home/akognole/modules/miniconda2/pkgs/openmm-7.1.1-py27_0
PLUMED_BUILD_CUDA_LIB ON
PLUMED_BUILD_OPENCL_LIB OFF
PLUMED_BUILD_PYTHON_WRAPPERS ON
PLUMED_INCLUDE_DIR /home/akognole/modules/plumed/include/plumed
PLUMED_LIBRARY_DIR /home/akognole/modules/plumed/lib
PYTHON_EXECUTABLE /home/akognole/modules/miniconda2/bin/python
SWIG_EXECUTABLE /home/akognole/modules/miniconda2/bin/swig

@peastman
Copy link
Member

Are you sure libcuda.so actually exists on the computer you're compiling on? That's a common situation on clusters. If there are only GPUs on the compute nodes, not the login nodes, the CUDA library will often be missing from the login nodes. If that's the case, you may have to compile on a compute node.

@aakognole
Copy link

Yes. The cuda library is accessible on both login node and compute nodes.
find /opt/ -name libcuda.so
/opt/cuda/8.0.44/lib64/libcuda.so

@aakognole
Copy link

It is working when I load the plugin with direct address of cuda platform
Platform.loadPluginsFromDirectory($BUILD_DIRECTORY/platforms/cuda/)
from openmmplumed import PlumedForce
Thanks for the help!

@peastman
Copy link
Member

That's very strange. It indicates that it's successfully built the CUDA plugin already. So why was it able to locate libcuda.so when building that, but not when building the test case?

@digbennett
Copy link

digbennett commented Oct 5, 2018

It's possible conda is splitting up the files in a way that doesn't match the expected directory structure. If that's the case, though, there's an easy workaround. Add a call to Platform.loadPluginsFromDirectory() at the start of your code. Point it to whatever directory the Plumed plugins have gotten put into and tell it to load them from there.

I have had the exact same problem as @juanmit and followed the comments to this point. What files I should be looking for when you say the 'Plumed plugins'?

@peastman
Copy link
Member

peastman commented Oct 5, 2018

What files I should be looking for when you say the 'Plumed plugins'?

In your lib/plugins directory there should be one file for each platform you compiled. They'll have names like libOpenMMPlumedReference.dylib.

Side note: I cannot locate any file named 'libplumed.so' on my Mac.

Have you installed Plumed on your computer? Where is it?

@digbennett
Copy link

In your lib/plugins directory there should be one file for each platform you compiled. They'll have names like libOpenMMPlumedReference.dylib.

I have one file that looks like that: 'libOpenMMPlumed.dylib' it is in the directory where I ran the initial 'make PythonInstall' command. In the lib/plugins directory I have the following:
libOpenMMAmoebaReference.dylib
libOpenMMDrudeOpenCL.dylib
libOpenMMOpenCL.dylib
libOpenMMRPMDOpenCL.dylib
libOpenMMCPU.dylib
libOpenMMDrudeReference.dylib
libOpenMMPME.dylib
libOpenMMRPMDReference.dylib

It is worth noting that if I touch the libOpenMMPlumed.dylib file (moving it for example) I start getting a bunch of errors thrown when I try to import OpenMM in python. When I try to load the directory that contains 'libOpenMMPlumed.dylib' using Platform.loadPluginsFromDirectory() I still get the same error:

Exception: No Platform supports all the requested kernels

I do have Plumed installed - it was a conda install. I checked the installation with "plumed --is-installed" command which runs without error. I can track down where it is precisely if that is important.

@digbennett
Copy link

Looking over the make PythonInstall response there were a number of warnings generated. Most of them looked like this:
Warning 453: Can't apply (OpenMM::Context &OUTPUT). No typemaps are defined.

but there were two warning towards the end:

warning: directory not found for option '-L/Users/user_name/anaconda3/pkgs/openmm-7.2.2-py36_1/include/openmm/lib'

/Users/user_name/anaconda3/envs/CGMD_OpenMM/include/openmm/GayBerneForce.h:292:23: warning: field 'epsilon' will be initialized after field 'xparticle' [-Wreorder]
sigma(sigma), epsilon(epsilon), xparticle(xparticle), yparticle(yparticle), sx(sx), sy(sy), sz(sz), ex(ex), ey(ey), ez(ez) {

@peastman
Copy link
Member

peastman commented Oct 5, 2018

libOpenMMPlumed.dylib defines the API. It goes in the lib directory. The library defining the openmmplumed Python module links against it directly, so if it's not there, you'll get an error from the import command.

The file libOpenMMPlumedReference.dylib defines the implementation for the reference platform. There likewise might be ones for the OpenCL and/or CUDA platforms. They go in lib/plugins. They get dynamically loaded at runtime. If you don't have one for the platform you're trying to use, you'll get the message about "No Platform supports all the requested kernels" when you try to create a Context.

Check the output from make install. You should see messages referring to those files saying where they're being copied to.

I checked the installation with "plumed --is-installed" command which runs without error. I can track down where it is precisely if that is important.

Yes, the library needs to be able to link against it. PLUMED_LIBRARY_DIR should be set to the directory containing it.

@digbennett
Copy link

Looking back at the cmake I have the following which appears to be reasonable (which is to say there are plumed directories there):
PLUMED_INCLUDE_DIR /usrpath/anaconda3/envs/env_name/include
PLUMED_LIBRARY_DIR /usrpath/anaconda3/envs/env_name/lib

I found the following lines in the make result:

copying build/lib.macosx-10.9-x86_64-3.6/_openmmplumed.cpython-36m-darwin.so -> /usrpath/anaconda3/envs/env_name/lib/python3.6/site-packages
copying build/lib.macosx-10.9-x86_64-3.6/openmmplumed.py -> /usrpath/anaconda3/envs/env_name/lib/python3.6/site-packages

If I go to that directory (/usrpath/anaconda3/envs/env_name/lib/python3.6/site-packages) I do find those two files:
openmmplumed.py
_openmmplumed.cpython-36m-darwin.so

Not sure if those are the files I'm looking for or not. If I point Platform.loadPluginsFromDirectory('/usrpath/anaconda3/envs/env_name/lib/python3.6/site-packages'), I get the following output:
('sip.so',
'_yaml.cpython-36m-darwin.so',
'mistune.cpython-36m-darwin.so',
'kiwisolver.cpython-36m-darwin.so',
'_openmmplumed.cpython-36m-darwin.so',
'_cffi_backend.cpython-36m-darwin.so')
but the same error message as before if I try to run a calculation.

I assume I'm not reading the output of the make correctly. I apologize for the size of this, but I'm just going to post the whole thing and maybe that will help solve this riddle.

makeoutput.txt

@digbennett
Copy link

Side note - just moving the libOpenMMPlumed.dylib to the lib directory does not work. After doing that when I try to import openMM it can't find the file (referenced from 'lib/python3.6/site-packages/_openmmplumed.cpython-36m-darwin.so' directly to where the file was put originally).

@peastman
Copy link
Member

peastman commented Oct 6, 2018

_openmmplumed.cpython-36m-darwin.so is something different. That's the Python module. It's created during make PythonInstall. You want to look for messages about libOpenMMPlumedReference.dylib. They'll be generated during make install, not make PythonInstall.

@digbennett
Copy link

Well - I see the problem now at least. I wasn't running the make install, only the make PythonInstall. When I run make install there is a clear error "fatal error: 'wrapper/Plumed.h' file not found". The error arises in file: openmm-plumed-master/platforms/reference/src/ReferencePlumedKernelFactory.cpp. Looking through my files I find Plumed.h in /usrpath/anaconda3/envs/env_name/include/plumed/wrapper. My cmake has the Plumed include directory pointing to: /usrpath/anaconda3/envs/env_name/include, so that seems reasonable.

This appears to be a similar error to what was previously seen in issue #8.. It sounds like the previous person solved this by modifying something in the cmake files themselves to change where it expected to find files, but it wasn't clear exactly which file should get modified.

My apologies for being particularly slow. I appreciate all of the help.

PS This is how far the install had proceeded before the error:
[ 26%] Built target OpenMMPlumed
[ 36%] Built target TestSerializePlumedForce
[ 42%] Building CXX object platforms/reference/CMakeFiles/OpenMMPlumedReference.dir/src/ReferencePlumedKernelFactory.cpp.o

@peastman
Copy link
Member

peastman commented Oct 7, 2018

Does it work if you set PLUMED_INCLUDE_DIR to /usrpath/anaconda3/envs/env_name/include/plumed/wrapper?

@digbennett
Copy link

That path results in the exact same error. If I change it to:
PLUMED_INCLUDE_DIR --> /usrpath/anaconda3/envs/env_name/include/plumed
then the install gets farther but now has some some very opaque errors that suggest it is having a hard time parsing the c++ code:

image

@peastman
Copy link
Member

peastman commented Oct 8, 2018

Ok, that's very strange. It looks like it's getting confused trying to interpret it as C++11. The thing is, OpenMM 7.2 doesn't use C++11, so it doesn't actually need to be turned on. 7.3 does use it, which is why the plugin's build script specifies it. Try installing the 7.3 beta (see https://simtk.org/plugins/phpBB/viewtopicPhpbb.php?f=161&t=9433&p=0&start=0&view=&sid=e423c3d0b3b6a5819dd549d758fbfd58), or alternatively remove this line from the plugin's build script: https://github.com/peastman/openmm-plumed/blob/master/CMakeLists.txt#L19

@digbennett
Copy link

Well that is definitely better. I commented out the line you highlighted and now there are a slew of 'deprecated' warnings but it installs. Having done that, though, I'm now back to the previous python level problem:

Exception: No Platform supports all the requested kernels

Looking over the output file I get the following:

Install the project...
-- Install configuration: ""
-- Installing: /usrpath/anaconda3/envs/env_name/include/include/PlumedForce.h
-- Installing: /usrpath/anaconda3/envs/env_name/include/include/PlumedKernels.h
-- Installing: /usrpath/anaconda3/envs/env_name/include/include/internal/PlumedForceImpl.h
-- Installing: /usrpath/anaconda3/envs/env_name/include/include/internal/windowsExportPlumed.h
-- Installing: /usrpath/anaconda3/envs/env_name/include/lib/libOpenMMPlumed.dylib
-- Installing: /usrpath/anaconda3/envs/env_name/include/lib/plugins/libOpenMMPlumedReference.dylib
-- Installing: /usrpath/anaconda3/envs/env_name/include/lib/plugins/libOpenMMPlumedOpenCL.dylib

When I check where the python is looking for the libraries I find:

print(version.openmm_library_path)
/usrpath/anaconda3/envs/env_name/lib

The next thing I tried was to just point to the env_name/include/lib/plugin folder explicitly.

Platform.loadPluginsFromDirectory('/usrpath/anaconda3/envs/env_name/include/lib/plugins')

That appears to work (in that two libraries are read in: 'libOpenMMPlumedOpenCL.dylib', 'libOpenMMPlumedReference.dylib'), but resulted in a kernel crash when I tried to actually run a python call to OpenMMPlumed. I also, for good measure, tried the loadPluginsFromDirectory() using env_name/include/lib/ but that resulted in the same exception error as before.

@digbennett
Copy link

Okay. Here is where this stands at the moment - I was never able to get an error message out of the python code when I attempted a simulation with a PlumedForce defined in it. Based on the issues with defining paths correctly, I took a (wild) guess that this issue was related to the directory structure that anaconda uses for plumed vs what openmm-plumed was expecting. Since I couldn't figure out how to get them to play nicely, I attempted to remove that issue by uninstalling the anaconda Plumed code and creating a local installation of Plumed in /usr/local/include/plumed. I would have also done a local install of openmm but the installation guides all point to the conda-forge install.

Now in the process of getting plumed to install correctly, I needed to install Xcode command line tools. I assume as a result of that, now when I run 'make install' for openmm-plumed (with appropriate changes to the definitions of the different paths), I get the following error:
image

I have located an assert.h file but it is buried fairly deeply: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/kern

Any guesses?

I should also mention I up-dated the operating system to 10.14.

@peastman
Copy link
Member

That sounds like it might be the same problem discussed at frida/frida#338. They resolved it by running xcode-select --install.

@peastman
Copy link
Member

If you didn't already, you might also try rerunning cmake since some paths may have changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants