On Sat, 30 May 2009, Stephan Kramer wrote: > Thanks a lot for looking into this. The explicit fortran interfaces are in > general very useful. The problem occurred for me with petsc-3.0.0-p1. I'm > happy to try it out with a more recent patch-level or with petsc-dev.
Did you configure with '--with-fortran-interfaces=1' or are you directly using '#include "finclude/ftn-auto/petscmat.h90"'? With my builds --with-fortran-interfaces=1 is broken with p0 [so p1 might also be broken] There was some reorganizing of f90 interface in the newer patchlevel [p4/ or p5] - and thats also broken [so petsc-dev is also broken] > My current workaround is to simply wrap the call the MatGetInfo inside an > external subroutine that doesn't use the fortran interfaces, so we can still > apply the interfaces in the rest of the code. This is part of our CFD code > that has to build on a number of different platforms, so I will probably have > to maintain this workaround, so it will build with whatever petsc 3 version is > available on a given platform. > > The attached files were for current petsc-dev? Thare are from petsc-3.0.0 - but it should also work with petsc-dev. Its tested by building PETSc normally - and changing the example ex12f.F as follows: asterix:/home/balay/tmp/petsc-dist-test>hg diff src/ksp/ksp/examples/tests/ex12f.F diff -r 981c76f817e6 src/ksp/ksp/examples/tests/ex12f.F --- a/src/ksp/ksp/examples/tests/ex12f.F Tue May 26 22:13:06 2009 -0500 +++ b/src/ksp/ksp/examples/tests/ex12f.F Sat May 30 11:02:03 2009 -0500 @@ -8,6 +8,10 @@ #include "finclude/petscpc.h" #include "finclude/petscksp.h" #include "finclude/petscviewer.h" +#define PETSC_USE_FORTRAN_INTERFACES +#include "finclude/petscmat.h90" +#undef PETSC_USE_FORTRAN_INTERFACES + ! ! This example is the Fortran version of ex6.c. The program reads a PETSc matrix ! and vector from a file and solves a linear system. Input arguments are: asterix:/home/balay/tmp/petsc-dist-test> Satish > > Cheers > Stephan > > Satish Balay wrote: > > I have the following fixed files [untested yet]. But could you tell me > > how you've configured PETSc? - and what patchlevel? > > > > [It appears that there are quiet a few breakages with > > --with-fortran-interfaces=1 - I might fix this in petsc-dev - not > > 3.0.0 - as it depends upon some f90 interface changes that are only in > > petsc-dev] > > > > > > Attaching the modified files that go with my untested fix. > > > > include/finclude/ftn-auto/petscmat.h90 > > include/finclude/ftn-custom/petscmat.h90 > > src/mat/interface/ftn-auto/matrixf.c > > src/mat/interface/ftn-custom/zmatrixf.c > > src/mat/interface/matrix.c > > > > Satish > > > > > > On Wed, 27 May 2009, Barry Smith wrote: > > > > > Stephan, > > > > > > Satish is working on the patch for this and will get it to you shortly. > > > > > > Sorry for the delay, we were debating how to handle it. > > > > > > Barry > > > > > > On May 23, 2009, at 9:00 AM, Stephan Kramer wrote: > > > > > > > Hi all, > > > > > > > > First of all thanks of a lot for providing explicit fortran interfaces > > > > for > > > > most functions in Petsc 3. This is of great help. I do however run into > > > > a > > > > problem using MatGetInfo. The calling sequence for fortran (according to > > > > the > > > > manual) is: > > > > > > > > double precision info(MAT_INFO_SIZE) > > > > Mat <cid:part1.02040105.02020103 at imperial.ac.uk> A > > > > integer ierr > > > > > > > > call MatGetInfo > > > > <cid:part2.00070305.02060306 at imperial.ac.uk>(A,MAT_LOCAL,info,ierr) > > > > > > > > The interface however seems to indicate the info argument has to be a > > > > single > > > > double precision (i.e. a scalar not an array). I guess with implicit > > > > interfaces this sort of thing would work, but with the provided explicit > > > > interface, at least gfortran won't let me have it. > > > > > > > > Cheers > > > > Stephan > > > > > >
