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
Segfault if initial positions not set
- Benjamin Trendelkamp-Schroer
- Posts: 12
- Joined: Fri Feb 24, 2012 11:49 am
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Segfault if initial positions not set
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
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
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Segfault if initial positions not set
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
Peter
- Benjamin Trendelkamp-Schroer
- Posts: 12
- Joined: Fri Feb 24, 2012 11:49 am
Re: Segfault if initial positions not set
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
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