From: William S F. <ws...@fu...> - 2013-08-08 18:12:20
|
On 25/07/13 02:30, mrcausality wrote: > I'm attempting to use parallel python (PP) that uses a package I've developed in part with SWIG. PP works on multiple cores and has a very simple interface to pass functions (along with its arguments and module dependencies) into a job server which handles all the parallelization. Unfortunately, when I pass a function which takes as an argument an instance to a SWIG constructed python object, it incurs an access violation in the SWIG method "SWIG_Python_ConvertPtrAndOwn" whenever any methods of that instance are called in the job. If, instead, I were to create these instances within each job, then it runs fine. Below is a minimal working example. My thought is there is some ownership issue, but I'm not knowledgeable enough of SWIG's internals to say much more. It may be that SWIG is not designed to do these kinds of things, but it would be a shame as I've found an increasing need for PP and it would fit very nicely with the package I'm > using. If anyone can offer guidance or some clues of what I should or shouldn't be doing or expecting, I would appreciate it. I've also posted this to the PP forum, but have yet to receive any response. > > Have you looked at the -threads option? Search for -threads in the CHANGES file for some 'documentation'. If you get on well with it, please consider providing a patch to the Python.html documentation for other users. William |