[petsc-users] PETSc Fortran 64-bit

Satish Balay balay at mcs.anl.gov
Wed Feb 1 14:11:14 CST 2023


Check petsc examples

You would use 'PetscErrorCode  ierr' - not 'INTEGER(4) or INTEGER(8)

Some routines probably don't have Interface definitions - hence compiler can't cat this issue with all functions.
[but they all consistently need PetscErrorCode]

Satish

On Wed, 1 Feb 2023, Mike Michell wrote:

> Hi all,
> 
> I want to use PETSc with 64-bit indices with a Fortran90 code. It seems
> some PETSc functions have no problem, but some of the others do not accept
> 32-bit error code integer (e.g., "ierr" declared as PetscErrorCode type).
> 
> For example,
> 
> call DMPlexGetChart(dm, pst, pend, ierr);CHKERRA(ierr)    works okay,
> 
> but
> 
> call DMPlexGetDepthStratum(dm, 0, vst, vend, ierr);CHKERRA(ierr)  gives an
> error regarding the datatype of ierr. The error basically leads:
> Error: Type mismatch in argument ‘b’ at (1); passed INTEGER(4) to INTEGER(8)
> 
> I tried to declare ierr as integer(kind=8) type, but there are still some
> problems. If PETSc is configured with 32-bit indices, the Fortran code
> works without problem.
> 
> What surprising to me is that as mentioned above, DMPlexGetChart() works
> okay, but  DMPlexGetDepthStratum() does not work with "ierr (PetscErrorCode
> type)" variable with 64-bit indices.
> 
> Can I get any comments on it?
> 
> Thanks,
> Mike
> 


More information about the petsc-users mailing list