[petsc-users] How to use f2py on a PETSc/SLEPc-based fortran code
Satish Balay
balay at mcs.anl.gov
Wed Mar 22 13:51:06 CDT 2017
On Wed, 22 Mar 2017, Jose E. Roman wrote:
>
> > El 22 mar 2017, a las 19:23, Barry Smith <bsmith at mcs.anl.gov> escribió:
> >
> >
> >> On Mar 22, 2017, at 1:08 PM, Austin Herrema <aherrema at iastate.edu> wrote:
> >>
> >> Thank you for the suggestion! Seems like a reasonable way to go. Not working for me, however, I suspect because I'm using homebrew installations of PETSc and SLEPc (I don't think all the makefiles are kept). Any other way to do the same thing by chance? Worst case I could use a non-homebrew installation but I'd prefer not to mess with that if I can help it...
> >
> > How do you link a "regular" SLEPc C program using the home-brew libraries? You need basically the same link line for f2py as you need for C programs.
>
>
> What Barry may be suggesting is: instead of using a script to invoke f2py, add a rule to your makefile
>
> modname.so: outer_driver.f90
> f2py -c -m modname outer_driver.f90 file1.o file2.o file3.o ${SLEPC_EPS_LIB}
>
> Then 'make modname.so' will pick the libraries from SLEPc makefiles.
I think you would also need a different compile target [apart from the
link target above]. And using a diffent suffix for f2py sourcefiles -
say '.F90py' might help..
.SUFFIXES: .f90py
.f90py.o:
f2py -c ${FC_FLAGS} ${FFLAGS} -o $@ $<
Satish
More information about the petsc-users
mailing list