[petsc-dev] MPI_UNSIGNED_LONG_LONG in mpiuni.h

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


On Thu, 25 Apr 2013, Jed Brown wrote:

> 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)

Hm - perhaps its ok to have this unguarded and add:

diff --git a/include/mpiuni/mpi.h b/include/mpiuni/mpi.h
index 5adfe26..a6a4f97 100644
--- a/include/mpiuni/mpi.h
+++ b/include/mpiuni/mpi.h
@@ -168,6 +168,7 @@ typedef int    MPI_Offset;
 #define MPI_UNSIGNED         sizeof(unsigned)
 #define MPI_UNSIGNED_CHAR    sizeof(unsigned char)
 #define MPI_UNSIGNED_LONG    sizeof(unsigned long)
+#define MPI_UNSIGNED_LONG_LONG sizeof(unsigned long long)
 #define MPI_COMPLEX          2*sizeof(float)
 #define MPI_C_COMPLEX        2*sizeof(float)
 #define MPI_C_DOUBLE_COMPLEX 2*sizeof(double)


It won't get used in PETSc unless PETSC_SIZEOF_LONG_LONG is defined
[which is only for 64bit compilers that support 'long long' anyway.

satish

> 
> 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?
> 




More information about the petsc-dev mailing list