Re: [f2py] threading with f2py
Stuart Mentzer <Stuart_Mentzer-O8HF4iB/[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Greetings Charlie, We went through this with a recent project and we found that running the Fortran in a thread using !f2py threadsafe does indeed let the Fortran yield back to Python but it doesn't work if you want to use callbacks from Fortran, which we did. We ended up using multiprocessing and it is working well. Multiprocessing takes longer to start each process than a thread and you have to make sure the state you need to pass the process is "pickleable" but that only matters in practice on Windows because it lacks an OS fork. (If you think I can be of any further assistance just give me a call.) Stuart