Segfault if initial positions not set

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Benjamin Trendelkamp-Schroer
Posts: 12
Joined: Fri Feb 24, 2012 11:49 am

Segfault if initial positions not set

Post by Benjamin Trendelkamp-Schroer » Mon Apr 29, 2013 2:06 am

Hello,

I am using OpenMM5.0 on CUDA. I just discovered that omitting

simulation.context.setPositions(...)

results in a "segfault" when calling

simulation.step(...)

I know it's a stupid mistake but it would be nice to have a more informative error message.

Thanks,

Ben

User avatar
Peter Eastman
Posts: 2568
Joined: Thu Aug 09, 2007 1:25 pm

Re: Segfault if initial positions not set

Post by Peter Eastman » Mon Apr 29, 2013 10:09 am

Hi Ben,

This is a bug in the SWIG generated Python wrappers that I've not yet been able to track down. The C++ library throws an exception with an informative error message. The Python wrappers are then supposed to catch that exception and turn it into a Python exception. And in many cases, they do exactly that, but in other cases they segfault instead.

Peter

User avatar
Peter Eastman
Posts: 2568
Joined: Thu Aug 09, 2007 1:25 pm

Re: Segfault if initial positions not set

Post by Peter Eastman » Mon Apr 29, 2013 11:15 am

Ok, I found the problem. We release the Python Global Interpreter Lock before calling step() so that other Python threads can run. But if step() threw an exception, it didn't get reacquired, leading to the segfault. This will be fixed in 5.1.

Peter

User avatar
Benjamin Trendelkamp-Schroer
Posts: 12
Joined: Fri Feb 24, 2012 11:49 am

Re: Segfault if initial positions not set

Post by Benjamin Trendelkamp-Schroer » Thu May 02, 2013 7:55 am

Hello,

thanks for the quick reply. You did a really good job with the python interface by the way! I am looking forward to the next release!

Cheers,

Ben

POST REPLY