PETSc-FUN3D Code
Satish Balay
balay at mcs.anl.gov
Mon Oct 22 13:40:55 CDT 2007
On Mon, 22 Oct 2007, Lisandro Dalcin wrote:
> Did you take into accout that MPI defines MPI_Aint for this? I believe
> we can reuse that definition, perhaps typedefing it as PetscAint or
> PetscAInt,
>
> What do you think?
MPI datatypes are c-only - hence not useful for us. For eg: MPI_Comm,
MPI_Aint are C datatypes. The equivalent on the fortran side are
integers. [I guess - the standard wanted to use only the available
native F77 datatypes].
This usually means there could be a mismatch between fortran & c
datatypes. [For eg: on 64bit machines, MPI_Aint is 64bit - whereas
fortran 'integer' is 32bit]. To handle this mismatch - conversion is
usually necessary between these types in the fortran interface
routines [using MPI_Fint as an equvalent for fortran integer] for eg:
MPI_Fint fcomm = MPI_Comm_c2f(MPI_Comm comm);
MPI_Fint foffset = (MPI_Fint)(MPI_Aint offset);
[i.e int = (int)(long) => possible truncation]
However we try to keep the fortan and C datatypes similar - so that
such conversions are not necessary. [and we don't have to deal will
errors associated with them]
Satish
More information about the petsc-dev
mailing list