Page 1 of 1

Weird error with libOpenMMCuda

Posted: Wed Apr 13, 2011 12:58 pm
by tcickovs
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

RE: Weird error with libOpenMMCuda

Posted: Fri Apr 15, 2011 5:12 pm
by peastman
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

RE: Weird error with libOpenMMCuda

Posted: Thu May 19, 2011 7:10 pm
by tcickovs
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!

RE: Weird error with libOpenMMCuda

Posted: Thu May 19, 2011 7:11 pm
by tcickovs
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

RE: Weird error with libOpenMMCuda

Posted: Fri May 20, 2011 4:38 pm
by peastman
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

RE: Weird error with libOpenMMCuda

Posted: Fri May 20, 2011 7:26 pm
by tcickovs
Yes, that worked!! Thanks Peter.