Page 1 of 1
Segfault if initial positions not set
Posted: Mon Apr 29, 2013 2:06 am
by trendelkamp
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
Re: Segfault if initial positions not set
Posted: Mon Apr 29, 2013 10:09 am
by peastman
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
Re: Segfault if initial positions not set
Posted: Mon Apr 29, 2013 11:15 am
by peastman
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
Re: Segfault if initial positions not set
Posted: Thu May 02, 2013 7:55 am
by trendelkamp
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