[MMTK] new FF terms: bug in Python implementation

Konrad Hinsen hinsen at cnrs-orleans.fr
Tue Apr 14 12:39:11 UTC 2009


On Apr 8, 2009, at 20:39, Qadir Timerghazin wrote:

> I am trying to implement a new FF term using pure Python (without C or
> Pyrex interfaces). However, it looks like the pure Python solution is
> broken: the mdtest.py example in
> Examples/Forcefield/HarmonicOscillator/Python crashes with
> segmentation fault. This is a very consistent behaviour: it happens
> both for Linux and Mac OS installations, and for the MMTK versions
> 2.5.17 to 2.5.24 (didn't test the earlier versions). I asked several
> colleagues to run the test with their MMTK installations, and they
> also get segfaults. Any ideas how to make it work?

Unfortunately not. This has been a known problem for a while,  
although it is not as consistent as you found it to be: when I  
developed the code using Python 2.2, it worked under Linux but not on  
several other systems. At the time they were written, all the  
examples in the MMTK distribution worked fine on my development system.

When the first reports of crashes came in, I started analyzing them  
and came to the conclusion that the crashes were somehow related to  
memory management. However, I couldn't find anything in the  
implementation that could be responsible for this, but for lack of  
time I had to drop the investigation. Apparently it is not trivial to  
have Python code called from an extension module.

Since then, Pyrex has provided another way to write force field terms  
without having to resort to writing C code. Debugging is less  
convenient because of the compile cycle, but on the other hand there  
are clear performance advantages to using Pyrex rather than Python.

I have added a note about this problem to MMTK/Examples/Forcefield/ 
README.

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: hinsen at cnrs-orleans.fr
Web: http://dirac.cnrs-orleans.fr/~hinsen/
---------------------------------------------------------------------






More information about the mmtk mailing list