Re: Réf. : Re: Fortran integer declaration in petscdef.h

Satish Balay balay at
Mon Apr 7 11:15:01 CDT 2008

On Mon, 7 Apr 2008, Thomas DE-SOZA wrote:

> The reason I was asking about this is that in a previous version of PETSc 
> (2.3.2p10) we had had to modify petscdef.h in order to comply with our 
> code. Indeed our code is written mainly in Fortran77 with its own memory 
> manager (it is 20 years old) and to take full advantage of architectures 
> with a lot of memory we need to compile it with -i8 option (intel compiler 
> syntax) so that integers are 64bits wide. We use PETSc as a solver with 
> this code.
> So PETSc was first compiled separetely in standard 32 bits mode, then the 
> PETSc Fortran interface to our code was compiled with the options -i8 and 
> it was messy (we encountered errors during initialization in MPI).
> Recently we updated to the latest 2.3.3 version and found out that you had 
> updated petscdef.h so that it defines correctly integer*4 and integer*8 
> when necessary. We didn't modify anything this time and it seems to work 
> OK. I looked closely at petscdef.h and saw that these two lines were the 
> only ones left as "integer", that's why I asked the question.

Yeah - we take care of the PETSc parts to be -i8 neutral - but leave
the MPI part unchanged . All this -i8 stuff is tricky - and it breaks
c/fortran interoperability. Its fine as long as its used in
*fortran-only* world.

If you need -i8 - ideally you should compile everything - MPI, PETSc
etc with this option. But I'm not sure if MPI part would work

If we set MPI_Comm to integer*4 in petscdef.h - and a fortran user
uses integer [intead of MPI_Comm] in his part of MPI code [which would
be valid usage as per MPI standard] - things will break with -i8.


More information about the petsc-dev mailing list