Re: [f2py] Re: unloading/reloading compiled modules
Demaeyer Jonathan <[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Finally, I have used the weave solution, i. e. changing the module name
each time I change the module content (mainly by adding a number at the
end of the name). It works, but in my opinion this method is somewhat
inelegant. A more elegant one would have been to use the second solution
you proposed, but this would have imply to much change in my program.
However, thank you very much for your help,
Jonathan
Pearu Peterson a écrit :
>
>
> Demaeyer Jonathan wrote:
>> Pearu Peterson a écrit :
>>> Hi,
>>
>> ...
>>> Another way would be
>>> to have a master process that calls python as a separate subprocess that
>>> carries out computations with f2py generated extension modules. If the
>>> extension module is changed then the next subprocess picks up the
>>> updated extension module.
>>>
>> ...
>>> HTH,
>>> Pearu
>>
>> Hi,
>>
>> I would like to try this.
>> But I wonder if importing a module inside a Thread object of the python
>> threading module means that the import is only available in the
>> subprocess or also in the main process?
>
> No, that is not working:
>>>> from numpy.f2py import compile as fcomp
>>>> from scipy.misc.pexec import ParallelExec
>>>> def mkfoo(i):
> ... fcomp(' subroutine foo\n print*, %s\n end' % i,
> 'foo', verbose=0)
> ... import foo
> ... foo.foo()
> ...
> ...
>>>> pe = ParallelExec()
>>>> pe('mkfoo(3)')
> 3
>>>> pe('mkfoo(5)')
> 3
>
> Here `5` instead of `3` would be a desired output.
>
> What I meant was that the subprocess is a new python
> process that is executed via, say, subprocess.Popen.
> For example, the main process is generating extension modules
> that are imported and used by some other module that is
> used within Popen process.
>
> Pearu