[Numpy-discussion] f2py: sharing F90 module data between modules

Garry Willgoose garry.willgoose@newcastle.edu...
Thu Feb 14 15:21:04 CST 2008


Ohh Pearu I'm not complaining about deficiencies in f2py ... its a  
great piece of work that makes what I'm doing possible at all. Just  
like most open source software (including my own ;-) there may be  
ways to tweak it to do things that are undocumented.

>> Why is that problem? I can envisage a user that just wants to use the
>> environment without writing any additional fortran modules (and thus
>> may not even have an installed fortran compiler) and if they screw up
>> mod dates on the files (by say a ftp from one machine to another ...
>> for instance on our cluster the compiler is only installed on one
>> machine and only binaries are moved around the cluster) then the
>> environment might want to reassemble (with f2py) the aggregated
>> library because it (erroneously) thinks there is a newer component
>> shared library. This will fail because f2py quits when asked to
>> process ONLY .so files. If I have a trivial fortran file to force
>> f2py then this forces users to have a fortran compiler on their
>> machine, even if they do not want to actually compile a new fortran
>> module component, simply because f2py will not operate unless it is
>> offered at least one fortran file.
> This is not a typical task for f2py. f2py is not a general purpose
> linker. It's amazing that f2py could even be used for such a task,
> so I don't think that the above demonstrates any bug of f2py.

Indeed not typical ... as I recognise ... which is why I wondered if  
there was an undocumented way to tweak to do what I want to do (I get  
requests like this on my own software all the time;-).

> However, if you are worried about whether users have fortran compilers
> installed then can you assume that they have a C compiler installed?
> If so, then instead of trivial Fortran file try using the following
> trivial .pyf file:
> python module dummy
>   interface
>     subroutine dummyfunc()
>       fortranname
>       callstatement ;
>     end subroutine dummyfunc
>   end interface
> end python module dummy
> that should force f2py to build a shared library dummy.so
> with no Fortran dependencies.

Perfect ...


Prof Garry Willgoose,
Australian Professorial Fellow in Environmental Engineering,
Director, Centre for Climate Impact Management (C2IM),
School of Engineering, The University of Newcastle,
Callaghan, 2308

Centre webpage: www.c3im.org.au

Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2 6545 9574  
(Fri PM-Mon)
FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal  
and Telluric)
Env. Engg. Secretary: (International) +61 2 4921 6042

email:  garry.willgoose@newcastle.edu.au;  
email-for-life: garry.willgoose@alum.mit.edu
personal webpage: www.telluricresearch.com/garry
"Do not go where the path may lead, go instead where there is no path  
and leave a trail"
                           Ralph Waldo Emerson

More information about the Numpy-discussion mailing list