[petsc-dev] MPI_UNSIGNED_LONG_LONG in mpiuni.h

Satish Balay balay at mcs.anl.gov
Thu Apr 25 13:25:35 CDT 2013


On Thu, 25 Apr 2013, Chetan Jhurani wrote:

> > -----Original Message-----
> > From: Jed Brown [mailto:five9a2 at gmail.com] On Behalf Of Jed Brown
> > Sent: Thursday, April 25, 2013 11:09 AM
> > To: Chetan Jhurani; 'For users of the development version of PETSc'
> > Subject: Re: [petsc-dev] MPI_UNSIGNED_LONG_LONG in mpiuni.h
> > 
> > Chetan Jhurani <chetan.jhurani at gmail.com> writes:
> > 
> > > Hi,
> > >
> > > mpiuni.h does not define MPI_UNSIGNED_LONG_LONG, which leads
> > > to a problem in defining MPIU_SIZE_T here in petscsys.h.
> > >
> > > #if (PETSC_SIZEOF_SIZE_T) == (PETSC_SIZEOF_INT)
> > > #define MPIU_SIZE_T MPI_UNSIGNED
> > > #elif  (PETSC_SIZEOF_SIZE_T) == (PETSC_SIZEOF_LONG)
> > > #define MPIU_SIZE_T MPI_UNSIGNED_LONG
> > > #elif  (PETSC_SIZEOF_SIZE_T) == (PETSC_SIZEOF_LONG_LONG)
> > > #define MPIU_SIZE_T MPI_UNSIGNED_LONG_LONG
> > 
> > mpiuni/mpi.h also has this unguarded statement.  Do all Windows
> > compilers now provide 'long long'?
> > 
> > #define MPI_LONG_LONG_INT    sizeof(long long)
> > 
> > We could make mpiuni define MPIU_SIZE_T itself instead of jumping
> > through hoops to find the matching type.
> > 
> > Chetan, what's your perspective about using stdint.h?
> 
> Info about long long:
> 
> Visual Studio 2005 supports long long (sizeof = 8)
> even when compiling in 32 bit mode, so I assume all
> later ones do.

For 64bit ints petscsys.h uses __int64 which is supported by VC6
aswell. So perhaps this should be used.

Satish

> 
> Trilinos 11.0+ uses long long for 64-bit indices.  I have tested
> it with two compilers (2005/2012) and I'm guessing others
> have used other versions.
> 
> About stdint.h:
> 
> I see that it is there with Visual Studio 2012 on
> my machine, but not with 2005.  Below is more info
> on stdint and MS VS.  I never had a need to use
> it so can't say more than this.
> 
> http://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio
> 
> Chetan
> 
> 
> 




More information about the petsc-dev mailing list