Re: [f2py] fortran and python threads
Mark Andrews <[email protected]> Wed, 1 Dec 2010 12:58:47 +0000
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Pearu, I saw the "threadsafe" directive in the manual, but its description was rather brief. Thanks for the example. I look forward to trying it. -m On Wed, Dec 1, 2010 at 9:20 AM, Pearu Peterson <[email protected]> wrote: > Hi Mark, > The python interpreter lock issues should be resolved by using > > threadsafe > > statement in a subroutine signature that you want to run from another > thread. You can use this statement also in a Fortran subroutine that you > are wrapping: just put it after f2py directive. For example, > > subroutine foo > !f2py threadsafe > ... > end subroutine foo > > HTH, > Pearu > > On 12/01/2010 04:48 AM, Mark Andrews wrote: >> Hi all (I'm new to posting to the list, but have been subscribed for a while), >> Is it possible to run a f2py wrapped fortran subroutine alongside a >> regular old python thread and for them to access the same variables? I >> don't really know much about threading in python, but I've heard about >> some issues with an interpreter lock. >> In my porblem, I have a fortran gibbs sampler. I would like a python >> thread to regularly read its "state" (read the values of some arrays) >> as it runs and write it to a database. Does that sound like something >> easy or painful? >> More generally, I often use openmp inside fortran code, but never have >> wrapped these with f2py. I know it is possible, but is there is some >> hidden issues that make this difficult. >> thanks, >> mark >> >> _______________________________________________ >> f2py-users mailing list >> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] >> http://cens.ioc.ee/mailman/listinfo/f2py-users > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users >