[petsc-users] Fortran 90 problem (basic level)

Danny Lathouwers - TNW D.Lathouwers at tudelft.nl
Mon Apr 28 04:26:01 CDT 2014


Dear users,

I encountered some basic problems when using PETSc with Fortran90. To illustrate the problem easiest I made a simple problem (attached).
There is a petsc.f90 that contains a module with all PETSc specific coding (initializations, etc).
I have a main with some easy declarations and calls. There also is a f90_kind for type definition (essentially for the 'double precision'). Note that I wrap the matrices in Fortran structures so that I can keep the code free from PETSc except petsc.f90.
The file 'output' is what I get.

The program fills two diagonal matrices of size 10. This seems to work fine.

The call to get_info should print the number of rows and columns of a matrix: it thinks the number of columns is 0.

Another routine mat_prod does matrix-matrix multiplication through MatMatMult. This seg faults.

I also tried the above with all kinds of includes instead of the 'use'-manner. This gave the same results.

It seems like the interfacing is not working as it should. Am I missing a 'use' statement or a compile option?
strangely enough the matrix construction does work fine.

I hope anyone might shed some light on this.

Thank you.
Danny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: f90_kind.f90
Type: application/octet-stream
Size: 694 bytes
Desc: f90_kind.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.f90
Type: application/octet-stream
Size: 1134 bytes
Desc: main.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petsc.f90
Type: application/octet-stream
Size: 2555 bytes
Desc: petsc.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0007.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 682 bytes
Desc: Makefile
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output
Type: application/octet-stream
Size: 2943 bytes
Desc: output
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140428/21d73433/attachment-0009.obj>


More information about the petsc-users mailing list