Hi,
I was trying to run OpenMM with Cuda and was getting a weird bad_cast error. I confirmed that the following two lines gave me the error:
OpenMM::Platform::loadPluginLibrary("/usr/local/openmm/lib/plugins/libOpenMMCuda.so");
context = new OpenMM::Context(*system, *integrator);
The error is this:
terminate called after throwing an instance of 'std::bad_cast'
what(): std::bad_cast
Aborted
If I do the same thing with libOpenMM.so (The reference framework), everything is fine. Have you seen this before and do you have any suggestions? I'm really stuck - thanks!
-Trevor
Weird error with libOpenMMCuda
- Peter Eastman
- Posts: 2602
- Joined: Thu Aug 09, 2007 1:25 pm
RE: Weird error with libOpenMMCuda
Strange. A few questions:
Are you using the precompiled binaries, or did you build from source?
I take it you are on Linux? What version? 32 or 64 bit?
What version of gcc are you compiling with?
Basically, I'm wondering whether there's an incompatibility caused by two pieces of code (your library, the OpenMM library, the CUDA plugin) being compiled with incompatible gcc versions and/or compilation options.
What version of CUDA are you using?
Is it possible for you to run in a debugger and see where the exception is getting thrown?
Peter
Are you using the precompiled binaries, or did you build from source?
I take it you are on Linux? What version? 32 or 64 bit?
What version of gcc are you compiling with?
Basically, I'm wondering whether there's an incompatibility caused by two pieces of code (your library, the OpenMM library, the CUDA plugin) being compiled with incompatible gcc versions and/or compilation options.
What version of CUDA are you using?
Is it possible for you to run in a debugger and see where the exception is getting thrown?
Peter
- Trevor Cickovski
- Posts: 7
- Joined: Thu Nov 10, 2005 9:46 am
RE: Weird error with libOpenMMCuda
Ok, I just tried it again with the newly released OpenMM version 3.0 and get the same issue. I am running on 64 bit Ubuntu Linux, version 10 - and downloaded OpenMM3.0-Linux64.zip. I am using Cuda 3.2 and downloaded the 64 bit binaries for that. My g++ is version 4.4.1.
I ran gdb and got a trace but am going to post it in a second message, since it's too long to fit here. Thanks!
I ran gdb and got a trace but am going to post it in a second message, since it's too long to fit here. Thanks!
- Trevor Cickovski
- Posts: 7
- Joined: Thu Nov 10, 2005 9:46 am
RE: Weird error with libOpenMMCuda
Here's the trace, seems to be in ContextImpl:
#0 0x00007ffff6fe54b5 in raise () from /lib/libc.so.6
#1 0x00007ffff6fe8f50 in abort () from /lib/libc.so.6
#2 0x00007ffff4381cc5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#3 0x00007ffff43800f6 in ?? () from /usr/lib/libstdc++.so.6
#4 0x00007ffff4380123 in std::terminate() () from /usr/lib/libstdc++.so.6
#5 0x00007ffff438021e in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0x00007ffff437efa2 in __cxa_bad_cast () from /usr/lib/libstdc++.so.6
#7 0x00007ffff61c8f7a in OpenMM::ContextImpl::ContextImpl(OpenMM::Context&, OpenMM::System&, OpenMM::Integrator&, OpenMM::Platform*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&) () from /usr/local/openmm/lib/libOpenMM.so
#8 0x00007ffff61e6769 in OpenMM::Context::Context(OpenMM::System&, OpenMM::Integrator&) ()
from /usr/local/openmm/lib/libOpenMM.so
#0 0x00007ffff6fe54b5 in raise () from /lib/libc.so.6
#1 0x00007ffff6fe8f50 in abort () from /lib/libc.so.6
#2 0x00007ffff4381cc5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#3 0x00007ffff43800f6 in ?? () from /usr/lib/libstdc++.so.6
#4 0x00007ffff4380123 in std::terminate() () from /usr/lib/libstdc++.so.6
#5 0x00007ffff438021e in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0x00007ffff437efa2 in __cxa_bad_cast () from /usr/lib/libstdc++.so.6
#7 0x00007ffff61c8f7a in OpenMM::ContextImpl::ContextImpl(OpenMM::Context&, OpenMM::System&, OpenMM::Integrator&, OpenMM::Platform*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&) () from /usr/local/openmm/lib/libOpenMM.so
#8 0x00007ffff61e6769 in OpenMM::Context::Context(OpenMM::System&, OpenMM::Integrator&) ()
from /usr/local/openmm/lib/libOpenMM.so
- Peter Eastman
- Posts: 2602
- Joined: Thu Aug 09, 2007 1:25 pm
RE: Weird error with libOpenMMCuda
That definitely looks to me like an inconsistency between libraries. Our precompiled libraries for 64 bit Linux were made with GCC 4.1.2 on CentOS, so this could easily be related to either the different OS or the different GCC.
Can you try compiling OpenMM from source and see if the problem goes away?
Peter
Can you try compiling OpenMM from source and see if the problem goes away?
Peter
- Trevor Cickovski
- Posts: 7
- Joined: Thu Nov 10, 2005 9:46 am
RE: Weird error with libOpenMMCuda
Yes, that worked!! Thanks Peter.