diff --git a/config/ompi_find_mpi_aint_count_offset.m4 b/config/ompi_find_mpi_aint_count_offset.m4 index d16bcc79766..9aee03e5f7d 100644 --- a/config/ompi_find_mpi_aint_count_offset.m4 +++ b/config/ompi_find_mpi_aint_count_offset.m4 @@ -15,7 +15,7 @@ # Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2014 Research Organization for Information Science +# Copyright (c) 2014-2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2015 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -42,14 +42,13 @@ AC_DEFUN([OMPI_FIND_MPI_AINT_COUNT_OFFSET],[ dnl ######################################################################### AC_DEFUN([_OMPI_FIND_MPI_AINT_TYPE], [ - # Find the type of MPI_Aint. We already did the work to figure - # out what opal_ptrdiff will be; just use that. + # MPI_Aint type is ptrdiff_t; just use that. AC_MSG_CHECKING([for type of MPI_Aint]) - MPI_AINT_TYPE=$opal_ptrdiff_t + MPI_AINT_TYPE=ptrdiff_t # Get the size of this type; we'll need it to figure out Fortran's # MPI_ADDRESS_KIND, later - MPI_AINT_SIZE=$opal_ptrdiff_size + MPI_AINT_SIZE=$ac_cv_sizeof_ptrdiff_t AC_DEFINE_UNQUOTED(OMPI_MPI_AINT_TYPE, [$MPI_AINT_TYPE], [Type of MPI_Aint]) diff --git a/configure.ac b/configure.ac index 9667a3b3a84..6102a28fbec 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. # Copyright (c) 2013-2017 Intel, Inc. All rights reserved. -# Copyright (c) 2014-2016 Research Organization for Information Science +# Copyright (c) 2014-2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # $COPYRIGHT$ @@ -420,6 +420,8 @@ if test "$ac_cv_type_ssize_t" = yes ; then fi if test "$ac_cv_type_ptrdiff_t" = yes; then AC_CHECK_SIZEOF(ptrdiff_t) +else + AC_MSG_ERROR([ptrdiff_t type is not available, this is required by C99 standard. Cannot continue]) fi AC_CHECK_SIZEOF(wchar_t) @@ -782,27 +784,6 @@ AC_INCLUDES_DEFAULT #endif ]) -# -# Check for ptrdiff type. Yes, there are platforms where -# sizeof(void*) != sizeof(long) (64 bit Windows, apparently). -# -AC_MSG_CHECKING([for pointer diff type]) -if test $ac_cv_type_ptrdiff_t = yes ; then - opal_ptrdiff_t="ptrdiff_t" - opal_ptrdiff_size=$ac_cv_sizeof_ptrdiff_t -elif test $ac_cv_sizeof_void_p -eq $ac_cv_sizeof_long ; then - opal_ptrdiff_t="long" - opal_ptrdiff_size=$ac_cv_sizeof_long -elif test $ac_cv_type_long_long = yes && test $ac_cv_sizeof_void_p -eq $ac_cv_sizeof_long_long ; then - opal_ptrdiff_t="long long" - opal_ptrdiff_size=$ac_cv_sizeof_long_long -else - AC_MSG_ERROR([Could not find datatype to emulate ptrdiff_t. Cannot continue]) -fi -AC_DEFINE_UNQUOTED([OPAL_PTRDIFF_TYPE], [$opal_ptrdiff_t], - [type to use for ptrdiff_t]) -AC_MSG_RESULT([$opal_ptrdiff_t (size: $opal_ptrdiff_size)]) - # # Find corresponding types for MPI_Aint, MPI_Count, and MPI_Offset. # And if relevant, find the corresponding MPI_ADDRESS_KIND, diff --git a/ompi/datatype/ompi_datatype.h b/ompi/datatype/ompi_datatype.h index 15284f1fd3c..a87a8bdde38 100644 --- a/ompi/datatype/ompi_datatype.h +++ b/ompi/datatype/ompi_datatype.h @@ -7,7 +7,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -167,7 +167,7 @@ OMPI_DECLSPEC int32_t ompi_datatype_destroy( ompi_datatype_t** type); */ static inline int32_t ompi_datatype_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, uint32_t count, - OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ) + ptrdiff_t disp, ptrdiff_t extent ) { return opal_datatype_add( &pdtBase->super, &pdtAdd->super, count, disp, extent ); } @@ -178,17 +178,17 @@ ompi_datatype_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newTy OMPI_DECLSPEC int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); OMPI_DECLSPEC int32_t ompi_datatype_create_vector( int count, int bLength, int stride, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, +OMPI_DECLSPEC int32_t ompi_datatype_create_hvector( int count, int bLength, ptrdiff_t stride, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); OMPI_DECLSPEC int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); OMPI_DECLSPEC int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const OPAL_PTRDIFF_TYPE* pDisp, +OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +OMPI_DECLSPEC int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp, ompi_datatype_t* const* pTypes, ompi_datatype_t** newType ); OMPI_DECLSPEC int32_t ompi_datatype_create_darray( int size, int rank, int ndims, int const* gsize_array, int const* distrib_array, int const* darg_array, @@ -199,8 +199,8 @@ OMPI_DECLSPEC int32_t ompi_datatype_create_subarray(int ndims, int const* size_a const ompi_datatype_t* oldtype, ompi_datatype_t** newtype); static inline int32_t ompi_datatype_create_resized( const ompi_datatype_t* oldType, - OPAL_PTRDIFF_TYPE lb, - OPAL_PTRDIFF_TYPE extent, + ptrdiff_t lb, + ptrdiff_t extent, ompi_datatype_t** newType ) { ompi_datatype_t * type; @@ -214,13 +214,13 @@ ompi_datatype_create_resized( const ompi_datatype_t* oldType, } static inline int32_t -ompi_datatype_type_lb( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp ) +ompi_datatype_type_lb( const ompi_datatype_t* type, ptrdiff_t* disp ) { return opal_datatype_type_lb(&type->super, disp); } static inline int32_t -ompi_datatype_type_ub( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp ) +ompi_datatype_type_ub( const ompi_datatype_t* type, ptrdiff_t* disp ) { return opal_datatype_type_ub( &type->super, disp); } @@ -232,19 +232,19 @@ ompi_datatype_type_size ( const ompi_datatype_t* type, size_t *size ) } static inline int32_t -ompi_datatype_type_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* extent ) +ompi_datatype_type_extent( const ompi_datatype_t* type, ptrdiff_t* extent ) { return opal_datatype_type_extent( &type->super, extent); } static inline int32_t -ompi_datatype_get_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* lb, OPAL_PTRDIFF_TYPE* extent) +ompi_datatype_get_extent( const ompi_datatype_t* type, ptrdiff_t* lb, ptrdiff_t* extent) { return opal_datatype_get_extent( &type->super, lb, extent); } static inline int32_t -ompi_datatype_get_true_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* true_lb, OPAL_PTRDIFF_TYPE* true_extent) +ompi_datatype_get_true_extent( const ompi_datatype_t* type, ptrdiff_t* true_lb, ptrdiff_t* true_extent) { return opal_datatype_get_true_extent( &type->super, true_lb, true_extent); } @@ -266,7 +266,7 @@ ompi_datatype_copy_content_same_ddt( const ompi_datatype_t* type, size_t count, char* pDestBuf, char* pSrcBuf ) { int32_t length, rc; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; ompi_datatype_type_extent( type, &extent ); while( 0 != count ) { @@ -295,11 +295,11 @@ OMPI_DECLSPEC int32_t ompi_datatype_sndrcv( const void *sbuf, int32_t scount, co */ OMPI_DECLSPEC int32_t ompi_datatype_get_args( const ompi_datatype_t* pData, int32_t which, int32_t * ci, int32_t * i, - int32_t * ca, OPAL_PTRDIFF_TYPE* a, + int32_t * ca, ptrdiff_t* a, int32_t * cd, ompi_datatype_t** d, int32_t * type); OMPI_DECLSPEC int32_t ompi_datatype_set_args( ompi_datatype_t* pData, int32_t ci, const int32_t ** i, - int32_t ca, const OPAL_PTRDIFF_TYPE* a, + int32_t ca, const ptrdiff_t* a, int32_t cd, ompi_datatype_t* const * d,int32_t type); OMPI_DECLSPEC int32_t ompi_datatype_copy_args( const ompi_datatype_t* source_data, ompi_datatype_t* dest_data ); diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index 7cf2d2eebe0..f6c0851e59e 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -13,7 +13,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -40,7 +40,7 @@ static inline int __ompi_datatype_pack_description( ompi_datatype_t* datatype, void** packed_buffer, int* next_index ); static ompi_datatype_t* -__ompi_datatype_create_from_args( int32_t* i, OPAL_PTRDIFF_TYPE * a, +__ompi_datatype_create_from_args( int32_t* i, ptrdiff_t * a, ompi_datatype_t** d, int32_t type ); typedef struct __dt_args { @@ -51,7 +51,7 @@ typedef struct __dt_args { int32_t ca; int32_t cd; int* i; - OPAL_PTRDIFF_TYPE* a; + ptrdiff_t* a; ompi_datatype_t** d; } ompi_datatype_args_t; @@ -65,7 +65,7 @@ typedef struct __dt_args { */ #if OPAL_ALIGN_WORD_SIZE_INTEGERS #define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE) \ - (PTR) = OPAL_ALIGN_PTR((PTR), sizeof(OPAL_PTRDIFF_TYPE), TYPE) + (PTR) = OPAL_ALIGN_PTR((PTR), sizeof(ptrdiff_t), TYPE) #else #define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE) #endif /* OPAL_ALIGN_WORD_SIZE_INTEGERS */ @@ -80,7 +80,7 @@ typedef struct __dt_args { #define ALLOC_ARGS(PDATA, IC, AC, DC) \ do { \ int length = sizeof(ompi_datatype_args_t) + (IC) * sizeof(int) + \ - (AC) * sizeof(OPAL_PTRDIFF_TYPE) + (DC) * sizeof(MPI_Datatype); \ + (AC) * sizeof(ptrdiff_t) + (DC) * sizeof(MPI_Datatype); \ char* buf = (char*)malloc( length ); \ ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf; \ pArgs->ci = (IC); \ @@ -89,8 +89,8 @@ typedef struct __dt_args { buf += sizeof(ompi_datatype_args_t); \ if( pArgs->ca == 0 ) pArgs->a = NULL; \ else { \ - pArgs->a = (OPAL_PTRDIFF_TYPE*)buf; \ - buf += pArgs->ca * sizeof(OPAL_PTRDIFF_TYPE); \ + pArgs->a = (ptrdiff_t*)buf; \ + buf += pArgs->ca * sizeof(ptrdiff_t); \ } \ if( pArgs->cd == 0 ) pArgs->d = NULL; \ else { \ @@ -101,7 +101,7 @@ typedef struct __dt_args { else pArgs->i = (int*)buf; \ pArgs->ref_count = 1; \ pArgs->total_pack_size = (4 + (IC) + (DC)) * sizeof(int) + \ - (AC) * sizeof(OPAL_PTRDIFF_TYPE); \ + (AC) * sizeof(ptrdiff_t); \ (PDATA)->args = (void*)pArgs; \ (PDATA)->packed_description = NULL; \ } while(0) @@ -109,7 +109,7 @@ typedef struct __dt_args { int32_t ompi_datatype_set_args( ompi_datatype_t* pData, int32_t ci, const int32_t** i, - int32_t ca, const OPAL_PTRDIFF_TYPE* a, + int32_t ca, const ptrdiff_t* a, int32_t cd, ompi_datatype_t* const * d, int32_t type) { int pos; @@ -220,9 +220,9 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData, break; } - /* copy the array of MPI_Aint, aka OPAL_PTRDIFF_TYPE */ + /* copy the array of MPI_Aint, aka ptrdiff_t */ if( pArgs->a != NULL ) - memcpy( pArgs->a, a, ca * sizeof(OPAL_PTRDIFF_TYPE) ); + memcpy( pArgs->a, a, ca * sizeof(ptrdiff_t) ); for( pos = 0; pos < cd; pos++ ) { pArgs->d[pos] = d[pos]; @@ -317,7 +317,7 @@ int32_t ompi_datatype_print_args( const ompi_datatype_t* pData ) int32_t ompi_datatype_get_args( const ompi_datatype_t* pData, int32_t which, int32_t* ci, int32_t* i, - int32_t* ca, OPAL_PTRDIFF_TYPE* a, + int32_t* ca, ptrdiff_t* a, int32_t* cd, ompi_datatype_t** d, int32_t* type) { ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args; @@ -354,7 +354,7 @@ int32_t ompi_datatype_get_args( const ompi_datatype_t* pData, int32_t which, memcpy( i, pArgs->i, pArgs->ci * sizeof(int) ); } if( (NULL != a) && (NULL != pArgs->a) ) { - memcpy( a, pArgs->a, pArgs->ca * sizeof(OPAL_PTRDIFF_TYPE) ); + memcpy( a, pArgs->a, pArgs->ca * sizeof(ptrdiff_t) ); } if( (NULL != d) && (NULL != pArgs->d) ) { memcpy( d, pArgs->d, pArgs->cd * sizeof(MPI_Datatype) ); @@ -449,8 +449,8 @@ static inline int __ompi_datatype_pack_description( ompi_datatype_t* datatype, /* description of the displacements must be 64 bits aligned */ OMPI_DATATYPE_ALIGN_PTR(next_packed, char*); - memcpy( next_packed, args->a, sizeof(OPAL_PTRDIFF_TYPE) * args->ca ); - next_packed += sizeof(OPAL_PTRDIFF_TYPE) * args->ca; + memcpy( next_packed, args->a, sizeof(ptrdiff_t) * args->ca ); + next_packed += sizeof(ptrdiff_t) * args->ca; } position = (int*)next_packed; next_packed += sizeof(int) * args->cd; @@ -557,7 +557,7 @@ static ompi_datatype_t* __ompi_datatype_create_from_packed_description( void** p int* position; ompi_datatype_t* datatype = NULL; ompi_datatype_t** array_of_datatype; - OPAL_PTRDIFF_TYPE* array_of_disp; + ptrdiff_t* array_of_disp; int* array_of_length; int number_of_length, number_of_disp, number_of_datatype, data_id; int create_type, i; @@ -609,13 +609,13 @@ static ompi_datatype_t* __ompi_datatype_create_from_packed_description( void** p next_buffer += (4 * sizeof(int)); /* move after the header */ /* description of the displacements (if ANY !) should always be aligned - on MPI_Aint, aka OPAL_PTRDIFF_TYPE */ + on MPI_Aint, aka ptrdiff_t */ if (number_of_disp > 0) { OMPI_DATATYPE_ALIGN_PTR(next_buffer, char*); } - array_of_disp = (OPAL_PTRDIFF_TYPE*)next_buffer; - next_buffer += number_of_disp * sizeof(OPAL_PTRDIFF_TYPE); + array_of_disp = (ptrdiff_t*)next_buffer; + next_buffer += number_of_disp * sizeof(ptrdiff_t); /* the other datatypes */ position = (int*)next_buffer; next_buffer += number_of_datatype * sizeof(int); diff --git a/ompi/datatype/ompi_datatype_create_indexed.c b/ompi/datatype/ompi_datatype_create_indexed.c index 9311eac7972..50c521b7bf9 100644 --- a/ompi/datatype/ompi_datatype_create_indexed.c +++ b/ompi/datatype/ompi_datatype_create_indexed.c @@ -13,7 +13,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -35,7 +35,7 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const { ompi_datatype_t* pdt; int i, dLength, endat, disp; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; if( 0 == count ) { return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); @@ -66,12 +66,12 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const } -int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; int i, dLength; - OPAL_PTRDIFF_TYPE extent, disp, endat; + ptrdiff_t extent, disp, endat; if( 0 == count ) { *newType = ompi_datatype_create( 0 ); @@ -109,7 +109,7 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p { ompi_datatype_t* pdt; int i, dLength, endat, disp; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { @@ -143,12 +143,12 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p return OMPI_SUCCESS; } -int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const OPAL_PTRDIFF_TYPE* pDisp, +int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; int i, dLength; - OPAL_PTRDIFF_TYPE extent, disp, endat; + ptrdiff_t extent, disp, endat; ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { diff --git a/ompi/datatype/ompi_datatype_create_struct.c b/ompi/datatype/ompi_datatype_create_struct.c index e2457d16ec9..98daa8bacbb 100644 --- a/ompi/datatype/ompi_datatype_create_struct.c +++ b/ompi/datatype/ompi_datatype_create_struct.c @@ -13,6 +13,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,11 +28,11 @@ #include "ompi/datatype/ompi_datatype.h" -int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp, ompi_datatype_t* const * pTypes, ompi_datatype_t** newType ) { int i; - OPAL_PTRDIFF_TYPE disp = 0, endto, lastExtent, lastDisp; + ptrdiff_t disp = 0, endto, lastExtent, lastDisp; int lastBlock; ompi_datatype_t *pdt, *lastType; diff --git a/ompi/datatype/ompi_datatype_create_vector.c b/ompi/datatype/ompi_datatype_create_vector.c index c899f1d9028..2faa06b4aa4 100644 --- a/ompi/datatype/ompi_datatype_create_vector.c +++ b/ompi/datatype/ompi_datatype_create_vector.c @@ -13,6 +13,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,7 +38,7 @@ int32_t ompi_datatype_create_vector( int count, int bLength, int stride, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t *pTempData, *pData; - OPAL_PTRDIFF_TYPE extent = oldType->super.ub - oldType->super.lb; + ptrdiff_t extent = oldType->super.ub - oldType->super.lb; if( 0 == count ) { @@ -64,11 +66,11 @@ int32_t ompi_datatype_create_vector( int count, int bLength, int stride, } -int32_t ompi_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, +int32_t ompi_datatype_create_hvector( int count, int bLength, ptrdiff_t stride, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t *pTempData, *pData; - OPAL_PTRDIFF_TYPE extent = oldType->super.ub - oldType->super.lb; + ptrdiff_t extent = oldType->super.ub - oldType->super.lb; if( 0 == count ) { *newType = ompi_datatype_create( 0 ); diff --git a/ompi/datatype/ompi_datatype_get_elements.c b/ompi/datatype/ompi_datatype_get_elements.c index 0c1f8a7b842..72ac87d6df7 100644 --- a/ompi/datatype/ompi_datatype_get_elements.c +++ b/ompi/datatype/ompi_datatype_get_elements.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -25,6 +25,7 @@ #include "ompi/runtime/params.h" #include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" int ompi_datatype_get_elements (ompi_datatype_t *datatype, size_t ucount, size_t *count) { @@ -48,9 +49,10 @@ int ompi_datatype_get_elements (ompi_datatype_t *datatype, size_t ucount, size_t there are no leftover bytes */ if (!ompi_datatype_is_predefined(datatype)) { if (0 != internal_count) { + opal_datatype_compute_ptypes(&datatype->super); /* count the basic elements in the datatype */ - for (i = 4, total = 0 ; i < OPAL_DATATYPE_MAX_PREDEFINED ; ++i) { - total += datatype->super.btypes[i]; + for (i = OPAL_DATATYPE_FIRST_TYPE, total = 0 ; i < OPAL_DATATYPE_MAX_PREDEFINED ; ++i) { + total += datatype->super.ptypes[i]; } internal_count = total * internal_count; } diff --git a/ompi/datatype/ompi_datatype_internal.h b/ompi/datatype/ompi_datatype_internal.h index 76485370dfa..4ab5cc14020 100644 --- a/ompi/datatype/ompi_datatype_internal.h +++ b/ompi/datatype/ompi_datatype_internal.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2009-2013 The University of Tennessee and The University + * Copyright (c) 2009-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. @@ -465,7 +465,7 @@ extern const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX .name = OPAL_DATATYPE_INIT_NAME(TYPE ## SIZE), \ .desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(TYPE ## SIZE), \ .opt_desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(TYPE ## SIZE), \ - .btypes = OPAL_DATATYPE_INIT_BTYPES_ARRAY(TYPE ## SIZE) \ + .ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY(TYPE ## SIZE) \ } #define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ diff --git a/ompi/datatype/ompi_datatype_module.c b/ompi/datatype/ompi_datatype_module.c index fb5a09e9072..dc2e98f4b85 100644 --- a/ompi/datatype/ompi_datatype_module.c +++ b/ompi/datatype/ompi_datatype_module.c @@ -15,7 +15,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -384,8 +384,9 @@ opal_pointer_array_t ompi_datatype_f_to_c_table = {{0}}; (PDST)->super.opt_desc = (PSRC)->super.opt_desc; \ (PDST)->packed_description = (PSRC)->packed_description; \ (PSRC)->packed_description = NULL; \ - memcpy( (PDST)->super.btypes, (PSRC)->super.btypes, \ - OPAL_DATATYPE_MAX_PREDEFINED * sizeof(uint32_t) ); \ + /* transfer the ptypes */ \ + (PDST)->super.ptypes = (PSRC)->super.ptypes; \ + (PSRC)->super.ptypes = NULL; \ } while(0) #define DECLARE_MPI2_COMPOSED_STRUCT_DDT( PDATA, MPIDDT, MPIDDTNAME, type1, type2, MPIType1, MPIType2, FLAGS) \ @@ -393,20 +394,20 @@ opal_pointer_array_t ompi_datatype_f_to_c_table = {{0}}; struct { type1 v1; type2 v2; } s[2]; \ ompi_datatype_t *types[2], *ptype; \ int bLength[2] = {1, 1}; \ - OPAL_PTRDIFF_TYPE base, displ[2]; \ + ptrdiff_t base, displ[2]; \ \ types[0] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[MPIType1]; \ types[1] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[MPIType2]; \ - base = (OPAL_PTRDIFF_TYPE)(&(s[0])); \ - displ[0] = (OPAL_PTRDIFF_TYPE)(&(s[0].v1)); \ + base = (ptrdiff_t)(&(s[0])); \ + displ[0] = (ptrdiff_t)(&(s[0].v1)); \ displ[0] -= base; \ - displ[1] = (OPAL_PTRDIFF_TYPE)(&(s[0].v2)); \ + displ[1] = (ptrdiff_t)(&(s[0].v2)); \ displ[1] -= base; \ \ ompi_datatype_create_struct( 2, bLength, displ, types, &ptype ); \ - displ[0] = (OPAL_PTRDIFF_TYPE)(&(s[1])); \ + displ[0] = (ptrdiff_t)(&(s[1])); \ displ[0] -= base; \ - if( displ[0] != (displ[1] + (OPAL_PTRDIFF_TYPE)sizeof(type2)) ) \ + if( displ[0] != (displ[1] + (ptrdiff_t)sizeof(type2)) ) \ ptype->super.ub = displ[0]; /* force a new extent for the datatype */ \ ptype->super.flags |= (FLAGS); \ ptype->id = MPIDDT; \ @@ -628,7 +629,7 @@ int32_t ompi_datatype_init( void ) for( i = 0; i < ompi_mpi_count.dt.d_f_to_c_index; i++ ) { opal_datatype_t* datatype = (opal_datatype_t*)opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, i ); - if( (datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size ) { + if( (datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size ) { datatype->flags |= OPAL_DATATYPE_FLAG_NO_GAPS; } else { datatype->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; @@ -737,7 +738,7 @@ void ompi_datatype_dump( const ompi_datatype_t* pData ) (long)pData->super.size, (int)pData->super.align, pData->super.id, (int)pData->super.desc.length, (int)pData->super.desc.used, (long)pData->super.true_lb, (long)pData->super.true_ub, (long)(pData->super.true_ub - pData->super.true_lb), (long)pData->super.lb, (long)pData->super.ub, (long)(pData->super.ub - pData->super.lb), - (int)pData->super.nbElems, (int)pData->super.btypes[OPAL_DATATYPE_LOOP], (int)pData->super.flags ); + (int)pData->super.nbElems, (int)pData->super.loops, (int)pData->super.flags ); /* dump the flags */ if( ompi_datatype_is_predefined(pData) ) { index += snprintf( buffer + index, length - index, "predefined " ); diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index f9d21c636b1..07e1845faf2 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -17,7 +17,7 @@ * reserved. * Copyright (c) 2011-2013 INRIA. All rights reserved. * Copyright (c) 2015 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -158,7 +158,7 @@ #undef OMPI_MPI_COUNT_TYPE /* type to use for ptrdiff_t, if it does not exist, set to ptrdiff_t if it does exist */ -#undef OPAL_PTRDIFF_TYPE +#undef ptrdiff_t /* Whether we want MPI cxx support or not */ #undef OMPI_BUILD_CXX_BINDINGS diff --git a/ompi/include/ompi/memchecker.h b/ompi/include/ompi/memchecker.h index 90a89199353..a56f065c364 100644 --- a/ompi/include/ompi/memchecker.h +++ b/ompi/include/ompi/memchecker.h @@ -6,7 +6,7 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * @@ -353,10 +353,10 @@ static inline int memchecker_datatype(MPI_Datatype type) opal_memchecker_base_isdefined (&type->super.id, sizeof(uint16_t)); opal_memchecker_base_isdefined (&type->super.bdt_used, sizeof(uint32_t)); opal_memchecker_base_isdefined (&type->super.size, sizeof(size_t)); - opal_memchecker_base_isdefined (&type->super.true_lb, sizeof(OPAL_PTRDIFF_T)); - opal_memchecker_base_isdefined (&type->super.true_ub, sizeof(OPAL_PTRDIFF_T)); - opal_memchecker_base_isdefined (&type->super.lb, sizeof(OPAL_PTRDIFF_T)); - opal_memchecker_base_isdefined (&type->super.ub, sizeof(OPAL_PTRDIFF_T)); + opal_memchecker_base_isdefined (&type->super.true_lb, sizeof(ptrdiff_t)); + opal_memchecker_base_isdefined (&type->super.true_ub, sizeof(ptrdiff_t)); + opal_memchecker_base_isdefined (&type->super.lb, sizeof(ptrdiff_t)); + opal_memchecker_base_isdefined (&type->super.ub, sizeof(ptrdiff_t)); opal_memchecker_base_isdefined (&type->super.align, sizeof(uint32_t)); opal_memchecker_base_isdefined (&type->super.nbElems, sizeof(uint32_t)); /* name... */ @@ -366,7 +366,8 @@ static inline int memchecker_datatype(MPI_Datatype type) opal_memchecker_base_isdefined (&type->super.opt_desc.length, sizeof(opal_datatype_count_t)); opal_memchecker_base_isdefined (&type->super.opt_desc.used, sizeof(opal_datatype_count_t)); opal_memchecker_base_isdefined (&type->super.opt_desc.desc, sizeof(dt_elem_desc_t *)); - opal_memchecker_base_isdefined (&type->super.btypes, OPAL_DATATYPE_MAX_PREDEFINED * sizeof(uint32_t)); + if( NULL != type->super.ptypes ) + opal_memchecker_base_isdefined (&type->super.ptypes, OPAL_DATATYPE_MAX_PREDEFINED * sizeof(size_t)); opal_memchecker_base_isdefined (&type->id, sizeof(int32_t)); opal_memchecker_base_isdefined (&type->d_f_to_c_index, sizeof(int32_t)); diff --git a/ompi/mca/coll/base/coll_base_allreduce.c b/ompi/mca/coll/base/coll_base_allreduce.c index d05235ccca5..3ff451e39d9 100644 --- a/ompi/mca/coll/base/coll_base_allreduce.c +++ b/ompi/mca/coll/base/coll_base_allreduce.c @@ -13,7 +13,7 @@ * Copyright (c) 2009 University of Houston. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All Rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -136,7 +136,7 @@ ompi_coll_base_allreduce_intra_recursivedoubling(const void *sbuf, void *rbuf, int newrank, newremote, extra_ranks; char *tmpsend = NULL, *tmprecv = NULL, *tmpswap = NULL, *inplacebuf_free = NULL, *inplacebuf; ompi_request_t *reqs[2] = {NULL, NULL}; - OPAL_PTRDIFF_TYPE span, gap; + ptrdiff_t span, gap; size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); @@ -630,7 +630,7 @@ ompi_coll_base_allreduce_intra_ring_segmented(const void *sbuf, void *rbuf, int char *tmpsend = NULL, *tmprecv = NULL, *inbuf[2] = {NULL, NULL}; ptrdiff_t block_offset, max_real_segsize; ompi_request_t *reqs[2] = {NULL, NULL}; - OPAL_PTRDIFF_TYPE lb, extent, gap; + ptrdiff_t lb, extent, gap; size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); diff --git a/ompi/mca/coll/base/coll_base_alltoall.c b/ompi/mca/coll/base/coll_base_alltoall.c index 676c12612b2..2c823b2f5aa 100644 --- a/ompi/mca/coll/base/coll_base_alltoall.c +++ b/ompi/mca/coll/base/coll_base_alltoall.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All Rights * reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -42,7 +42,7 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount, mca_coll_base_module_t *module) { int i, j, size, rank, err = MPI_SUCCESS, line; - OPAL_PTRDIFF_TYPE ext, gap; + ptrdiff_t ext, gap; ompi_request_t *req; char *allocated_buffer = NULL, *tmp_buffer; size_t max_size; @@ -197,7 +197,7 @@ int ompi_coll_base_alltoall_intra_bruck(const void *sbuf, int scount, int i, k, line = -1, rank, size, err = 0; int sendto, recvfrom, distance, *displs = NULL, *blen = NULL; char *tmpbuf = NULL, *tmpbuf_free = NULL; - OPAL_PTRDIFF_TYPE sext, rext, span, gap; + ptrdiff_t sext, rext, span, gap; struct ompi_datatype_t *new_ddt; if (MPI_IN_PLACE == sbuf) { diff --git a/ompi/mca/coll/base/coll_base_alltoallv.c b/ompi/mca/coll/base/coll_base_alltoallv.c index d74ebb5f016..bc98c15cf87 100644 --- a/ompi/mca/coll/base/coll_base_alltoallv.c +++ b/ompi/mca/coll/base/coll_base_alltoallv.c @@ -14,7 +14,7 @@ * Copyright (c) 2013 Los Alamos National Security, LLC. All Rights * reserved. * Copyright (c) 2013 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -46,7 +46,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts ompi_request_t *req; char *allocated_buffer, *tmp_buffer; size_t max_size, rdtype_size; - OPAL_PTRDIFF_TYPE ext, gap = 0; + ptrdiff_t ext, gap = 0; /* Initialize. */ diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index a1d98ec33b6..3c763db427d 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -57,7 +57,7 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M struct mca_coll_base_module_2_2_0_t *module) { int rank, p, res; - OPAL_PTRDIFF_TYPE ext, lb; + ptrdiff_t ext, lb; NBC_Schedule *schedule; size_t size; #ifdef NBC_CACHE_SCHEDULE diff --git a/ompi/mca/coll/libnbc/nbc_internal.h b/ompi/mca/coll/libnbc/nbc_internal.h index b463a20afd1..f1e245e76fd 100644 --- a/ompi/mca/coll/libnbc/nbc_internal.h +++ b/ompi/mca/coll/libnbc/nbc_internal.h @@ -10,7 +10,7 @@ * * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. @@ -539,7 +539,7 @@ static inline int NBC_Copy(const void *src, int srccount, MPI_Datatype srctype, static inline int NBC_Unpack(void *src, int srccount, MPI_Datatype srctype, void *tgt, MPI_Comm comm) { int size, pos, res; - OPAL_PTRDIFF_TYPE ext, lb; + ptrdiff_t ext, lb; #if OPAL_CUDA_SUPPORT if(NBC_Type_intrinsic(srctype) && !(opal_cuda_check_bufs((char *)tgt, (char *)src))) { diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index 8aa809a2581..38505ed0c2d 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -400,7 +400,7 @@ int mca_common_ompio_set_file_defaults (mca_io_ompio_file_t *fh) if (NULL != fh) { ompi_datatype_t *types[2]; int blocklen[2] = {1, 1}; - OPAL_PTRDIFF_TYPE d[2], base; + ptrdiff_t d[2], base; int i; fh->f_io_array = NULL; @@ -446,8 +446,8 @@ int mca_common_ompio_set_file_defaults (mca_io_ompio_file_t *fh) types[0] = &ompi_mpi_long.dt; types[1] = &ompi_mpi_long.dt; - d[0] = (OPAL_PTRDIFF_TYPE) fh->f_decoded_iov; - d[1] = (OPAL_PTRDIFF_TYPE) &fh->f_decoded_iov[0].iov_len; + d[0] = (ptrdiff_t) fh->f_decoded_iov; + d[1] = (ptrdiff_t) &fh->f_decoded_iov[0].iov_len; base = d[0]; for (i=0 ; i<2 ; i++) { diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index 43b42ee72eb..0512f9bce70 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -63,7 +65,7 @@ int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, mca_io_ompio_contg *contg_groups; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb, ub; + ptrdiff_t ftype_extent, lb, ub; ompi_datatype_t *newfiletype; if ( NULL != fh->f_etype ) { @@ -101,7 +103,7 @@ int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, if ( etype == filetype && ompi_datatype_is_predefined (filetype ) && - ftype_extent == (OPAL_PTRDIFF_TYPE)ftype_size ){ + ftype_extent == (ptrdiff_t)ftype_size ){ ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE, &ompi_mpi_byte.dt, &newfiletype); @@ -139,7 +141,7 @@ int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, if (opal_datatype_is_contiguous_memory_layout(&etype->super,1)) { if (opal_datatype_is_contiguous_memory_layout(&filetype->super,1) && - fh->f_view_extent == (OPAL_PTRDIFF_TYPE)fh->f_view_size ) { + fh->f_view_extent == (ptrdiff_t)fh->f_view_size ) { fh->f_flags |= OMPIO_CONTIGUOUS_FVIEW; } } @@ -196,7 +198,7 @@ int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, if ( etype == filetype && ompi_datatype_is_predefined (filetype ) && - ftype_extent == (OPAL_PTRDIFF_TYPE)ftype_size ){ + ftype_extent == (ptrdiff_t)ftype_size ){ ompi_datatype_destroy ( &newfiletype ); } diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index 97fe28671f8..fc0ccb8607c 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -329,7 +329,7 @@ int mca_common_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cy size_t bytes_per_cycle, int max_data, uint32_t iov_count, struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw ) { - OPAL_PTRDIFF_TYPE disp; + ptrdiff_t disp; int block = 1; size_t total_bytes_written = *tbw; /* total bytes that have been written*/ size_t bytes_to_write_in_cycle = 0; /* left to be written in a cycle*/ @@ -374,7 +374,7 @@ int mca_common_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cy i = i + 1; } - disp = (OPAL_PTRDIFF_TYPE)decoded_iov[i].iov_base + + disp = (ptrdiff_t)decoded_iov[i].iov_base + (total_bytes_written - sum_previous_counts); fh->f_io_array[k].memory_address = (IOVBASE_TYPE *)disp; @@ -404,7 +404,7 @@ int mca_common_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cy } } - disp = (OPAL_PTRDIFF_TYPE)fh->f_decoded_iov[j].iov_base + + disp = (ptrdiff_t)fh->f_decoded_iov[j].iov_base + (fh->f_total_bytes - sum_previous_length); fh->f_io_array[k].offset = (IOVBASE_TYPE *)(intptr_t)(disp + fh->f_offset); diff --git a/ompi/mca/fbtl/posix/fbtl_posix_preadv.c b/ompi/mca/fbtl/posix/fbtl_posix_preadv.c index 27dc589ee0a..f99e93348cc 100644 --- a/ompi/mca/fbtl/posix/fbtl_posix_preadv.c +++ b/ompi/mca/fbtl/posix/fbtl_posix_preadv.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -69,7 +69,7 @@ ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh ) if (fh->f_num_of_io_entries != i+1) { if (((((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset + - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) == + (ptrdiff_t)fh->f_io_array[i].length) == (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset)) && (iov_count < IOV_MAX ) ){ iov[iov_count].iov_base = diff --git a/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c b/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c index fbf69489ff8..5ed6574a5b8 100644 --- a/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c +++ b/ompi/mca/fbtl/posix/fbtl_posix_pwritev.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -71,7 +71,7 @@ ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh ) if (fh->f_num_of_io_entries != i+1) { if ( (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset + - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) == + (ptrdiff_t)fh->f_io_array[i].length) == (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset) && (iov_count < IOV_MAX )) { iov[iov_count].iov_base = diff --git a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_preadv.c b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_preadv.c index 61e9e2460c7..362c6e789b3 100644 --- a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_preadv.c +++ b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_preadv.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -54,7 +56,7 @@ ssize_t mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *fh) for (i=0 ; if_num_of_io_entries ; i++) { if (fh->f_num_of_io_entries != i+1) { if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset + - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) == + (ptrdiff_t)fh->f_io_array[i].length) == (OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i+1].offset) { if (!merge) { merge_offset = (OMPI_MPI_OFFSET_TYPE) diff --git a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_pwritev.c b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_pwritev.c index 31c5b46c5df..cd7c846169c 100644 --- a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_pwritev.c +++ b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2_pwritev.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -55,7 +57,7 @@ ssize_t mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *fh ) for (i=0 ; if_num_of_io_entries ; i++) { if (fh->f_num_of_io_entries != i+1) { if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset + - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) == + (ptrdiff_t)fh->f_io_array[i].length) == (OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i+1].offset) { if (!merge) { merge_offset = (OMPI_MPI_OFFSET_TYPE) diff --git a/ompi/mca/fcoll/base/fcoll_base_coll_array.c b/ompi/mca/fcoll/base/fcoll_base_coll_array.c index 4b334f13310..573094dd1b9 100644 --- a/ompi/mca/fcoll/base/fcoll_base_coll_array.c +++ b/ompi/mca/fcoll/base/fcoll_base_coll_array.c @@ -11,6 +11,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +47,7 @@ int fcoll_base_coll_allgatherv_array (void *sbuf, ompi_communicator_t *comm) { int err = OMPI_SUCCESS; - OPAL_PTRDIFF_TYPE extent, lb; + ptrdiff_t extent, lb; int i, rank, j; char *send_buf = NULL; struct ompi_datatype_t *newtype, *send_type; @@ -130,7 +132,7 @@ int fcoll_base_coll_gatherv_array (void *sbuf, int i, rank; int err = OMPI_SUCCESS; char *ptmp; - OPAL_PTRDIFF_TYPE extent, lb; + ptrdiff_t extent, lb; ompi_request_t **reqs=NULL; rank = ompi_comm_rank (comm); @@ -219,7 +221,7 @@ int fcoll_base_coll_scatterv_array (void *sbuf, int i, rank; int err = OMPI_SUCCESS; char *ptmp; - OPAL_PTRDIFF_TYPE extent, lb; + ptrdiff_t extent, lb; ompi_request_t ** reqs=NULL; rank = ompi_comm_rank (comm); @@ -307,7 +309,7 @@ int fcoll_base_coll_allgather_array (void *sbuf, { int err = OMPI_SUCCESS; int rank; - OPAL_PTRDIFF_TYPE extent, lb; + ptrdiff_t extent, lb; rank = ompi_comm_rank (comm); @@ -361,8 +363,8 @@ int fcoll_base_coll_gather_array (void *sbuf, int i; int rank; char *ptmp; - OPAL_PTRDIFF_TYPE incr; - OPAL_PTRDIFF_TYPE extent, lb; + ptrdiff_t incr; + ptrdiff_t extent, lb; int err = OMPI_SUCCESS; ompi_request_t ** reqs=NULL; diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c index 4e3c7c73277..ae719059711 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2015 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -97,7 +99,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, int my_aggregator =-1; bool recvbuf_is_contiguous=false; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb; + ptrdiff_t ftype_extent, lb; #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN @@ -114,7 +116,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, opal_datatype_type_size ( &datatype->super, &ftype_size ); opal_datatype_get_extent ( &datatype->super, &lb, &ftype_extent ); - if ( (ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) && + if ( (ftype_extent == (ptrdiff_t) ftype_size) && opal_datatype_is_contiguous_memory_layout(&datatype->super,1) && 0 == lb ) { recvbuf_is_contiguous = true; @@ -503,7 +505,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_remaining; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); blocklen_per_process[n] = (int *) realloc @@ -528,7 +530,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_read_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); } @@ -548,7 +550,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_read_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base ; + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base ; } if (fh->f_procs_in_group[n] == fh->f_rank) { @@ -564,7 +566,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = global_iov_array[sorted[current_index]].iov_len; - displs_per_process[n][disp_index[n] - 1] = (OPAL_PTRDIFF_TYPE) + displs_per_process[n][disp_index[n] - 1] = (ptrdiff_t) global_iov_array[sorted[current_index]].iov_base; blocklen_per_process[n] = (int *) realloc ((void *)blocklen_per_process[n], (disp_index[n]+1)*sizeof(int)); @@ -813,14 +815,14 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, /* If data is not contigous in memory, copy the data from the receive buffer into the buffer passed in */ if (!recvbuf_is_contiguous ) { - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; remaining = bytes_received; while (remaining) { - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (decoded_iov[iov_index].iov_base) + current_position; if (remaining >= diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c index 7bc41c4590d..f1ba18014c5 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2015 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -101,7 +101,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, int my_aggregator=-1; bool sendbuf_is_contiguous = false; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb; + ptrdiff_t ftype_extent, lb; #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN @@ -117,7 +117,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, /************************************************************************** ** 1. In case the data is not contigous in memory, decode it into an iovec **************************************************************************/ - if ( ( ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) && + if ( ( ftype_extent == (ptrdiff_t) ftype_size) && opal_datatype_is_contiguous_memory_layout(&datatype->super,1) && 0 == lb ) { sendbuf_is_contiguous = true; @@ -523,7 +523,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_remaining; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); @@ -551,7 +551,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_write_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); } @@ -572,7 +572,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_write_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base ; + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base ; } if (fh->f_procs_in_group[n] == fh->f_rank) { bytes_sent += bytes_to_write_in_cycle; @@ -588,7 +588,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = global_iov_array[sorted[current_index]].iov_len; - displs_per_process[n][disp_index[n] - 1] = (OPAL_PTRDIFF_TYPE) + displs_per_process[n][disp_index[n] - 1] = (ptrdiff_t) global_iov_array[sorted[current_index]].iov_base; /*realloc for next blocklength @@ -798,7 +798,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, /* allocate a send buffer and copy the data that needs to be sent into it in case the data is non-contigous in memory */ - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; @@ -812,7 +812,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, remaining = bytes_sent; while (remaining) { - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (decoded_iov[iov_index].iov_base) + current_position; if (remaining >= @@ -946,7 +946,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, for (i=0 ; if_num_of_io_entries ; i++) { printf(" ADDRESS: %p OFFSET: %ld LENGTH: %ld\n", fh->f_io_array[i].memory_address, - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].offset, + (ptrdiff_t)fh->f_io_array[i].offset, fh->f_io_array[i].length); } diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c index 44cc0a2bdee..fd94b4ef15f 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2015 University of Houston. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -97,7 +99,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, int my_aggregator =-1; bool recvbuf_is_contiguous=false; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb; + ptrdiff_t ftype_extent, lb; #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN @@ -114,7 +116,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, opal_datatype_type_size ( &datatype->super, &ftype_size ); opal_datatype_get_extent ( &datatype->super, &lb, &ftype_extent ); - if ( (ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) && + if ( (ftype_extent == (ptrdiff_t) ftype_size) && opal_datatype_is_contiguous_memory_layout(&datatype->super,1) && 0 == lb ) { recvbuf_is_contiguous = true; @@ -503,7 +505,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_remaining; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); blocklen_per_process[n] = (int *) realloc @@ -528,7 +530,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_read_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base + + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base + (global_iov_array[sorted[current_index]].iov_len - bytes_remaining); } @@ -548,7 +550,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = bytes_to_read_in_cycle; displs_per_process[n][disp_index[n] - 1] = - (OPAL_PTRDIFF_TYPE)global_iov_array[sorted[current_index]].iov_base ; + (ptrdiff_t)global_iov_array[sorted[current_index]].iov_base ; } if (fh->f_procs_in_group[n] == fh->f_rank) { @@ -564,7 +566,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, if (my_aggregator == fh->f_rank) { blocklen_per_process[n][disp_index[n] - 1] = global_iov_array[sorted[current_index]].iov_len; - displs_per_process[n][disp_index[n] - 1] = (OPAL_PTRDIFF_TYPE) + displs_per_process[n][disp_index[n] - 1] = (ptrdiff_t) global_iov_array[sorted[current_index]].iov_base; blocklen_per_process[n] = (int *) realloc ((void *)blocklen_per_process[n], (disp_index[n]+1)*sizeof(int)); @@ -813,14 +815,14 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, /* If data is not contigous in memory, copy the data from the receive buffer into the buffer passed in */ if (!recvbuf_is_contiguous ) { - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; remaining = bytes_received; while (remaining) { - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (decoded_iov[iov_index].iov_base) + current_position; if (remaining >= diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c index 31bfa83150b..f9d713725d3 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -869,7 +869,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i if (aggregator == rank) { data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_remaining; data->displs_per_process[data->n][data->disp_index[data->n] - 1] = - (OPAL_PTRDIFF_TYPE)data->global_iov_array[data->sorted[data->current_index]].iov_base + + (ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base + (data->global_iov_array[data->sorted[data->current_index]].iov_len - data->bytes_remaining); @@ -897,7 +897,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i if (aggregator == rank) { data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_to_write_in_cycle; data->displs_per_process[data->n][data->disp_index[data->n] - 1] = - (OPAL_PTRDIFF_TYPE)data->global_iov_array[data->sorted[data->current_index]].iov_base + + (ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base + (data->global_iov_array[data->sorted[data->current_index]].iov_len - data->bytes_remaining); } @@ -918,7 +918,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i if (aggregator == rank) { data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_to_write_in_cycle; data->displs_per_process[data->n][data->disp_index[data->n] - 1] = - (OPAL_PTRDIFF_TYPE)data->global_iov_array[data->sorted[data->current_index]].iov_base ; + (ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base ; } if (data->procs_in_group[data->n] == rank) { bytes_sent += data->bytes_to_write_in_cycle; @@ -934,7 +934,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i if (aggregator == rank) { data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->global_iov_array[data->sorted[data->current_index]].iov_len; - data->displs_per_process[data->n][data->disp_index[data->n] - 1] = (OPAL_PTRDIFF_TYPE) + data->displs_per_process[data->n][data->disp_index[data->n] - 1] = (ptrdiff_t) data->global_iov_array[data->sorted[data->current_index]].iov_base; /*realloc for next blocklength @@ -1142,7 +1142,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i /* allocate a send buffer and copy the data that needs to be sent into it in case the data is non-contigous in memory */ - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; @@ -1156,7 +1156,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i remaining = bytes_sent; while (remaining) { - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (data->decoded_iov[data->iov_index].iov_base) + data->current_position; if (remaining >= @@ -1266,7 +1266,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i for (i=0 ; isuper,1) && 0 == lb ) { recvbuf_is_contiguous = true; @@ -186,9 +188,9 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, local_iov_array[0].process_id = fh->f_rank; } - d[0] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0]; - d[1] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0].length; - d[2] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0].process_id; + d[0] = (ptrdiff_t)&local_iov_array[0]; + d[1] = (ptrdiff_t)&local_iov_array[0].length; + d[2] = (ptrdiff_t)&local_iov_array[0].process_id; base = d[0]; for (i=0 ; i<3 ; i++) { d[i] -= base; @@ -768,7 +770,7 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, for (i=0 ; if_num_of_io_entries ; i++) { printf(" ADDRESS: %p OFFSET: %ld LENGTH: %ld\n", fh->f_io_array[i].memory_address, - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].offset, + (ptrdiff_t)fh->f_io_array[i].offset, fh->f_io_array[i].length); } #endif @@ -871,14 +873,14 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, position += bytes_to_read_in_cycle; if (!recvbuf_is_contiguous) { - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; remaining = bytes_to_read_in_cycle; while (remaining && (iov_count > iov_index)){ - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (decoded_iov[iov_index].iov_base) + current_position; if (remaining >= diff --git a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c index 75dcf88b979..66518f134c2 100644 --- a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c +++ b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -90,13 +90,13 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, /* For creating datatype of type io_array */ int blocklen[3] = {1, 1, 1}; int static_num_io_procs=1; - OPAL_PTRDIFF_TYPE d[3], base; + ptrdiff_t d[3], base; ompi_datatype_t *types[3]; ompi_datatype_t *io_array_type=MPI_DATATYPE_NULL; int my_aggregator=-1; bool sendbuf_is_contiguous= false; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb; + ptrdiff_t ftype_extent, lb; /*----------------------------------------------*/ @@ -118,7 +118,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, /************************************************************************** ** 1. In case the data is not contigous in memory, decode it into an iovec **************************************************************************/ - if ( ( ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) && + if ( ( ftype_extent == (ptrdiff_t) ftype_size) && opal_datatype_is_contiguous_memory_layout(&datatype->super,1) && 0 == lb ) { sendbuf_is_contiguous = true; @@ -155,9 +155,9 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, types[1] = &ompi_mpi_long.dt; types[2] = &ompi_mpi_int.dt; - d[0] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0]; - d[1] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0].length; - d[2] = (OPAL_PTRDIFF_TYPE)&local_iov_array[0].process_id; + d[0] = (ptrdiff_t)&local_iov_array[0]; + d[1] = (ptrdiff_t)&local_iov_array[0].length; + d[2] = (ptrdiff_t)&local_iov_array[0].process_id; base = d[0]; for (i=0 ; i<3 ; i++) { d[i] -= base; @@ -787,7 +787,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, /* allocate a send buffer and copy the data that needs to be sent into it in case the data is non-contigous in memory */ - OPAL_PTRDIFF_TYPE mem_address; + ptrdiff_t mem_address; size_t remaining = 0; size_t temp_position = 0; @@ -800,7 +800,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, remaining = bytes_to_write_in_cycle; while (remaining) { - mem_address = (OPAL_PTRDIFF_TYPE) + mem_address = (ptrdiff_t) (decoded_iov[iov_index].iov_base) + current_position; if (remaining >= @@ -914,7 +914,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, for (i=0 ; if_num_of_io_entries ; i++) { printf(" ADDRESS: %p OFFSET: %ld LENGTH: %ld\n", fh->f_io_array[i].memory_address, - (OPAL_PTRDIFF_TYPE)fh->f_io_array[i].offset, + (ptrdiff_t)fh->f_io_array[i].offset, fh->f_io_array[i].length); } #endif diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c index 6c4b717bc90..f5de324664e 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c @@ -11,9 +11,11 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -165,11 +167,11 @@ mca_fcoll_two_phase_file_read_all (mca_io_ompio_file_t *fh, for (ti = 0; ti < iov_count; ti++){ decoded_iov[ti].iov_base = (IOVBASE_TYPE *) - ((OPAL_PTRDIFF_TYPE)temp_iov[ti].iov_base - recv_buf_addr); + ((ptrdiff_t)temp_iov[ti].iov_base - recv_buf_addr); decoded_iov[ti].iov_len = temp_iov[ti].iov_len; #if DEBUG printf("d_offset[%d]: %ld, d_len[%d]: %ld\n", - ti, (OPAL_PTRDIFF_TYPE)decoded_iov[ti].iov_base, + ti, (ptrdiff_t)decoded_iov[ti].iov_base, ti, decoded_iov[ti].iov_len); #endif } diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c index f78cb143864..649d4ac99a3 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * reserved. @@ -190,7 +190,7 @@ mca_fcoll_two_phase_file_write_all (mca_io_ompio_file_t *fh, goto exit; } - send_buf_addr = (OPAL_PTRDIFF_TYPE)buf; + send_buf_addr = (ptrdiff_t)buf; if ( 0 < iov_count ) { decoded_iov = (struct iovec *)malloc (iov_count * sizeof(struct iovec)); @@ -201,13 +201,13 @@ mca_fcoll_two_phase_file_write_all (mca_io_ompio_file_t *fh, } for (ti = 0; ti < iov_count; ti ++){ decoded_iov[ti].iov_base = (IOVBASE_TYPE *)( - (OPAL_PTRDIFF_TYPE)temp_iov[ti].iov_base - + (ptrdiff_t)temp_iov[ti].iov_base - send_buf_addr); decoded_iov[ti].iov_len = temp_iov[ti].iov_len ; #if DEBUG_ON printf("d_offset[%d]: %ld, d_len[%d]: %ld\n", - ti, (OPAL_PTRDIFF_TYPE)decoded_iov[ti].iov_base, + ti, (ptrdiff_t)decoded_iov[ti].iov_base, ti, decoded_iov[ti].iov_len); #endif } diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c index 6017cda1481..211e39797be 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c +++ b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -72,7 +72,7 @@ mca_fs_pvfs2_file_open (struct ompi_communicator_t *comm, struct ompi_datatype_t *open_status_type; struct ompi_datatype_t *types[2] = {&ompi_mpi_int.dt, &ompi_mpi_byte.dt}; int lens[2] = {1, sizeof(PVFS_object_ref)}; - OPAL_PTRDIFF_TYPE offsets[2]; + ptrdiff_t offsets[2]; char char_stripe[MPI_MAX_INFO_KEY]; int flag; int fs_pvfs2_stripe_size = -1; diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index b07d8ad2dd5..6d3b5726e74 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -67,7 +67,7 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, k = 0; while (bytes_to_write) { - OPAL_PTRDIFF_TYPE disp; + ptrdiff_t disp; /* reallocate if needed */ if (OMPIO_IOVEC_INITIAL_SIZE*block <= k) { block ++; @@ -93,7 +93,7 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, } } - disp = (OPAL_PTRDIFF_TYPE)(fh->f_decoded_iov[j].iov_base) + + disp = (ptrdiff_t)(fh->f_decoded_iov[j].iov_base) + (fh->f_total_bytes - sum_previous_counts); iov[k].iov_base = (IOVBASE_TYPE *)(intptr_t)(disp + fh->f_offset); @@ -125,7 +125,7 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, int *row_index=NULL, i=0, l=0, m=0; int column_index=0, r_index=0; int blocklen[3] = {1, 1, 1}; - OPAL_PTRDIFF_TYPE d[3], base; + ptrdiff_t d[3], base; ompi_datatype_t *types[3]; ompi_datatype_t *io_array_type=MPI_DATATYPE_NULL; int **adj_matrix=NULL; @@ -172,9 +172,9 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, types[1] = &ompi_mpi_long.dt; types[2] = &ompi_mpi_int.dt; - d[0] = (OPAL_PTRDIFF_TYPE)&per_process[0]; - d[1] = (OPAL_PTRDIFF_TYPE)&per_process[0].length; - d[2] = (OPAL_PTRDIFF_TYPE)&per_process[0].process_id; + d[0] = (ptrdiff_t)&per_process[0]; + d[1] = (ptrdiff_t)&per_process[0].length; + d[2] = (ptrdiff_t)&per_process[0].process_id; base = d[0]; for (i=0;i<3;i++){ d[i] -= base; diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 078e66c6763..e2b552e5340 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -237,7 +237,7 @@ struct mca_io_ompio_file_t { size_t f_position_in_file_view; /* in bytes */ size_t f_total_bytes; /* total bytes read/written within 1 Fview*/ int f_index_in_file_view; - OPAL_PTRDIFF_TYPE f_view_extent; + ptrdiff_t f_view_extent; size_t f_view_size; ompi_datatype_t *f_etype; ompi_datatype_t *f_filetype; diff --git a/ompi/mca/osc/base/osc_base_obj_convert.c b/ompi/mca/osc/base/osc_base_obj_convert.c index d91d4d30801..bb4641c659d 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.c +++ b/ompi/mca/osc/base/osc_base_obj_convert.c @@ -11,7 +11,7 @@ * Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. @@ -105,7 +105,7 @@ int ompi_osc_base_process_op (void *outbuf, void *inbuf, size_t inbuflen, struct iovec iov[OMPI_OSC_BASE_DECODE_MAX]; uint32_t iov_count; size_t size, primitive_size; - OPAL_PTRDIFF_TYPE lb, extent; + ptrdiff_t lb, extent; bool done; primitive_datatype = ompi_datatype_get_single_predefined_type_from_args(datatype); diff --git a/ompi/mca/osc/osc.h b/ompi/mca/osc/osc.h index 61ae2880036..4ab065d8888 100644 --- a/ompi/mca/osc/osc.h +++ b/ompi/mca/osc/osc.h @@ -11,7 +11,7 @@ * Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -207,7 +207,7 @@ typedef int (*ompi_osc_base_module_put_fn_t)(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -217,7 +217,7 @@ typedef int (*ompi_osc_base_module_get_fn_t)(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -227,7 +227,7 @@ typedef int (*ompi_osc_base_module_accumulate_fn_t)(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -238,14 +238,14 @@ typedef int (*ompi_osc_base_module_compare_and_swap_fn_t)(const void *origin_add void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win); typedef int (*ompi_osc_base_module_fetch_and_op_fn_t)(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win); @@ -256,7 +256,7 @@ typedef int (*ompi_osc_base_module_get_accumulate_fn_t)(const void *origin_addr, int result_count, struct ompi_datatype_t *result_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_datatype, struct ompi_op_t *op, @@ -266,7 +266,7 @@ typedef int (*ompi_osc_base_module_rput_fn_t)(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -276,7 +276,7 @@ typedef int (*ompi_osc_base_module_rget_fn_t)(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -287,7 +287,7 @@ typedef int (*ompi_osc_base_module_raccumulate_fn_t)(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -301,7 +301,7 @@ typedef int (*ompi_osc_base_module_rget_accumulate_fn_t)(const void *origin_addr int result_count, struct ompi_datatype_t *result_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_datatype, struct ompi_op_t *op, diff --git a/ompi/mca/osc/portals4/osc_portals4.h b/ompi/mca/osc/portals4/osc_portals4.h index b35c0ed9053..161ac4b2912 100644 --- a/ompi/mca/osc/portals4/osc_portals4.h +++ b/ompi/mca/osc/portals4/osc_portals4.h @@ -3,7 +3,7 @@ * Copyright (c) 2011-2017 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -143,7 +143,7 @@ int ompi_osc_portals4_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -152,7 +152,7 @@ int ompi_osc_portals4_get(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -161,7 +161,7 @@ int ompi_osc_portals4_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -172,14 +172,14 @@ int ompi_osc_portals4_compare_and_swap(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win); int ompi_osc_portals4_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win); @@ -190,7 +190,7 @@ int ompi_osc_portals4_get_accumulate(const void *origin_addr, int result_count, struct ompi_datatype_t *result_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_datatype, struct ompi_op_t *op, @@ -200,7 +200,7 @@ int ompi_osc_portals4_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -210,7 +210,7 @@ int ompi_osc_portals4_rget(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -220,7 +220,7 @@ int ompi_osc_portals4_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -234,7 +234,7 @@ int ompi_osc_portals4_rget_accumulate(const void *origin_addr, int result_count, struct ompi_datatype_t *result_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_datatype, struct ompi_op_t *op, diff --git a/ompi/mca/osc/portals4/osc_portals4_comm.c b/ompi/mca/osc/portals4/osc_portals4_comm.c index 3b197f9708c..b792d20f8b7 100644 --- a/ompi/mca/osc/portals4/osc_portals4_comm.c +++ b/ompi/mca/osc/portals4/osc_portals4_comm.c @@ -3,7 +3,7 @@ * Copyright (c) 2014 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -501,7 +501,7 @@ get_to_iovec(ompi_osc_portals4_module_t *module, { int ret; size_t size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { @@ -588,7 +588,7 @@ atomic_get_to_iovec(ompi_osc_portals4_module_t *module, { int ret; size_t size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { @@ -670,7 +670,7 @@ put_from_iovec(ompi_osc_portals4_module_t *module, { int ret; size_t size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { @@ -759,7 +759,7 @@ atomic_put_from_iovec(ompi_osc_portals4_module_t *module, { int ret; size_t size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; if (module->origin_iovec_md_h != PTL_INVALID_HANDLE) { @@ -844,7 +844,7 @@ atomic_from_iovec(ompi_osc_portals4_module_t *module, { int ret; size_t size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; ptl_md_t md; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; @@ -944,7 +944,7 @@ swap_to_iovec(ompi_osc_portals4_module_t *module, int ret; size_t size; ptl_size_t iovec_count=0; - OPAL_PTRDIFF_TYPE length, result_lb, origin_lb, target_lb, extent; + ptrdiff_t length, result_lb, origin_lb, target_lb, extent; ptl_md_t md; ptl_datatype_t ptl_dt; @@ -1069,7 +1069,7 @@ fetch_atomic_to_iovec(ompi_osc_portals4_module_t *module, int ret; size_t size; ptl_size_t iovec_count=0; - OPAL_PTRDIFF_TYPE length, result_lb, origin_lb, target_lb, extent; + ptrdiff_t length, result_lb, origin_lb, target_lb, extent; ptl_md_t md; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; @@ -2021,7 +2021,7 @@ ompi_osc_portals4_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -2033,7 +2033,7 @@ ompi_osc_portals4_rput(const void *origin_addr, (ompi_osc_portals4_module_t*) win->w_osc_module; ptl_process_t peer = ompi_osc_portals4_get_peer(module, target); size_t size, offset; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "rput: 0x%lx, %d, %s, %d, %lu, %d, %s, 0x%lx", @@ -2133,7 +2133,7 @@ ompi_osc_portals4_rget(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -2145,7 +2145,7 @@ ompi_osc_portals4_rget(void *origin_addr, (ompi_osc_portals4_module_t*) win->w_osc_module; ptl_process_t peer = ompi_osc_portals4_get_peer(module, target); size_t offset, size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "rget: 0x%lx, %d, %s, %d, %lu, %d, %s, 0x%lx", @@ -2238,7 +2238,7 @@ ompi_osc_portals4_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -2253,7 +2253,7 @@ ompi_osc_portals4_raccumulate(const void *origin_addr, size_t offset, size; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - OPAL_PTRDIFF_TYPE sent, length, origin_lb, target_lb, extent; + ptrdiff_t sent, length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "raccumulate: 0x%lx, %d, %s, %d, %lu, %d, %s, %s 0x%lx", @@ -2449,7 +2449,7 @@ ompi_osc_portals4_rget_accumulate(const void *origin_addr, int result_count, struct ompi_datatype_t *result_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -2464,7 +2464,7 @@ ompi_osc_portals4_rget_accumulate(const void *origin_addr, size_t target_offset, size; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, result_lb, extent; + ptrdiff_t length, origin_lb, target_lb, result_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "rget_accumulate: 0x%lx, %d, %s, 0x%lx, %d, %s, %d, %lu, %d, %s, %s, 0x%lx", @@ -2798,7 +2798,7 @@ ompi_osc_portals4_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win) @@ -2808,7 +2808,7 @@ ompi_osc_portals4_put(const void *origin_addr, (ompi_osc_portals4_module_t*) win->w_osc_module; ptl_process_t peer = ompi_osc_portals4_get_peer(module, target); size_t offset, size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "put: 0x%lx, %d, %s, %d, %lu, %d, %s, 0x%lx", @@ -2897,7 +2897,7 @@ ompi_osc_portals4_get(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win) @@ -2907,7 +2907,7 @@ ompi_osc_portals4_get(void *origin_addr, (ompi_osc_portals4_module_t*) win->w_osc_module; ptl_process_t peer = ompi_osc_portals4_get_peer(module, target); size_t offset, size; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, extent; + ptrdiff_t length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "get: 0x%lx, %d, %s, %d, %lu, %d, %s, 0x%lx", @@ -2993,7 +2993,7 @@ ompi_osc_portals4_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -3006,7 +3006,7 @@ ompi_osc_portals4_accumulate(const void *origin_addr, size_t offset, size; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - OPAL_PTRDIFF_TYPE sent, length, origin_lb, target_lb, extent; + ptrdiff_t sent, length, origin_lb, target_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "accumulate: 0x%lx, %d, %s, %d, %lu, %d, %s, %s, 0x%lx", @@ -3186,7 +3186,7 @@ ompi_osc_portals4_get_accumulate(const void *origin_addr, int result_count, struct ompi_datatype_t *result_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -3199,7 +3199,7 @@ ompi_osc_portals4_get_accumulate(const void *origin_addr, size_t target_offset, size; ptl_op_t ptl_op; ptl_datatype_t ptl_dt; - OPAL_PTRDIFF_TYPE length, origin_lb, target_lb, result_lb, extent; + ptrdiff_t length, origin_lb, target_lb, result_lb, extent; OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "get_accumulate: 0x%lx, %d, %s, 0x%lx, %d, %s, %d, %lu, %d, %s, %s, 0x%lx", @@ -3504,7 +3504,7 @@ ompi_osc_portals4_compare_and_swap(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win) { int ret; @@ -3572,7 +3572,7 @@ ompi_osc_portals4_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win) { diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt.h b/ompi/mca/osc/pt2pt/osc_pt2pt.h index 5901aa2e1a0..e3434f6504b 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt.h @@ -12,7 +12,7 @@ * reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -328,7 +328,7 @@ int ompi_osc_pt2pt_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -337,7 +337,7 @@ int ompi_osc_pt2pt_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -347,7 +347,7 @@ int ompi_osc_pt2pt_get(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -357,14 +357,14 @@ int ompi_osc_pt2pt_compare_and_swap(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win); int ompi_osc_pt2pt_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win); @@ -385,7 +385,7 @@ int ompi_osc_pt2pt_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -395,7 +395,7 @@ int ompi_osc_pt2pt_rget(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -405,7 +405,7 @@ int ompi_osc_pt2pt_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c b/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c index f0935273442..a8c218c4cf0 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c @@ -12,7 +12,7 @@ * reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -108,7 +108,7 @@ static int ompi_osc_pt2pt_dt_send_complete (ompi_request_t *request) /* self communication optimizations */ static inline int ompi_osc_pt2pt_put_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, const void *source, int source_count, - ompi_datatype_t *source_datatype, OPAL_PTRDIFF_TYPE target_disp, int target_count, + ompi_datatype_t *source_datatype, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_request_t *request) { @@ -133,7 +133,7 @@ static inline int ompi_osc_pt2pt_put_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, co } static inline int ompi_osc_pt2pt_get_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, void *target, int target_count, ompi_datatype_t *target_datatype, - OPAL_PTRDIFF_TYPE source_disp, int source_count, ompi_datatype_t *source_datatype, + ptrdiff_t source_disp, int source_count, ompi_datatype_t *source_datatype, ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_request_t *request) { void *source = (unsigned char*) module->baseptr + @@ -157,7 +157,7 @@ static inline int ompi_osc_pt2pt_get_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, vo } static inline int ompi_osc_pt2pt_cas_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, const void *source, const void *compare, void *result, - ompi_datatype_t *datatype, OPAL_PTRDIFF_TYPE target_disp, ompi_osc_pt2pt_module_t *module) + ompi_datatype_t *datatype, ptrdiff_t target_disp, ompi_osc_pt2pt_module_t *module) { void *target = (unsigned char*) module->baseptr + ((unsigned long) target_disp * module->disp_unit); @@ -179,7 +179,7 @@ static inline int ompi_osc_pt2pt_cas_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, co } static inline int ompi_osc_pt2pt_acc_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, const void *source, int source_count, ompi_datatype_t *source_datatype, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_request_t *request) { void *target = (unsigned char*) module->baseptr + @@ -214,7 +214,7 @@ static inline int ompi_osc_pt2pt_acc_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, co static inline int ompi_osc_pt2pt_gacc_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, const void *source, int source_count, ompi_datatype_t *source_datatype, void *result, int result_count, ompi_datatype_t *result_datatype, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_request_t *request) { void *target = (unsigned char*) module->baseptr + @@ -267,7 +267,7 @@ static inline int ompi_osc_pt2pt_gacc_self (ompi_osc_pt2pt_sync_t *pt2pt_sync, c static inline int ompi_osc_pt2pt_put_w_req (const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, ompi_win_t *win, ompi_osc_pt2pt_request_t *request) { @@ -418,7 +418,7 @@ static inline int ompi_osc_pt2pt_put_w_req (const void *origin_addr, int origin_ int ompi_osc_pt2pt_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, ompi_win_t *win) { @@ -431,7 +431,7 @@ ompi_osc_pt2pt_put(const void *origin_addr, int origin_count, static int ompi_osc_pt2pt_accumulate_w_req (const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, ompi_win_t *win, @@ -593,7 +593,7 @@ ompi_osc_pt2pt_accumulate_w_req (const void *origin_addr, int origin_count, int ompi_osc_pt2pt_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, ompi_win_t *win) @@ -605,7 +605,7 @@ ompi_osc_pt2pt_accumulate(const void *origin_addr, int origin_count, int ompi_osc_pt2pt_compare_and_swap (const void *origin_addr, const void *compare_addr, void *result_addr, struct ompi_datatype_t *dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, struct ompi_win_t *win) { ompi_osc_pt2pt_module_t *module = GET_MODULE(win); @@ -697,7 +697,7 @@ int ompi_osc_pt2pt_compare_and_swap (const void *origin_addr, const void *compar int ompi_osc_pt2pt_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, struct ompi_op_t *op, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win) { return ompi_osc_pt2pt_get_accumulate(origin_addr, 1, dt, result_addr, 1, dt, @@ -706,7 +706,7 @@ int ompi_osc_pt2pt_fetch_and_op(const void *origin_addr, void *result_addr, int ompi_osc_pt2pt_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, struct ompi_request_t **request) { @@ -746,7 +746,7 @@ int ompi_osc_pt2pt_rput(const void *origin_addr, int origin_count, static inline int ompi_osc_pt2pt_rget_internal (void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, bool release_req, @@ -879,7 +879,7 @@ static inline int ompi_osc_pt2pt_rget_internal (void *origin_addr, int origin_co } int ompi_osc_pt2pt_rget (void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, struct ompi_request_t **request) { @@ -890,7 +890,7 @@ int ompi_osc_pt2pt_rget (void *origin_addr, int origin_count, struct ompi_dataty int ompi_osc_pt2pt_get (void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win) { ompi_request_t *request; @@ -901,7 +901,7 @@ int ompi_osc_pt2pt_get (void *origin_addr, int origin_count, struct ompi_datatyp int ompi_osc_pt2pt_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, int target_count, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, struct ompi_win_t *win, struct ompi_request_t **request) { diff --git a/ompi/mca/osc/rdma/osc_rdma_accumulate.c b/ompi/mca/osc/rdma/osc_rdma_accumulate.c index 0fd2bbdd6ef..8ddfbd1087a 100644 --- a/ompi/mca/osc/rdma/osc_rdma_accumulate.c +++ b/ompi/mca/osc/rdma/osc_rdma_accumulate.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Research Organization for Information Science + * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Intel, Inc. All rights reserved. * $COPYRIGHT$ @@ -959,7 +959,7 @@ static inline int cas_rdma (ompi_osc_rdma_sync_t *sync, const void *source_addr, int ompi_osc_rdma_compare_and_swap (const void *origin_addr, const void *compare_addr, void *result_addr, - ompi_datatype_t *dt, int target_rank, OPAL_PTRDIFF_TYPE target_disp, + ompi_datatype_t *dt, int target_rank, ptrdiff_t target_disp, ompi_win_t *win) { ompi_osc_rdma_module_t *module = GET_MODULE(win); @@ -1133,7 +1133,7 @@ int ompi_osc_rdma_rget_accumulate (const void *origin_addr, int origin_count, om } int ompi_osc_rdma_raccumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_win_t *win, ompi_request_t **request) { ompi_osc_rdma_module_t *module = GET_MODULE(win); @@ -1167,7 +1167,7 @@ int ompi_osc_rdma_raccumulate (const void *origin_addr, int origin_count, ompi_d } int ompi_osc_rdma_accumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_win_t *win) { ompi_osc_rdma_module_t *module = GET_MODULE(win); @@ -1190,7 +1190,7 @@ int ompi_osc_rdma_accumulate (const void *origin_addr, int origin_count, ompi_da int ompi_osc_rdma_fetch_and_op (const void *origin_addr, void *result_addr, ompi_datatype_t *dt, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, ompi_op_t *op, ompi_win_t *win) + ptrdiff_t target_disp, ompi_op_t *op, ompi_win_t *win) { ompi_osc_rdma_module_t *module = GET_MODULE(win); ompi_osc_rdma_peer_t *peer; diff --git a/ompi/mca/osc/rdma/osc_rdma_accumulate.h b/ompi/mca/osc/rdma/osc_rdma_accumulate.h index 7ab370ab2b8..74f41abf6ef 100644 --- a/ompi/mca/osc/rdma/osc_rdma_accumulate.h +++ b/ompi/mca/osc/rdma/osc_rdma_accumulate.h @@ -2,6 +2,8 @@ /* * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016-2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,15 +17,15 @@ #include "osc_rdma.h" int ompi_osc_rdma_compare_and_swap (const void *origin_addr, const void *compare_addr, void *result_addr, - ompi_datatype_t *dt, int target_rank, OPAL_PTRDIFF_TYPE target_disp, + ompi_datatype_t *dt, int target_rank, ptrdiff_t target_disp, ompi_win_t *win); int ompi_osc_rdma_accumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_win_t *win); int ompi_osc_rdma_fetch_and_op (const void *origin_addr, void *result_addr, ompi_datatype_t *dt, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, ompi_op_t *op, ompi_win_t *win); + ptrdiff_t target_disp, ompi_op_t *op, ompi_win_t *win); int ompi_osc_rdma_get_accumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, void *result_addr, int result_count, ompi_datatype_t *result_datatype, @@ -31,7 +33,7 @@ int ompi_osc_rdma_get_accumulate (const void *origin_addr, int origin_count, omp ompi_op_t *op, ompi_win_t *win); int ompi_osc_rdma_raccumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, int target_rank, - OPAL_PTRDIFF_TYPE target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_op_t *op, ompi_win_t *win, ompi_request_t **request); int ompi_osc_rdma_rget_accumulate (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.c b/ompi/mca/osc/rdma/osc_rdma_comm.c index d4daad37b6f..adea62ced5c 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.c +++ b/ompi/mca/osc/rdma/osc_rdma_comm.c @@ -3,6 +3,8 @@ * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -774,7 +776,7 @@ static int ompi_osc_rdma_get_contig (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_p static inline int ompi_osc_rdma_put_w_req (ompi_osc_rdma_sync_t *sync, const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, ompi_osc_rdma_peer_t *peer, - OPAL_PTRDIFF_TYPE target_disp, int target_count, + ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_osc_rdma_request_t *request) { ompi_osc_rdma_module_t *module = sync->module; @@ -809,7 +811,7 @@ static inline int ompi_osc_rdma_put_w_req (ompi_osc_rdma_sync_t *sync, const voi } static inline int ompi_osc_rdma_get_w_req (ompi_osc_rdma_sync_t *sync, void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, - ompi_osc_rdma_peer_t *peer, OPAL_PTRDIFF_TYPE source_disp, int source_count, + ompi_osc_rdma_peer_t *peer, ptrdiff_t source_disp, int source_count, ompi_datatype_t *source_datatype, ompi_osc_rdma_request_t *request) { ompi_osc_rdma_module_t *module = sync->module; @@ -843,7 +845,7 @@ static inline int ompi_osc_rdma_get_w_req (ompi_osc_rdma_sync_t *sync, void *ori module->selected_btl->btl_get_limit, ompi_osc_rdma_get_contig, true); } int ompi_osc_rdma_put (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, - int target_rank, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target_rank, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_win_t *win) { ompi_osc_rdma_module_t *module = GET_MODULE(win); @@ -864,7 +866,7 @@ int ompi_osc_rdma_put (const void *origin_addr, int origin_count, ompi_datatype_ } int ompi_osc_rdma_rput (const void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, - int target_rank, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target_rank, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_datatype, ompi_win_t *win, ompi_request_t **request) { @@ -899,7 +901,7 @@ int ompi_osc_rdma_rput (const void *origin_addr, int origin_count, ompi_datatype } int ompi_osc_rdma_get (void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, - int source_rank, OPAL_PTRDIFF_TYPE source_disp, int source_count, + int source_rank, ptrdiff_t source_disp, int source_count, ompi_datatype_t *source_datatype, ompi_win_t *win) { ompi_osc_rdma_module_t *module = GET_MODULE(win); @@ -920,7 +922,7 @@ int ompi_osc_rdma_get (void *origin_addr, int origin_count, ompi_datatype_t *ori } int ompi_osc_rdma_rget (void *origin_addr, int origin_count, ompi_datatype_t *origin_datatype, - int source_rank, OPAL_PTRDIFF_TYPE source_disp, int source_count, + int source_rank, ptrdiff_t source_disp, int source_count, ompi_datatype_t *source_datatype, ompi_win_t *win, ompi_request_t **request) { diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.h b/ompi/mca/osc/rdma/osc_rdma_comm.h index e9b048c56ee..0e2daf2b4e8 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.h +++ b/ompi/mca/osc/rdma/osc_rdma_comm.h @@ -2,6 +2,8 @@ /* * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -53,7 +55,7 @@ static inline void ompi_osc_rdma_cleanup_rdma (ompi_osc_rdma_sync_t *sync, ompi_ * @returns OMPI_ERR_RMA_RANGE if the address range is not valid at the remote window * @returns other OMPI error on error */ -static inline int osc_rdma_get_remote_segment (ompi_osc_rdma_module_t *module, ompi_osc_rdma_peer_t *peer, OPAL_PTRDIFF_TYPE target_disp, +static inline int osc_rdma_get_remote_segment (ompi_osc_rdma_module_t *module, ompi_osc_rdma_peer_t *peer, ptrdiff_t target_disp, size_t length, uint64_t *remote_address, mca_btl_base_registration_handle_t **remote_handle) { ompi_osc_rdma_region_t *region; @@ -97,20 +99,20 @@ static inline int osc_rdma_get_remote_segment (ompi_osc_rdma_module_t *module, o /* prototypes for implementations of MPI RMA window functions. these will be called from the * mpi interface (ompi/mpi/c) */ int ompi_osc_rdma_put (const void *origin_addr, int origin_count, ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_dt, ompi_win_t *win); int ompi_osc_rdma_get (void *origin_addr, int origin_count, ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_dt, ompi_win_t *win); int ompi_osc_rdma_rput (const void *origin_addr, int origin_count, ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_dt, ompi_win_t *win, ompi_request_t **request); int ompi_osc_rdma_rget (void *origin_addr, int origin_count, ompi_datatype_t *origin_dt, - int target, OPAL_PTRDIFF_TYPE target_disp, int target_count, + int target, ptrdiff_t target_disp, int target_count, ompi_datatype_t *target_dt, ompi_win_t *win, ompi_request_t **request); diff --git a/ompi/mca/osc/sm/osc_sm.h b/ompi/mca/osc/sm/osc_sm.h index 7c058465b07..5ed2f5731ed 100644 --- a/ompi/mca/osc/sm/osc_sm.h +++ b/ompi/mca/osc/sm/osc_sm.h @@ -3,7 +3,7 @@ * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -97,7 +97,7 @@ int ompi_osc_sm_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -106,7 +106,7 @@ int ompi_osc_sm_get(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win); @@ -115,7 +115,7 @@ int ompi_osc_sm_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -126,14 +126,14 @@ int ompi_osc_sm_compare_and_swap(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win); int ompi_osc_sm_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win); @@ -154,7 +154,7 @@ int ompi_osc_sm_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -164,7 +164,7 @@ int ompi_osc_sm_rget(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -174,7 +174,7 @@ int ompi_osc_sm_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, diff --git a/ompi/mca/osc/sm/osc_sm_comm.c b/ompi/mca/osc/sm/osc_sm_comm.c index e6f3da44e68..b6094dd16eb 100644 --- a/ompi/mca/osc/sm/osc_sm_comm.c +++ b/ompi/mca/osc/sm/osc_sm_comm.c @@ -3,7 +3,7 @@ * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -25,7 +25,7 @@ ompi_osc_sm_rput(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -65,7 +65,7 @@ ompi_osc_sm_rget(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win, @@ -105,7 +105,7 @@ ompi_osc_sm_raccumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -210,7 +210,7 @@ ompi_osc_sm_put(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win) @@ -241,7 +241,7 @@ ompi_osc_sm_get(void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_win_t *win) @@ -272,7 +272,7 @@ ompi_osc_sm_accumulate(const void *origin_addr, int origin_count, struct ompi_datatype_t *origin_dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, int target_count, struct ompi_datatype_t *target_dt, struct ompi_op_t *op, @@ -365,7 +365,7 @@ ompi_osc_sm_compare_and_swap(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_win_t *win) { ompi_osc_sm_module_t *module = @@ -404,7 +404,7 @@ ompi_osc_sm_fetch_and_op(const void *origin_addr, void *result_addr, struct ompi_datatype_t *dt, int target, - OPAL_PTRDIFF_TYPE target_disp, + ptrdiff_t target_disp, struct ompi_op_t *op, struct ompi_win_t *win) { diff --git a/ompi/patterns/comm/allgather.c b/ompi/patterns/comm/allgather.c index 48321bf3cf4..ceef10bbbe6 100644 --- a/ompi/patterns/comm/allgather.c +++ b/ompi/patterns/comm/allgather.c @@ -3,7 +3,7 @@ * Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -40,7 +40,7 @@ OMPI_DECLSPEC int comm_allgather_pml(void *src_buf, void *dest_buf, int count, netpatterns_pair_exchange_node_t my_exchange_node; size_t message_extent,current_data_extent,current_data_count; size_t dt_size; - OPAL_PTRDIFF_TYPE dt_extent; + ptrdiff_t dt_extent; char *src_buf_current; char *dest_buf_current; struct iovec send_iov[2] = {{0,0},{0,0}}, diff --git a/ompi/patterns/comm/allreduce.c b/ompi/patterns/comm/allreduce.c index 2fbf9e21773..c7342a41e88 100644 --- a/ompi/patterns/comm/allreduce.c +++ b/ompi/patterns/comm/allreduce.c @@ -3,7 +3,7 @@ * Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -51,7 +51,7 @@ OMPI_DECLSPEC int comm_allreduce_pml(void *sbuf, void *rbuf, int count, if( OMPI_SUCCESS != rc ) { goto Error; } - rc = ompi_datatype_type_extent(dtype, (OPAL_PTRDIFF_TYPE *)&dt_extent); + rc = ompi_datatype_type_extent(dtype, (ptrdiff_t *)&dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 46aff829723..18cbaf9c970 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2016 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2013-2016 Research Organization for Information Science + * Copyright (c) 2013-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -43,9 +43,6 @@ CONVERTOR->cbmemcpy( (DST), (SRC), (BLENGTH), (CONVERTOR) ) #endif -extern int opal_convertor_create_stack_with_pos_general( opal_convertor_t* convertor, - int starting_point, const int* sizes ); - static void opal_convertor_construct( opal_convertor_t* convertor ) { convertor->pStack = convertor->static_stack; @@ -226,7 +223,7 @@ int32_t opal_convertor_pack( opal_convertor_t* pConv, if( OPAL_LIKELY(pConv->flags & CONVERTOR_NO_OP) ) { /** * We are doing conversion on a contiguous datatype on a homogeneous - * environment. The convertor contain minimal informations, we only + * environment. The convertor contain minimal information, we only * use the bConverted to manage the conversion. */ uint32_t i; @@ -333,7 +330,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* const opal_datatype_t* pData = pConvertor->pDesc; dt_elem_desc_t* pElems; uint32_t count; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; pStack = pConvertor->pStack; /** @@ -447,31 +444,53 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, return rc; } +static size_t +opal_datatype_compute_remote_size( const opal_datatype_t* pData, + const size_t* sizes ) +{ + uint32_t typeMask = pData->bdt_used; + size_t length = 0; + + if (opal_datatype_is_predefined(pData)) { + return sizes[pData->desc.desc->elem.common.type]; + } + + if( OPAL_UNLIKELY(NULL == pData->ptypes) ) { + /* Allocate and fill the array of types used in the datatype description */ + opal_datatype_compute_ptypes( (opal_datatype_t*)pData ); + } + + for( int i = OPAL_DATATYPE_FIRST_TYPE; typeMask && (i < OPAL_DATATYPE_MAX_PREDEFINED); i++ ) { + if( typeMask & ((uint32_t)1 << i) ) { + length += (pData->ptypes[i] * sizes[i]); + typeMask ^= ((uint32_t)1 << i); + } + } + return length; +} /** * Compute the remote size. If necessary remove the homogeneous flag * and redirect the convertor description toward the non-optimized * datatype representation. */ -#define OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE(convertor, datatype, bdt_mask) \ -{ \ - if( OPAL_UNLIKELY(0 != (bdt_mask)) ) { \ - opal_convertor_master_t* master; \ - int i; \ - uint32_t mask = datatype->bdt_used; \ - convertor->flags &= (~CONVERTOR_HOMOGENEOUS); \ - master = convertor->master; \ - convertor->remote_size = 0; \ - for( i = OPAL_DATATYPE_FIRST_TYPE; mask && (i < OPAL_DATATYPE_MAX_PREDEFINED); i++ ) { \ - if( mask & ((uint32_t)1 << i) ) { \ - convertor->remote_size += (datatype->btypes[i] * \ - master->remote_sizes[i]); \ - mask ^= ((uint32_t)1 << i); \ - } \ - } \ - convertor->remote_size *= convertor->count; \ - convertor->use_desc = &(datatype->desc); \ - } \ +size_t opal_convertor_compute_remote_size( opal_convertor_t* pConvertor ) +{ + opal_datatype_t* datatype = (opal_datatype_t*)pConvertor->pDesc; + + pConvertor->remote_size = pConvertor->local_size; + if( OPAL_UNLIKELY(datatype->bdt_used & pConvertor->master->hetero_mask) ) { + pConvertor->flags &= (~CONVERTOR_HOMOGENEOUS); + pConvertor->use_desc = &(datatype->desc); + if( 0 == (pConvertor->flags & CONVERTOR_HAS_REMOTE_SIZE) ) { + /* This is for a single datatype, we must update it with the count */ + pConvertor->remote_size = opal_datatype_compute_remote_size(datatype, + pConvertor->master->remote_sizes); + pConvertor->remote_size *= pConvertor->count; + } + } + pConvertor->flags |= CONVERTOR_HAS_REMOTE_SIZE; + return pConvertor->remote_size; } /** @@ -483,29 +502,26 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, */ #define OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ) \ { \ - uint32_t bdt_mask; \ - \ + convertor->local_size = count * datatype->size; \ + convertor->pBaseBuf = (unsigned char*)pUserBuf; \ + convertor->count = count; \ + convertor->pDesc = (opal_datatype_t*)datatype; \ + convertor->bConverted = 0; \ + convertor->use_desc = &(datatype->opt_desc); \ /* If the data is empty we just mark the convertor as \ * completed. With this flag set the pack and unpack functions \ * will not do anything. \ */ \ if( OPAL_UNLIKELY((0 == count) || (0 == datatype->size)) ) { \ - convertor->flags |= OPAL_DATATYPE_FLAG_NO_GAPS | CONVERTOR_COMPLETED; \ + convertor->flags |= (OPAL_DATATYPE_FLAG_NO_GAPS | CONVERTOR_COMPLETED | CONVERTOR_HAS_REMOTE_SIZE); \ convertor->local_size = convertor->remote_size = 0; \ return OPAL_SUCCESS; \ } \ - /* Compute the local in advance */ \ - convertor->local_size = count * datatype->size; \ - convertor->pBaseBuf = (unsigned char*)pUserBuf; \ - convertor->count = count; \ \ /* Grab the datatype part of the flags */ \ convertor->flags &= CONVERTOR_TYPE_MASK; \ convertor->flags |= (CONVERTOR_DATATYPE_MASK & datatype->flags); \ convertor->flags |= (CONVERTOR_NO_OP | CONVERTOR_HOMOGENEOUS); \ - convertor->pDesc = (opal_datatype_t*)datatype; \ - convertor->bConverted = 0; \ - convertor->use_desc = &(datatype->opt_desc); \ \ convertor->remote_size = convertor->local_size; \ if( OPAL_LIKELY(convertor->remoteArch == opal_local_arch) ) { \ @@ -516,9 +532,8 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, } \ } \ \ - bdt_mask = datatype->bdt_used & convertor->master->hetero_mask; \ - OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE( convertor, datatype, \ - bdt_mask ); \ + assert( (convertor)->pDesc == (datatype) ); \ + opal_convertor_compute_remote_size( convertor ); \ assert( NULL != convertor->use_desc->desc ); \ /* For predefined datatypes (contiguous) do nothing more */ \ /* if checksum is enabled then always continue */ \ @@ -530,7 +545,7 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, } \ convertor->flags &= ~CONVERTOR_NO_OP; \ { \ - uint32_t required_stack_length = datatype->btypes[OPAL_DATATYPE_LOOP] + 1; \ + uint32_t required_stack_length = datatype->loops + 1; \ \ if( required_stack_length > convertor->stack_size ) { \ assert(convertor->pStack == convertor->static_stack); \ @@ -599,7 +614,7 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, convertor->fAdvance = opal_pack_general_checksum; } else { if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - if( ((datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size) + if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size) || (1 >= convertor->count) ) convertor->fAdvance = opal_pack_homogeneous_contig_checksum; else @@ -613,7 +628,7 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, convertor->fAdvance = opal_pack_general; } else { if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - if( ((datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size) + if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size) || (1 >= convertor->count) ) convertor->fAdvance = opal_pack_homogeneous_contig; else @@ -714,8 +729,8 @@ void opal_datatype_dump_stack( const dt_stack_t* pStack, int stack_pos, opal_output( 0, "%d: pos %d count %d disp %ld ", stack_pos, pStack[stack_pos].index, (int)pStack[stack_pos].count, (long)pStack[stack_pos].disp ); if( pStack->index != -1 ) - opal_output( 0, "\t[desc count %d disp %ld extent %ld]\n", - pDesc[pStack[stack_pos].index].elem.count, + opal_output( 0, "\t[desc count %lu disp %ld extent %ld]\n", + (unsigned long)pDesc[pStack[stack_pos].index].elem.count, (long)pDesc[pStack[stack_pos].index].elem.disp, (long)pDesc[pStack[stack_pos].index].elem.extent ); else diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h index 7c5de1af39b..85956af88d7 100644 --- a/opal/datatype/opal_convertor.h +++ b/opal/datatype/opal_convertor.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -12,6 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,6 +54,7 @@ BEGIN_C_DECLS #define CONVERTOR_STATE_ALLOC 0x04000000 #define CONVERTOR_COMPLETED 0x08000000 #define CONVERTOR_CUDA_UNIFIED 0x10000000 +#define CONVERTOR_HAS_REMOTE_SIZE 0x20000000 union dt_elem_desc; typedef struct opal_convertor_t opal_convertor_t; @@ -70,7 +73,7 @@ struct dt_stack_t { int32_t index; /**< index in the element description */ int16_t type; /**< the type used for the last pack/unpack (original or OPAL_DATATYPE_UINT1) */ size_t count; /**< number of times we still have to do it */ - OPAL_PTRDIFF_TYPE disp; /**< actual displacement depending on the count field */ + ptrdiff_t disp; /**< actual displacement depending on the count field */ }; typedef struct dt_stack_t dt_stack_t; @@ -184,9 +187,16 @@ static inline int32_t opal_convertor_need_buffers( const opal_convertor_t* pConv return 1; } +/** + * Update the size of the remote datatype representation. The size will + * depend on the configuration of the master convertor. In homogeneous + * environments, the local and remote sizes are identical. + */ +size_t +opal_convertor_compute_remote_size( opal_convertor_t* pConv ); -/* - * +/** + * Return the local size of the convertor (count times the size of the datatype). */ static inline void opal_convertor_get_packed_size( const opal_convertor_t* pConv, size_t* pSize ) @@ -195,16 +205,24 @@ static inline void opal_convertor_get_packed_size( const opal_convertor_t* pConv } -/* - * +/** + * Return the remote size of the convertor (count times the remote size of the + * datatype). On homogeneous environments the local and remote sizes are + * identical. */ static inline void opal_convertor_get_unpacked_size( const opal_convertor_t* pConv, size_t* pSize ) { + if( pConv->flags & CONVERTOR_HOMOGENEOUS ) { + *pSize = pConv->local_size; + return; + } + if( 0 == (CONVERTOR_HAS_REMOTE_SIZE & pConv->flags) ) { + opal_convertor_compute_remote_size( (opal_convertor_t*)pConv); + } *pSize = pConv->remote_size; } - /** * Return the current absolute position of the next pack/unpack. This function is * mostly useful for contiguous datatypes, when we need to get the pointer to the @@ -277,6 +295,7 @@ opal_convertor_raw( opal_convertor_t* convertor, /* [IN/OUT] */ uint32_t* iov_count, /* [IN/OUT] */ size_t* length ); /* [OUT] */ + /* * Upper level does not need to call the _nocheck function directly. */ diff --git a/opal/datatype/opal_convertor_internal.h b/opal/datatype/opal_convertor_internal.h index 8c7f9f05da3..025633cb7e7 100644 --- a/opal/datatype/opal_convertor_internal.h +++ b/opal/datatype/opal_convertor_internal.h @@ -4,7 +4,9 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,9 +23,9 @@ BEGIN_C_DECLS typedef int32_t (*conversion_fct_t)( opal_convertor_t* pConvertor, uint32_t count, - const void* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, - void* to, size_t to_length, OPAL_PTRDIFF_TYPE to_extent, - OPAL_PTRDIFF_TYPE *advance ); + const void* from, size_t from_len, ptrdiff_t from_extent, + void* to, size_t to_length, ptrdiff_t to_extent, + ptrdiff_t *advance ); typedef struct opal_convertor_master_t { struct opal_convertor_master_t* next; diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index ce0eaf33305..09019388127 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -4,7 +4,9 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -164,7 +166,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)source_base; + ptrdiff_t local_disp = (ptrdiff_t)source_base; ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items); if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { @@ -185,7 +187,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, goto update_loop_description; } } - local_disp = (OPAL_PTRDIFF_TYPE)source_base - local_disp; + local_disp = (ptrdiff_t)source_base - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; diff --git a/opal/datatype/opal_copy_functions.c b/opal/datatype/opal_copy_functions.c index 433cf4173e3..221d07a920c 100644 --- a/opal/datatype/opal_copy_functions.c +++ b/opal/datatype/opal_copy_functions.c @@ -4,9 +4,9 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,9 +40,9 @@ */ #define COPY_TYPE( TYPENAME, TYPE, COUNT ) \ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ - char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent, \ - OPAL_PTRDIFF_TYPE *advance) \ + char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_len, ptrdiff_t to_extent, \ + ptrdiff_t *advance) \ { \ uint32_t i; \ size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \ @@ -61,8 +61,8 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ #TYPE, count, from, from_len, to, to_len ); \ \ - if( (from_extent == (OPAL_PTRDIFF_TYPE)local_TYPE_size) && \ - (to_extent == (OPAL_PTRDIFF_TYPE)remote_TYPE_size) ) { \ + if( (from_extent == (ptrdiff_t)local_TYPE_size) && \ + (to_extent == (ptrdiff_t)remote_TYPE_size) ) { \ /* copy of contigous data at both source and destination */ \ MEMCPY( to, from, count * local_TYPE_size ); \ } else { \ @@ -93,9 +93,9 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, */ #define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \ static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ - char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent, \ - OPAL_PTRDIFF_TYPE *advance ) \ + char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_len, ptrdiff_t to_extent, \ + ptrdiff_t *advance ) \ { \ uint32_t i; \ size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \ @@ -113,8 +113,8 @@ static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t cou DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ #TYPENAME, count, from, from_len, to, to_len ); \ \ - if( (from_extent == (OPAL_PTRDIFF_TYPE)local_TYPE_size) && \ - (to_extent == (OPAL_PTRDIFF_TYPE)remote_TYPE_size) ) { \ + if( (from_extent == (ptrdiff_t)local_TYPE_size) && \ + (to_extent == (ptrdiff_t)remote_TYPE_size) ) { \ MEMCPY( to, from, count * local_TYPE_size ); \ } else { \ for( i = 0; i < count; i++ ) { \ diff --git a/opal/datatype/opal_copy_functions_heterogeneous.c b/opal/datatype/opal_copy_functions_heterogeneous.c index 956a1d46bcb..56d27b82e3e 100644 --- a/opal/datatype/opal_copy_functions_heterogeneous.c +++ b/opal/datatype/opal_copy_functions_heterogeneous.c @@ -4,7 +4,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -71,9 +71,9 @@ opal_dt_swap_bytes(void *to_p, const void *from_p, const size_t size, size_t cou #define COPY_TYPE_HETEROGENEOUS( TYPENAME, TYPE ) \ static int32_t \ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ - const char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ - char* to, size_t to_length, OPAL_PTRDIFF_TYPE to_extent, \ - OPAL_PTRDIFF_TYPE *advance) \ + const char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_length, ptrdiff_t to_extent, \ + ptrdiff_t *advance) \ { \ uint32_t i; \ \ @@ -92,8 +92,8 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, from += from_extent; \ } \ } \ - } else if ((OPAL_PTRDIFF_TYPE)sizeof(TYPE) == to_extent && \ - (OPAL_PTRDIFF_TYPE)sizeof(TYPE) == from_extent) { \ + } else if ((ptrdiff_t)sizeof(TYPE) == to_extent && \ + (ptrdiff_t)sizeof(TYPE) == from_extent) { \ MEMCPY( to, from, count * sizeof(TYPE) ); \ } else { \ /* source or destination are non-contigous */ \ @@ -110,9 +110,9 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, #define COPY_2SAMETYPE_HETEROGENEOUS( TYPENAME, TYPE ) \ static int32_t \ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ - const char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ - char* to, size_t to_length, OPAL_PTRDIFF_TYPE to_extent, \ - OPAL_PTRDIFF_TYPE *advance) \ + const char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_length, ptrdiff_t to_extent, \ + ptrdiff_t *advance) \ { \ uint32_t i; \ \ @@ -131,8 +131,8 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, from += from_extent; \ } \ } \ - } else if ((OPAL_PTRDIFF_TYPE)sizeof(TYPE) == to_extent && \ - (OPAL_PTRDIFF_TYPE)sizeof(TYPE) == from_extent) { \ + } else if ((ptrdiff_t)sizeof(TYPE) == to_extent && \ + (ptrdiff_t)sizeof(TYPE) == from_extent) { \ MEMCPY( to, from, count * sizeof(TYPE) ); \ } else { \ /* source or destination are non-contigous */ \ @@ -149,9 +149,9 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, #define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \ static int32_t \ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ - const char* from, uint32_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ - char* to, uint32_t to_length, OPAL_PTRDIFF_TYPE to_extent, \ - OPAL_PTRDIFF_TYPE *advance) \ + const char* from, uint32_t from_len, ptrdiff_t from_extent, \ + char* to, uint32_t to_length, ptrdiff_t to_extent, \ + ptrdiff_t *advance) \ { \ uint32_t i; \ \ @@ -173,8 +173,8 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ to += to_extent; \ from += from_extent; \ } \ - } else if ((OPAL_PTRDIFF_TYPE)(sizeof(TYPE1) + sizeof(TYPE2)) == to_extent && \ - (OPAL_PTRDIFF_TYPE)(sizeof(TYPE1) + sizeof(TYPE2)) == from_extent) { \ + } else if ((ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == to_extent && \ + (ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == from_extent) { \ /* source and destination are contigous */ \ MEMCPY( to, from, count * (sizeof(TYPE1) + sizeof(TYPE2)) ); \ } else { \ @@ -192,8 +192,8 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ static inline void datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count, - const char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, - char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent) + const char* from, size_t from_len, ptrdiff_t from_extent, + char* to, size_t to_len, ptrdiff_t to_extent) { /* make sure the remote buffer is large enough to hold the data */ if( (remote_size * *count) > from_len ) { @@ -219,9 +219,9 @@ datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *coun } static int32_t copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, - const char* from, uint32_t from_len, OPAL_PTRDIFF_TYPE from_extent, - char* to, uint32_t to_length, OPAL_PTRDIFF_TYPE to_extent, - OPAL_PTRDIFF_TYPE *advance) + const char* from, uint32_t from_len, ptrdiff_t from_extent, + char* to, uint32_t to_length, ptrdiff_t to_extent, + ptrdiff_t *advance) { uint32_t i; diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h index 34c7b4e1b66..519d370aac3 100644 --- a/opal/datatype/opal_datatype.h +++ b/opal/datatype/opal_datatype.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2015 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -53,9 +53,10 @@ BEGIN_C_DECLS #endif /* * No more than this number of _Basic_ datatypes in C/CPP or Fortran - * are supported (in order to not change setup and usage of btypes). + * are supported (in order to not change setup and usage of the predefined + * datatypes). * - * XXX TODO Adapt to whatever the OMPI-layer needs + * BEWARE: This constant should reflect whatever the OMPI-layer needs. */ #define OPAL_DATATYPE_MAX_SUPPORTED 47 @@ -108,13 +109,14 @@ struct opal_datatype_t { uint32_t bdt_used; /**< bitset of which basic datatypes are used in the data description */ size_t size; /**< total size in bytes of the memory used by the data if the data is put on a contiguous buffer */ - OPAL_PTRDIFF_TYPE true_lb; /**< the true lb of the data without user defined lb and ub */ - OPAL_PTRDIFF_TYPE true_ub; /**< the true ub of the data without user defined lb and ub */ - OPAL_PTRDIFF_TYPE lb; /**< lower bound in memory */ - OPAL_PTRDIFF_TYPE ub; /**< upper bound in memory */ + ptrdiff_t true_lb; /**< the true lb of the data without user defined lb and ub */ + ptrdiff_t true_ub; /**< the true ub of the data without user defined lb and ub */ + ptrdiff_t lb; /**< lower bound in memory */ + ptrdiff_t ub; /**< upper bound in memory */ /* --- cacheline 1 boundary (64 bytes) --- */ size_t nbElems; /**< total number of elements inside the datatype */ uint32_t align; /**< data should be aligned to */ + uint32_t loops; /**< number of loops on the iternal type stack */ /* Attribute fields */ char name[OPAL_MAX_OBJECT_NAME]; /**< name of the datatype */ @@ -123,11 +125,12 @@ struct opal_datatype_t { dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless or in the send case (without conversion) */ - uint32_t btypes[OPAL_DATATYPE_MAX_SUPPORTED]; - /**< basic elements count used to compute the size of the - datatype for remote nodes. The length of the array is dependent on - the maximum number of datatypes of all top layers. - Reason being is that Fortran is not at the OPAL layer. */ + size_t *ptypes; /**< array of basic predefined types that facilitate the computing + of the remote size in heterogeneous environments. The length of the + array is dependent on the maximum number of predefined datatypes of + all language interfaces (because Fortran is not known at the OPAL + layer). This field should never be initialized in homogeneous + environments */ /* --- cacheline 5 boundary (320 bytes) was 32-36 bytes ago --- */ /* size: 352, cachelines: 6, members: 15 */ @@ -226,19 +229,19 @@ OPAL_DECLSPEC void opal_datatype_dump( const opal_datatype_t* pData ); /* data creation functions */ OPAL_DECLSPEC int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * dest_type ); OPAL_DECLSPEC int32_t opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType, opal_datatype_t** newType ); -OPAL_DECLSPEC int32_t opal_datatype_resize( opal_datatype_t* type, OPAL_PTRDIFF_TYPE lb, OPAL_PTRDIFF_TYPE extent ); +OPAL_DECLSPEC int32_t opal_datatype_resize( opal_datatype_t* type, ptrdiff_t lb, ptrdiff_t extent ); OPAL_DECLSPEC int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtAdd, uint32_t count, - OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ); + ptrdiff_t disp, ptrdiff_t extent ); static inline int32_t -opal_datatype_type_lb( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp ) +opal_datatype_type_lb( const opal_datatype_t* pData, ptrdiff_t* disp ) { *disp = pData->lb; return 0; } static inline int32_t -opal_datatype_type_ub( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp ) +opal_datatype_type_ub( const opal_datatype_t* pData, ptrdiff_t* disp ) { *disp = pData->ub; return 0; @@ -252,21 +255,21 @@ opal_datatype_type_size( const opal_datatype_t* pData, size_t *size ) } static inline int32_t -opal_datatype_type_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* extent ) +opal_datatype_type_extent( const opal_datatype_t* pData, ptrdiff_t* extent ) { *extent = pData->ub - pData->lb; return 0; } static inline int32_t -opal_datatype_get_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* lb, OPAL_PTRDIFF_TYPE* extent) +opal_datatype_get_extent( const opal_datatype_t* pData, ptrdiff_t* lb, ptrdiff_t* extent) { *lb = pData->lb; *extent = pData->ub - pData->lb; return 0; } static inline int32_t -opal_datatype_get_true_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* true_lb, OPAL_PTRDIFF_TYPE* true_extent) +opal_datatype_get_true_extent( const opal_datatype_t* pData, ptrdiff_t* true_lb, ptrdiff_t* true_extent) { *true_lb = pData->true_lb; *true_extent = (pData->true_ub - pData->true_lb); @@ -281,6 +284,8 @@ OPAL_DECLSPEC int32_t opal_datatype_copy_content_same_ddt( const opal_datatype_t* pData, int32_t count, char* pDestBuf, char* pSrcBuf ); +OPAL_DECLSPEC int opal_datatype_compute_ptypes( opal_datatype_t* datatype ); + OPAL_DECLSPEC const opal_datatype_t* opal_datatype_match_size( int size, uint16_t datakind, uint16_t datalang ); @@ -297,12 +302,12 @@ opal_datatype_sndrcv( void *sbuf, int32_t scount, const opal_datatype_t* sdtype, OPAL_DECLSPEC int32_t opal_datatype_get_args( const opal_datatype_t* pData, int32_t which, int32_t * ci, int32_t * i, - int32_t * ca, OPAL_PTRDIFF_TYPE* a, + int32_t * ca, ptrdiff_t* a, int32_t * cd, opal_datatype_t** d, int32_t * type); OPAL_DECLSPEC int32_t opal_datatype_set_args( opal_datatype_t* pData, int32_t ci, int32_t ** i, - int32_t ca, OPAL_PTRDIFF_TYPE* a, + int32_t ca, ptrdiff_t* a, int32_t cd, opal_datatype_t** d,int32_t type); OPAL_DECLSPEC int32_t opal_datatype_copy_args( const opal_datatype_t* source_data, @@ -340,12 +345,12 @@ opal_datatype_create_from_packed_description( void** packed_buffer, * Returns: the memory span of count repetition of the datatype, and in the gap * argument, the number of bytes of the gap at the beginning. */ -static inline OPAL_PTRDIFF_TYPE +static inline ptrdiff_t opal_datatype_span( const opal_datatype_t* pData, int64_t count, - OPAL_PTRDIFF_TYPE* gap) + ptrdiff_t* gap) { - OPAL_PTRDIFF_TYPE extent = (pData->ub - pData->lb); - OPAL_PTRDIFF_TYPE true_extent = (pData->true_ub - pData->true_lb); + ptrdiff_t extent = (pData->ub - pData->lb); + ptrdiff_t true_extent = (pData->true_ub - pData->true_lb); if (OPAL_UNLIKELY(0 == pData->size) || (0 == count)) { return 0; } diff --git a/opal/datatype/opal_datatype_add.c b/opal/datatype/opal_datatype_add.c index 890f5503bbd..8876b74e1c7 100644 --- a/opal/datatype/opal_datatype_add.c +++ b/opal/datatype/opal_datatype_add.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2016 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -11,7 +11,9 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,19 +36,19 @@ #define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS)) #if defined(__GNUC__) && !defined(__STDC__) -#define LMAX(A,B) ({ OPAL_PTRDIFF_TYPE _a = (A), _b = (B); (_a < _b ? _b : _a) }) -#define LMIN(A,B) ({ OPAL_PTRDIFF_TYPE _a = (A), _b = (B); (_a < _b ? _a : _b); }) +#define LMAX(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _b : _a) }) +#define LMIN(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _a : _b); }) #define IMAX(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _b : _a); }) #else -static inline OPAL_PTRDIFF_TYPE LMAX( OPAL_PTRDIFF_TYPE a, OPAL_PTRDIFF_TYPE b ) { return ( a < b ? b : a ); } -static inline OPAL_PTRDIFF_TYPE LMIN( OPAL_PTRDIFF_TYPE a, OPAL_PTRDIFF_TYPE b ) { return ( a < b ? a : b ); } +static inline ptrdiff_t LMAX( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? b : a ); } +static inline ptrdiff_t LMIN( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? a : b ); } static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); } #endif /* __GNU__ */ #define OPAL_DATATYPE_COMPUTE_REQUIRED_ENTRIES( _pdtAdd, _count, _extent, _place_needed) \ { \ if( (_pdtAdd)->flags & OPAL_DATATYPE_FLAG_PREDEFINED ) { /* add a basic datatype */ \ - (_place_needed) = ((_extent) == (OPAL_PTRDIFF_TYPE)(_pdtAdd)->size ? 1 : 3); \ + (_place_needed) = ((_extent) == (ptrdiff_t)(_pdtAdd)->size ? 1 : 3); \ } else { \ (_place_needed) = (_pdtAdd)->desc.used; \ if( (_count) != 1 ) { \ @@ -70,7 +72,7 @@ static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); } _new_lb = (_old_lb) + (_disp); \ _new_ub = (_old_ub) + (_disp); \ } else { \ - OPAL_PTRDIFF_TYPE lower, upper; \ + ptrdiff_t lower, upper; \ upper = (_disp) + (_old_extent) * ((_count) - 1); \ lower = (_disp); \ if( lower < upper ) { \ @@ -101,12 +103,12 @@ static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); } * set to ZERO if it's a empty datatype. */ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtAdd, - uint32_t count, OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ) + uint32_t count, ptrdiff_t disp, ptrdiff_t extent ) { uint32_t newLength, place_needed = 0, i; short localFlags = 0; /* no specific options yet */ dt_elem_desc_t *pLast, *pLoop = NULL; - OPAL_PTRDIFF_TYPE lb, ub, true_lb, true_ub, epsilon, old_true_ub; + ptrdiff_t lb, ub, true_lb, true_ub, epsilon, old_true_ub; /** * From MPI-3, page 84, lines 18-20: Most datatype constructors have @@ -130,7 +132,7 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA pdtBase->lb = disp; pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_LB; } - if( (pdtBase->ub - pdtBase->lb) != (OPAL_PTRDIFF_TYPE)pdtBase->size ) { + if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) { pdtBase->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; } return OPAL_SUCCESS; /* Just ignore the OPAL_DATATYPE_LOOP and OPAL_DATATYPE_END_LOOP */ @@ -142,7 +144,7 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA pdtBase->ub = disp; pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_UB; } - if( (pdtBase->ub - pdtBase->lb) != (OPAL_PTRDIFF_TYPE)pdtBase->size ) { + if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) { pdtBase->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; } return OPAL_SUCCESS; /* Just ignore the OPAL_DATATYPE_LOOP and OPAL_DATATYPE_END_LOOP */ @@ -277,25 +279,26 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA * predefined non contiguous datatypes (like MPI_SHORT_INT). */ if( (pdtAdd->flags & (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA)) == (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA) ) { - pdtBase->btypes[pdtAdd->id] += count; + if( NULL != pdtBase->ptypes ) + pdtBase->ptypes[pdtAdd->id] += count; pLast->elem.common.type = pdtAdd->id; pLast->elem.count = count; pLast->elem.disp = disp; pLast->elem.extent = extent; pdtBase->desc.used++; pLast->elem.common.flags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITTED); - if( (extent != (OPAL_PTRDIFF_TYPE)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */ + if( (extent != (ptrdiff_t)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */ pLast->elem.common.flags &= ~(OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS); } } else { /* keep trace of the total number of basic datatypes in the datatype definition */ - pdtBase->btypes[OPAL_DATATYPE_LOOP] += pdtAdd->btypes[OPAL_DATATYPE_LOOP]; - pdtBase->btypes[OPAL_DATATYPE_END_LOOP] += pdtAdd->btypes[OPAL_DATATYPE_END_LOOP]; - pdtBase->btypes[OPAL_DATATYPE_LB] |= pdtAdd->btypes[OPAL_DATATYPE_LB]; - pdtBase->btypes[OPAL_DATATYPE_UB] |= pdtAdd->btypes[OPAL_DATATYPE_UB]; - for( i = 4; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) - if( pdtAdd->btypes[i] != 0 ) pdtBase->btypes[i] += (count * pdtAdd->btypes[i]); - + pdtBase->loops += pdtAdd->loops; + pdtBase->flags |= (pdtAdd->flags & OPAL_DATATYPE_FLAG_USER_LB); + pdtBase->flags |= (pdtAdd->flags & OPAL_DATATYPE_FLAG_USER_UB); + if( (NULL != pdtBase->ptypes) && (NULL != pdtAdd->ptypes) ) { + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) + if( pdtAdd->ptypes[i] != 0 ) pdtBase->ptypes[i] += (count * pdtAdd->ptypes[i]); + } if( (1 == pdtAdd->desc.used) && (extent == (pdtAdd->ub - pdtAdd->lb)) && (extent == pdtAdd->desc.desc[0].elem.extent) ){ pLast->elem = pdtAdd->desc.desc[0].elem; @@ -310,7 +313,7 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA pLoop = pLast; CREATE_LOOP_START( pLast, count, pdtAdd->desc.used + 1, extent, (pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITTED)) ); - pdtBase->btypes[OPAL_DATATYPE_LOOP] += 2; + pdtBase->loops += 2; pdtBase->desc.used += 2; pLast++; } @@ -344,11 +347,11 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA UNSET_CONTIGUOUS_FLAG(pdtBase->flags); if( (localFlags & OPAL_DATATYPE_FLAG_CONTIGUOUS) /* both type were contiguous */ && ((disp + pdtAdd->true_lb) == old_true_ub) /* and there is no gap between them */ - && ( ((OPAL_PTRDIFF_TYPE)pdtAdd->size == extent) /* the size and the extent of the + && ( ((ptrdiff_t)pdtAdd->size == extent) /* the size and the extent of the * added type have to match */ || (count < 2)) ) { /* if the count is bigger than 2 */ SET_CONTIGUOUS_FLAG(pdtBase->flags); - if( (OPAL_PTRDIFF_TYPE)pdtBase->size == (pdtBase->ub - pdtBase->lb) ) + if( (ptrdiff_t)pdtBase->size == (pdtBase->ub - pdtBase->lb) ) SET_NO_GAP_FLAG(pdtBase->flags); } diff --git a/opal/datatype/opal_datatype_clone.c b/opal/datatype/opal_datatype_clone.c index 05f57c88cd8..fa4479982d0 100644 --- a/opal/datatype/opal_datatype_clone.c +++ b/opal/datatype/opal_datatype_clone.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -61,6 +61,9 @@ int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * dest_type->opt_desc.used = src_type->opt_desc.used; memcpy( dest_type->opt_desc.desc, src_type->opt_desc.desc, desc_length * sizeof(dt_elem_desc_t) ); } + } else { + assert( NULL == dest_type->opt_desc.desc ); + assert( 0 == dest_type->opt_desc.length ); } } dest_type->id = src_type->id; /* preserve the default id. This allow us to diff --git a/opal/datatype/opal_datatype_copy.c b/opal/datatype/opal_datatype_copy.c index d1027a2d63e..7bf94ef97b9 100644 --- a/opal/datatype/opal_datatype_copy.c +++ b/opal/datatype/opal_datatype_copy.c @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -99,7 +99,7 @@ static size_t opal_datatype_memop_block_size = 128 * 1024; int32_t opal_datatype_copy_content_same_ddt( const opal_datatype_t* datatype, int32_t count, char* destination_base, char* source_base ) { - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; int32_t (*fct)( const opal_datatype_t*, int32_t, char*, char*); #if OPAL_CUDA_SUPPORT diff --git a/opal/datatype/opal_datatype_copy.h b/opal/datatype/opal_datatype_copy.h index 5557142b1fd..5dcfe2ec5d3 100644 --- a/opal/datatype/opal_datatype_copy.h +++ b/opal/datatype/opal_datatype_copy.h @@ -1,10 +1,10 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2012 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -98,7 +98,7 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, size_t _copy_loops = (COUNT); uint32_t _i; - if( _loop->extent == (OPAL_PTRDIFF_TYPE)_end_loop->size ) { /* the loop is contiguous */ + if( _loop->extent == (ptrdiff_t)_end_loop->size ) { /* the loop is contiguous */ _copy_loops *= _end_loop->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_loops, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); @@ -140,13 +140,13 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i * do a MEM_OP. */ if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - OPAL_PTRDIFF_TYPE extent = (datatype->ub - datatype->lb); + ptrdiff_t extent = (datatype->ub - datatype->lb); /* Now that we know the datatype is contiguous, we should move the 2 pointers * source and destination to the correct displacement. */ destination += datatype->true_lb; source += datatype->true_lb; - if( (OPAL_PTRDIFF_TYPE)datatype->size == extent ) { /* all contiguous == no gaps around */ + if( (ptrdiff_t)datatype->size == extent ) { /* all contiguous == no gaps around */ size_t total_length = iov_len_local; size_t memop_chunk = opal_datatype_memop_block_size; while( total_length > 0 ) { @@ -179,7 +179,7 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i return 0; /* completed */ } - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 1) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->loops + 1) ); pStack->count = count; pStack->index = -1; pStack->disp = 0; @@ -233,14 +233,14 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i (int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)source; + ptrdiff_t local_disp = (ptrdiff_t)source; if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { _contiguous_loop( pElem, datatype, (unsigned char*)source_base, count, count_desc, source, destination, &iov_len_local ); pos_desc += pElem->loop.items + 1; goto update_loop_description; } - local_disp = (OPAL_PTRDIFF_TYPE)source - local_disp; + local_disp = (ptrdiff_t)source - local_disp; PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; diff --git a/opal/datatype/opal_datatype_create.c b/opal/datatype/opal_datatype_create.c index e64e1f04190..0e6d49b9bd7 100644 --- a/opal/datatype/opal_datatype_create.c +++ b/opal/datatype/opal_datatype_create.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -30,8 +30,6 @@ static void opal_datatype_construct( opal_datatype_t* pData ) { - int i; - pData->size = 0; pData->flags = OPAL_DATATYPE_FLAG_CONTIGUOUS; pData->id = 0; @@ -53,32 +51,36 @@ static void opal_datatype_construct( opal_datatype_t* pData ) pData->opt_desc.length = 0; pData->opt_desc.used = 0; - for( i = 0; i < OPAL_DATATYPE_MAX_SUPPORTED; i++ ) - pData->btypes[i] = 0; + pData->ptypes = NULL; + pData->loops = 0; } static void opal_datatype_destruct( opal_datatype_t* datatype ) { + /** + * As the default description and the optimized description might point to the + * same data description we should start by cleaning the optimized description. + */ + if( NULL != datatype->opt_desc.desc ) { + if( datatype->opt_desc.desc != datatype->desc.desc ) + free( datatype->opt_desc.desc ); + datatype->opt_desc.length = 0; + datatype->opt_desc.used = 0; + datatype->opt_desc.desc = NULL; + } if (!opal_datatype_is_predefined(datatype)) { - if( datatype->desc.desc != NULL ) { + if( NULL != datatype->desc.desc ) { free( datatype->desc.desc ); datatype->desc.length = 0; datatype->desc.used = 0; + datatype->desc.desc = NULL; } } - if( datatype->opt_desc.desc != NULL ) { - if( datatype->opt_desc.desc != datatype->desc.desc ) - free( datatype->opt_desc.desc ); - datatype->opt_desc.length = 0; - datatype->opt_desc.used = 0; - datatype->opt_desc.desc = NULL; + /* dont free the ptypes of predefined types (it was not dynamically allocated) */ + if( (NULL != datatype->ptypes) && (datatype->id >= OPAL_DATATYPE_MAX_PREDEFINED) ) { + free(datatype->ptypes); + datatype->ptypes = NULL; } - /** - * As the default description and the optimized description can point to the - * same memory location we should keep the default location pointer until we - * know what we should do with the optimized description. - */ - datatype->desc.desc = NULL; /* make sure the name is set to empty */ datatype->name[0] = '\0'; diff --git a/opal/datatype/opal_datatype_dump.c b/opal/datatype/opal_datatype_dump.c index 30575674196..8ec86ee63a8 100644 --- a/opal/datatype/opal_datatype_dump.c +++ b/opal/datatype/opal_datatype_dump.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -42,8 +42,14 @@ int opal_datatype_contain_basic_datatypes( const opal_datatype_t* pData, char* p if( pData->flags & OPAL_DATATYPE_FLAG_USER_LB ) index += snprintf( ptr, length - index, "lb " ); if( pData->flags & OPAL_DATATYPE_FLAG_USER_UB ) index += snprintf( ptr + index, length - index, "ub " ); for( i = 0; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { - if( pData->bdt_used & mask ) - index += snprintf( ptr + index, length - index, "%s ", opal_datatype_basicDatatypes[i]->name ); + if( pData->bdt_used & mask ) { + if( NULL == pData->ptypes ) { + index += snprintf( ptr + index, length - index, "%s:* ", opal_datatype_basicDatatypes[i]->name ); + } else { + index += snprintf( ptr + index, length - index, "%s:%lu ", opal_datatype_basicDatatypes[i]->name, + pData->ptypes[i]); + } + } mask <<= 1; if( length <= (size_t)index ) break; } @@ -115,7 +121,7 @@ void opal_datatype_dump( const opal_datatype_t* pData ) (void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, (long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), (long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), - (int)pData->nbElems, (int)pData->btypes[OPAL_DATATYPE_LOOP], (int)pData->flags ); + (int)pData->nbElems, (int)pData->loops, (int)pData->flags ); /* dump the flags */ if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED ) index += snprintf( buffer + index, length - index, "predefined " ); diff --git a/opal/datatype/opal_datatype_fake_stack.c b/opal/datatype/opal_datatype_fake_stack.c index 4f72b343672..d336f6cf76d 100644 --- a/opal/datatype/opal_datatype_fake_stack.c +++ b/opal/datatype/opal_datatype_fake_stack.c @@ -3,14 +3,16 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2017 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,21 +34,8 @@ #include "opal/datatype/opal_datatype_internal.h" -int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, - size_t starting_point, - const size_t* sizes ); - -static inline size_t -opal_convertor_compute_remote_size( const opal_datatype_t* pData, const size_t* sizes ) -{ - uint32_t i; - size_t length = 0; - - for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { - length += (pData->btypes[i] * sizes[i]); - } - return length; -} +extern int opal_convertor_create_stack_with_pos_general( opal_convertor_t* convertor, + size_t starting_point, const size_t* sizes ); int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, size_t starting_point, const size_t* sizes ) @@ -78,7 +67,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, if( (pConvertor->flags & CONVERTOR_HOMOGENEOUS) && (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { /* Special case for contiguous datatypes */ int32_t cnt = (int32_t)(starting_point / pData->size); - OPAL_PTRDIFF_TYPE extent = pData->ub - pData->lb; + ptrdiff_t extent = pData->ub - pData->lb; loop_length = GET_FIRST_NON_LOOP( pElems ); pStack[0].disp = pElems[loop_length].elem.disp; @@ -90,7 +79,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, pStack[1].disp = pStack[0].disp; pStack[1].count = pData->size - cnt; - if( (OPAL_PTRDIFF_TYPE)pData->size == extent ) { /* all elements are contiguous */ + if( (ptrdiff_t)pData->size == extent ) { /* all elements are contiguous */ pStack[1].disp += starting_point; } else { /* each is contiguous but there are gaps inbetween */ pStack[1].disp += (pConvertor->count - pStack[0].count) * extent + cnt; @@ -102,7 +91,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, } /* remove from the main loop all the complete datatypes */ - remote_size = opal_convertor_compute_remote_size( pData, sizes ); + remote_size = opal_convertor_compute_remote_size( pConvertor ); count = (int32_t)(starting_point / remote_size); resting_place -= (remote_size * count); pStack->count = pConvertor->count - count; @@ -112,7 +101,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, pStack->disp = count * (pData->ub - pData->lb) + pElems[loop_length].elem.disp; pos_desc = 0; - remoteLength = (size_t*)alloca( sizeof(size_t) * (pConvertor->pDesc->btypes[OPAL_DATATYPE_LOOP] + 1)); + remoteLength = (size_t*)alloca( sizeof(size_t) * (pConvertor->pDesc->loops + 1)); remoteLength[0] = 0; /* initial value set to ZERO */ loop_length = 0; @@ -122,7 +111,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, while( pos_desc < (int32_t)pConvertor->use_desc->used ) { if( OPAL_DATATYPE_END_LOOP == pElems->elem.common.type ) { /* end of the current loop */ ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)pElems; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; if( (loop_length * pStack->count) > resting_place ) { /* We will stop somewhere on this loop. To avoid moving inside the loop diff --git a/opal/datatype/opal_datatype_get_count.c b/opal/datatype/opal_datatype_get_count.c index 7b539fbec81..9f1b0ecf8e5 100644 --- a/opal/datatype/opal_datatype_get_count.c +++ b/opal/datatype/opal_datatype_get_count.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. @@ -39,9 +39,9 @@ ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t /* Normally the size should be less or equal to the size of the datatype. * This function does not support a iSize bigger than the size of the datatype. */ - assert( (uint32_t)iSize <= datatype->size ); - DUMP( "dt_count_elements( %p, %d )\n", (void*)datatype, iSize ); - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 2) ); + assert( iSize <= datatype->size ); + DUMP( "dt_count_elements( %p, %ul )\n", (void*)datatype, (unsigned long)iSize ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->loops + 2) ); pStack->count = 1; pStack->index = -1; pStack->disp = 0; @@ -53,8 +53,10 @@ ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t if( --(pStack->count) == 0 ) { /* end of loop */ stack_pos--; pStack--; if( stack_pos == -1 ) return nbElems; /* completed */ + pos_desc++; /* advance to the next element after the end loop */ + } else { + pos_desc = pStack->index + 1; /* go back to the begining of the loop */ } - pos_desc = pStack->index + 1; continue; } if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) { @@ -93,9 +95,7 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t /** * Handle all complete multiple of the datatype. */ - for( pos_desc = 4; pos_desc < OPAL_DATATYPE_MAX_PREDEFINED; pos_desc++ ) { - local_length += datatype->btypes[pos_desc]; - } + local_length = datatype->nbElems; pos_desc = count / local_length; count = count % local_length; *length = datatype->size * pos_desc; @@ -104,7 +104,7 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t } DUMP( "dt_set_element_count( %p, %d )\n", (void*)datatype, count ); - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 2) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->loops + 2) ); pStack->count = 1; pStack->index = -1; pStack->disp = 0; @@ -116,8 +116,10 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t if( --(pStack->count) == 0 ) { /* end of loop */ stack_pos--; pStack--; if( stack_pos == -1 ) return 0; + pos_desc++; /* advance to the next element after the end loop */ + } else { + pos_desc = pStack->index + 1; /* go back to the begining of the loop */ } - pos_desc = pStack->index + 1; continue; } if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) { @@ -143,3 +145,56 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t } } +/** + * Compute the array of counts of the predefined datatypes contained in + * the datatype. We have no simple way to create this array, as we only + * sporadically need it (when we deal with heterogeneous environments or + * when we use get_element_count). Thus, we will pay the cost once per + * datatype, but we will only update this array if/when needed. + */ +int opal_datatype_compute_ptypes( opal_datatype_t* datatype ) +{ + dt_stack_t* pStack; /* pointer to the position on the stack */ + uint32_t pos_desc; /* actual position in the description of the derived datatype */ + ssize_t nbElems = 0, stack_pos = 0; + dt_elem_desc_t* pElems; + + if( NULL != datatype->ptypes ) return 0; + datatype->ptypes = (size_t*)calloc(OPAL_DATATYPE_MAX_SUPPORTED, sizeof(size_t)); + + DUMP( "opal_datatype_compute_ptypes( %p )\n", (void*)datatype ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->loops + 2) ); + pStack->count = 1; + pStack->index = -1; + pStack->disp = 0; + pElems = datatype->desc.desc; + pos_desc = 0; + + while( 1 ) { /* loop forever the exit condition is on the last OPAL_DATATYPE_END_LOOP */ + if( OPAL_DATATYPE_END_LOOP == pElems[pos_desc].elem.common.type ) { /* end of the current loop */ + if( --(pStack->count) == 0 ) { /* end of loop */ + stack_pos--; pStack--; + if( stack_pos == -1 ) return 0; /* completed */ + pos_desc++; /* advance to the next element after the end loop */ + } else { + pos_desc = pStack->index + 1; /* go back to the begining of the loop */ + } + continue; + } + if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) { + ddt_loop_desc_t* loop = &(pElems[pos_desc].loop); + do { + PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 ); + pos_desc++; + } while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */ + DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" ); + } + while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + /* now here we have a basic datatype */ + datatype->ptypes[pElems[pos_desc].elem.common.type] += pElems[pos_desc].elem.count; + nbElems += pElems[pos_desc].elem.count; + + pos_desc++; /* advance to the next data */ + } + } +} diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index 5fdd2c59d96..9ff34921495 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2012 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -13,7 +13,9 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -153,10 +155,10 @@ typedef struct ddt_elem_id_description ddt_elem_id_description; */ struct ddt_elem_desc { ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t count; /**< number of blocks */ uint32_t blocklen; /**< number of elements on each block */ - OPAL_PTRDIFF_TYPE extent; /**< extent of each block (in bytes) */ - OPAL_PTRDIFF_TYPE disp; /**< displacement of the first block */ + size_t count; /**< number of blocks */ + ptrdiff_t extent; /**< extent of each block (in bytes) */ + ptrdiff_t disp; /**< displacement of the first block */ }; typedef struct ddt_elem_desc ddt_elem_desc_t; @@ -170,10 +172,10 @@ typedef struct ddt_elem_desc ddt_elem_desc_t; */ struct ddt_loop_desc { ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t loops; /**< number of elements */ uint32_t items; /**< number of items in the loop */ + uint32_t loops; /**< number of elements */ size_t unused; /**< not used right now */ - OPAL_PTRDIFF_TYPE extent; /**< extent of the whole loop */ + ptrdiff_t extent; /**< extent of the whole loop */ }; typedef struct ddt_loop_desc ddt_loop_desc_t; @@ -182,7 +184,7 @@ struct ddt_endloop_desc { uint32_t items; /**< number of elements */ uint32_t unused; /**< not used right now */ size_t size; /**< real size of the data in the loop */ - OPAL_PTRDIFF_TYPE first_elem_disp; /**< the displacement of the first block in the loop */ + ptrdiff_t first_elem_disp; /**< the displacement of the first block in the loop */ }; typedef struct ddt_endloop_desc ddt_endloop_desc_t; @@ -212,13 +214,20 @@ union dt_elem_desc { (_place)->end_loop.unused = -1; \ } while(0) + +/** + * Create one or more elements depending on the value of _count. If the value + * is too large for the type of elem.count then use oth the elem.count and + * elem.blocklen to create it. If the number is prime then create a second + * element to account for the difference. + */ #define CREATE_ELEM( _place, _type, _flags, _count, _disp, _extent ) \ do { \ (_place)->elem.common.flags = (_flags) | OPAL_DATATYPE_FLAG_DATA; \ (_place)->elem.common.type = (_type); \ - (_place)->elem.count = (_count); \ (_place)->elem.disp = (_disp); \ (_place)->elem.extent = (_extent); \ + (_place)->elem.count = (_count); \ (_place)->elem.blocklen = 1; \ } while(0) /* @@ -236,8 +245,8 @@ struct opal_datatype_t; * OPAL_DATATYPE_INIT_BTYPES_ARRAY_[0-21], then order and naming would _not_ matter.... */ -#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE { 0 } -#define OPAL_DATATYPE_INIT_BTYPES_ARRAY(NAME) { [OPAL_DATATYPE_ ## NAME] = 1 } +#define OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE NULL +#define OPAL_DATATYPE_INIT_PTYPES_ARRAY(NAME) (size_t[OPAL_DATATYPE_MAX_PREDEFINED]){ [OPAL_DATATYPE_ ## NAME] = 1, [OPAL_DATATYPE_MAX_PREDEFINED-1] = 0 } #define OPAL_DATATYPE_INIT_NAME(NAME) "OPAL_" #NAME @@ -266,7 +275,7 @@ struct opal_datatype_t; .name = OPAL_DATATYPE_INIT_NAME(NAME), \ .desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(UNAVAILABLE), \ .opt_desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(UNAVAILABLE), \ - .btypes = OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE \ + .ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE \ } #define OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) \ @@ -285,7 +294,7 @@ struct opal_datatype_t; .name = OPAL_DATATYPE_INIT_NAME(EMPTY), \ .desc = OPAL_DATATYPE_INIT_DESC_NULL, \ .opt_desc = OPAL_DATATYPE_INIT_DESC_NULL, \ - .btypes = OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE \ + .ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE \ } #define OPAL_DATATYPE_INIT_BASIC_TYPE( TYPE, NAME, FLAGS ) \ @@ -301,7 +310,7 @@ struct opal_datatype_t; .name = OPAL_DATATYPE_INIT_NAME(NAME), \ .desc = OPAL_DATATYPE_INIT_DESC_NULL, \ .opt_desc = OPAL_DATATYPE_INIT_DESC_NULL, \ - .btypes = OPAL_DATATYPE_INIT_BTYPES_ARRAY(NAME) \ + .ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE \ } #define OPAL_DATATYPE_INIT_BASIC_DATATYPE( TYPE, ALIGN, NAME, FLAGS ) \ @@ -317,7 +326,7 @@ struct opal_datatype_t; .name = OPAL_DATATYPE_INIT_NAME(NAME), \ .desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(NAME), \ .opt_desc = OPAL_DATATYPE_INIT_DESC_PREDEFINED(NAME), \ - .btypes = OPAL_DATATYPE_INIT_BTYPES_ARRAY(NAME) \ + .ptypes = OPAL_DATATYPE_INIT_PTYPES_ARRAY_UNAVAILABLE \ } #define OPAL_DATATYPE_INITIALIZER_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LOOP, LOOP, FLAGS ) @@ -474,7 +483,10 @@ static inline int GET_FIRST_NON_LOOP( const union dt_elem_desc* _pElem ) #define UPDATE_INTERNAL_COUNTERS( DESCRIPTION, POSITION, ELEMENT, COUNTER ) \ do { \ (ELEMENT) = &((DESCRIPTION)[(POSITION)]); \ - (COUNTER) = (ELEMENT)->elem.count; \ + if( OPAL_DATATYPE_LOOP == (ELEMENT)->elem.common.type ) \ + (COUNTER) = (ELEMENT)->loop.loops; \ + else \ + (COUNTER) = (ELEMENT)->elem.count; \ } while (0) OPAL_DECLSPEC int opal_datatype_contain_basic_datatypes( const struct opal_datatype_t* pData, char* ptr, size_t length ); diff --git a/opal/datatype/opal_datatype_optimize.c b/opal/datatype/opal_datatype_optimize.c index 5b66e4df595..882e3a8d979 100644 --- a/opal/datatype/opal_datatype_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -42,21 +42,22 @@ static int32_t opal_datatype_optimize_short( opal_datatype_t* pData, - int32_t count, - dt_type_desc_t* pTypeDesc ) + int32_t count, + dt_type_desc_t* pTypeDesc ) { dt_elem_desc_t* pElemDesc; ddt_elem_desc_t opt_elem; dt_stack_t* pOrigStack; dt_stack_t* pStack; /* pointer to the position on the stack */ int32_t pos_desc = 0; /* actual position in the description of the derived datatype */ - int32_t stack_pos = 0, last_type = OPAL_DATATYPE_UINT1, last_length = 0; + int32_t stack_pos = 0, last_type = OPAL_DATATYPE_UINT1; int32_t type = OPAL_DATATYPE_LOOP, nbElems = 0, continuity; - OPAL_PTRDIFF_TYPE total_disp = 0, last_extent = 1, last_disp = 0; + ptrdiff_t total_disp = 0, last_extent = 1, last_disp = 0; uint16_t last_flags = 0xFFFF; /* keep all for the first datatype */ uint32_t i; + size_t last_length = 0; - pOrigStack = pStack = (dt_stack_t*)malloc( sizeof(dt_stack_t) * (pData->btypes[OPAL_DATATYPE_LOOP]+2) ); + pOrigStack = pStack = (dt_stack_t*)malloc( sizeof(dt_stack_t) * (pData->loops+2) ); SAVE_STACK( pStack, -1, 0, count, 0 ); pTypeDesc->length = 2 * pData->desc.used + 1 /* for the fake OPAL_DATATYPE_END_LOOP at the end */; @@ -85,7 +86,7 @@ opal_datatype_optimize_short( opal_datatype_t* pData, pElemDesc++; nbElems++; if( --stack_pos >= 0 ) { /* still something to do ? */ ddt_loop_desc_t* pStartLoop = &(pTypeDesc->desc[pStack->index - 1].loop); - pStartLoop->items = (pElemDesc - 1)->elem.count; + pStartLoop->items = end_loop->items; total_disp = pStack->disp; /* update the displacement position */ } pStack--; /* go down one position on the stack */ @@ -96,13 +97,13 @@ opal_datatype_optimize_short( opal_datatype_t* pData, ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]); ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]); int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) ); - OPAL_PTRDIFF_TYPE loop_disp = pData->desc.desc[pos_desc + index].elem.disp; + ptrdiff_t loop_disp = pData->desc.desc[pos_desc + index].elem.disp; - continuity = ((last_disp + last_length * (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[last_type]->size) - == (total_disp + loop_disp)); + continuity = ((last_disp + (ptrdiff_t)last_length * (ptrdiff_t)opal_datatype_basicDatatypes[last_type]->size) + == (total_disp + loop_disp)); if( loop->common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { /* the loop is contiguous or composed by contiguous elements with a gap */ - if( loop->extent == (OPAL_PTRDIFF_TYPE)end_loop->size ) { + if( loop->extent == (ptrdiff_t)end_loop->size ) { /* the whole loop is contiguous */ if( !continuity ) { if( 0 != last_length ) { @@ -119,7 +120,7 @@ opal_datatype_optimize_short( opal_datatype_t* pData, last_extent = 1; } else { int counter = loop->loops; - OPAL_PTRDIFF_TYPE merged_disp = 0; + ptrdiff_t merged_disp = 0; /* if the previous data is contiguous with this piece and it has a length not ZERO */ if( last_length != 0 ) { if( continuity ) { @@ -175,14 +176,14 @@ opal_datatype_optimize_short( opal_datatype_t* pData, } if( 2 == loop->items ) { /* small loop */ if( (1 == elem->count) - && (elem->extent == (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[elem->common.type]->size) ) { + && (elem->extent == (ptrdiff_t)opal_datatype_basicDatatypes[elem->common.type]->size) ) { CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~OPAL_DATATYPE_FLAG_CONTIGUOUS, loop->loops, elem->disp, loop->extent ); pElemDesc++; nbElems++; pos_desc += loop->items + 1; goto complete_loop; } else if( loop->loops < 3 ) { - OPAL_PTRDIFF_TYPE elem_displ = elem->disp; + ptrdiff_t elem_displ = elem->disp; for( i = 0; i < loop->loops; i++ ) { CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags, elem->count, elem_displ, elem->extent ); @@ -206,7 +207,7 @@ opal_datatype_optimize_short( opal_datatype_t* pData, while( pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */ /* now here we have a basic datatype */ type = pData->desc.desc[pos_desc].elem.common.type; - continuity = ((last_disp + last_length * (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[last_type]->size) + continuity = ((last_disp + (ptrdiff_t)last_length * (ptrdiff_t)opal_datatype_basicDatatypes[last_type]->size) == (total_disp + pData->desc.desc[pos_desc].elem.disp)); if( (pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && continuity && @@ -254,7 +255,7 @@ opal_datatype_optimize_short( opal_datatype_t* pData, int32_t opal_datatype_commit( opal_datatype_t * pData ) { ddt_endloop_desc_t* pLast = &(pData->desc.desc[pData->desc.used].end_loop); - OPAL_PTRDIFF_TYPE first_elem_disp = 0; + ptrdiff_t first_elem_disp = 0; if( pData->flags & OPAL_DATATYPE_FLAG_COMMITTED ) return OPAL_SUCCESS; pData->flags |= OPAL_DATATYPE_FLAG_COMMITTED; diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index 08ae1ecf7ac..9af53f4dd58 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -11,7 +11,9 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -66,7 +68,7 @@ opal_pack_homogeneous_contig_function( opal_convertor_t* pConv, unsigned char *source_base = NULL; uint32_t iov_count; size_t length = pConv->local_size - pConv->bConverted, initial_amount = pConv->bConverted; - OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; source_base = (pConv->pBaseBuf + initial_displ + pStack[0].disp + pStack[1].disp); @@ -114,10 +116,10 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, unsigned char *user_memory, *packed_buffer; uint32_t i, index, iov_count; size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; - OPAL_PTRDIFF_TYPE extent= pData->ub - pData->lb; - OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + ptrdiff_t extent= pData->ub - pData->lb; + ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; - assert( (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && ((OPAL_PTRDIFF_TYPE)pData->size != extent) ); + assert( (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && ((ptrdiff_t)pData->size != extent) ); DO_DEBUG( opal_output( 0, "pack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", (void*)pConv->pBaseBuf, *out_size ); ); if( stack[1].type != opal_datatype_uint1.id ) { @@ -354,7 +356,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr; + ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, conv_ptr, iov_ptr, iov_len_local ); @@ -364,7 +366,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr - local_disp; + local_disp = (ptrdiff_t)conv_ptr - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; @@ -417,7 +419,7 @@ pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR, const opal_convertor_master_t* master = (CONVERTOR)->master; const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (*SOURCE) + _elem->disp; - OPAL_PTRDIFF_TYPE advance; + ptrdiff_t advance; uint32_t _count = *(COUNT); size_t _r_blength; @@ -430,8 +432,8 @@ pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR, OPAL_DATATYPE_SAFEGUARD_POINTER( _source, (_count * _elem->extent), (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack [l %s r %s] memcpy( %p, %p, %lu ) => space %lu\n", - ((OPAL_PTRDIFF_TYPE)(opal_datatype_basicDatatypes[_elem->common.type]->size) == _elem->extent) ? "cont" : "----", - ((OPAL_PTRDIFF_TYPE)_r_blength == _elem->extent) ? "cont" : "----", + ((ptrdiff_t)(opal_datatype_basicDatatypes[_elem->common.type]->size) == _elem->extent) ? "cont" : "----", + ((ptrdiff_t)_r_blength == _elem->extent) ? "cont" : "----", (void*)*(DESTINATION), (void*)_source, (unsigned long)_r_blength, (unsigned long)(*(SPACE)) ); ); master->pFunctions[_elem->common.type]( CONVERTOR, _count, @@ -542,7 +544,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor, count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr; + ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; #if 0 if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, @@ -554,7 +556,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor, /* Save the stack with the correct last_count value. */ } #endif /* in a heterogeneous environment we can't handle the contiguous loops */ - local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr - local_disp; + local_disp = (ptrdiff_t)conv_ptr - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 541a4fbe24d..2176e53e897 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -5,6 +5,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +46,7 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, if( 0 == _copy_count ) return; /* nothing to do */ } - if( (OPAL_PTRDIFF_TYPE)_copy_blength == _elem->extent ) { + if( (ptrdiff_t)_copy_blength == _elem->extent ) { _copy_blength *= _copy_count; /* the extent and the size of the basic datatype are equal */ OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index c710a4ae3e2..a4a088ffbdb 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -11,8 +11,8 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -121,7 +121,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem; /* current position */ unsigned char *base_pointer = pConvertor->pBaseBuf; size_t iov_len_local; - OPAL_PTRDIFF_TYPE extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; + ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; DUMP( "opal_convertor_generic_simple_position( %p, &%ld )\n", (void*)pConvertor, (long)*position ); assert(*position > pConvertor->bConverted); @@ -207,7 +207,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)base_pointer; + ptrdiff_t local_disp = (ptrdiff_t)base_pointer; if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { POSITION_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, base_pointer, iov_len_local ); @@ -217,7 +217,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (OPAL_PTRDIFF_TYPE)base_pointer - local_disp; + local_disp = (ptrdiff_t)base_pointer - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp ); pos_desc++; diff --git a/opal/datatype/opal_datatype_resize.c b/opal/datatype/opal_datatype_resize.c index b239c675b02..62147645fc5 100644 --- a/opal/datatype/opal_datatype_resize.c +++ b/opal/datatype/opal_datatype_resize.c @@ -4,7 +4,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -18,13 +18,13 @@ #include "opal/datatype/opal_datatype.h" #include "opal/datatype/opal_datatype_internal.h" -int32_t opal_datatype_resize( opal_datatype_t* type, OPAL_PTRDIFF_TYPE lb, OPAL_PTRDIFF_TYPE extent ) +int32_t opal_datatype_resize( opal_datatype_t* type, ptrdiff_t lb, ptrdiff_t extent ) { type->lb = lb; type->ub = lb + extent; type->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; - if( (extent == (OPAL_PTRDIFF_TYPE)type->size) && + if( (extent == (ptrdiff_t)type->size) && (type->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { type->flags |= OPAL_DATATYPE_FLAG_NO_GAPS; } diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index 195bca48f1e..ec046a99001 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -12,7 +12,9 @@ * All rights reserved. * Copyright (c) 2008-2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -71,8 +73,8 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, uint32_t iov_count, i; size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; dt_stack_t* stack = pConv->pStack; - OPAL_PTRDIFF_TYPE extent = pData->ub - pData->lb; - OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + ptrdiff_t extent = pData->ub - pData->lb; + ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", (void*)pConv->pBaseBuf, *out_size ); ); @@ -89,7 +91,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, bConverted = remaining; /* how much will get unpacked this time */ user_memory = pConv->pBaseBuf + initial_displ; - if( (OPAL_PTRDIFF_TYPE)pData->size == extent ) { + if( (ptrdiff_t)pData->size == extent ) { user_memory += pConv->bConverted; DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %lu\n", (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); @@ -177,7 +179,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, static inline uint32_t opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem, unsigned char* partial_data, - OPAL_PTRDIFF_TYPE start_position, OPAL_PTRDIFF_TYPE length, + ptrdiff_t start_position, ptrdiff_t length, unsigned char** user_buffer ) { char unused_byte = 0x7F, saved_data[16]; @@ -377,7 +379,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, (long)pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { - OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr; + ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { UNPACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, iov_ptr, conv_ptr, iov_len_local ); @@ -387,7 +389,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (OPAL_PTRDIFF_TYPE)conv_ptr - local_disp; + local_disp = (ptrdiff_t)conv_ptr - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; @@ -448,7 +450,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, uint32_t iov_count; const opal_convertor_master_t* master = pConvertor->master; - OPAL_PTRDIFF_TYPE advance; /* number of bytes that we should advance the buffer */ + ptrdiff_t advance; /* number of bytes that we should advance the buffer */ int32_t rc; DO_DEBUG( opal_output( 0, "opal_convertor_general_unpack( %p, {%p, %lu}, %u )\n", @@ -500,6 +502,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, conv_ptr = pConvertor->pBaseBuf + pStack->disp; pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); + if( 0 == iov_len_local ) goto complete_loop; /* escape if we're done */ continue; } conv_ptr += rc * description[pos_desc].elem.extent; diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index bbc8d30e39f..44f7505a58c 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -5,6 +5,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +45,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ if( 0 == _copy_count ) return; /* nothing to do */ } - if( (OPAL_PTRDIFF_TYPE)_copy_blength == _elem->extent ) { + if( (ptrdiff_t)_copy_blength == _elem->extent ) { _copy_blength *= _copy_count; /* the extent and the size of the basic datatype are equal */ OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index 2fed0820ea6..a84a889a2fd 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -13,7 +13,7 @@ * Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. * $COPYRIGHT$ @@ -260,10 +260,6 @@ **********************************************************************/ #if OMPI_BUILDING -#ifndef HAVE_PTRDIFF_T -typedef OPAL_PTRDIFF_TYPE ptrdiff_t; -#endif - /* * Maximum size of a filename path. */ diff --git a/test/datatype/Makefile.am b/test/datatype/Makefile.am index 9c9aaa4a1a0..cd867134a4f 100644 --- a/test/datatype/Makefile.am +++ b/test/datatype/Makefile.am @@ -18,7 +18,7 @@ if PROJECT_OMPI MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw unpack_ooo ddt_pack external32 MPI_CHECKS = to_self endif -TESTS = opal_datatype_test $(MPI_TESTS) +TESTS = opal_datatype_test unpack_hetero $(MPI_TESTS) check_PROGRAMS = $(TESTS) $(MPI_CHECKS) @@ -79,5 +79,10 @@ external32_LDADD = \ $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la +unpack_hetero_SOURCES = unpack_hetero.c +unpack_hetero_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) +unpack_hetero_LDADD = \ + $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la + distclean: rm -rf *.dSYM .deps .libs *.log *.o *.trs $(check_PROGRAMS) Makefile diff --git a/test/datatype/ddt_pack.c b/test/datatype/ddt_pack.c index 3439e16c409..1164e6feca8 100644 --- a/test/datatype/ddt_pack.c +++ b/test/datatype/ddt_pack.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -30,7 +30,7 @@ #include -static int get_extents(ompi_datatype_t * type, OPAL_PTRDIFF_TYPE *lb, OPAL_PTRDIFF_TYPE *extent, OPAL_PTRDIFF_TYPE *true_lb, OPAL_PTRDIFF_TYPE *true_extent) { +static int get_extents(ompi_datatype_t * type, ptrdiff_t *lb, ptrdiff_t *extent, ptrdiff_t *true_lb, ptrdiff_t *true_extent) { int ret; ret = ompi_datatype_get_extent(type, lb, extent); @@ -50,10 +50,10 @@ main(int argc, char* argv[]) struct ompi_datatype_t *unpacked_dt; int ret = 0; int blen[4]; - OPAL_PTRDIFF_TYPE disp[4]; + ptrdiff_t disp[4]; ompi_datatype_t *newType, *types[4], *struct_type, *vec_type; - OPAL_PTRDIFF_TYPE old_lb, old_extent, old_true_lb, old_true_extent; - OPAL_PTRDIFF_TYPE lb, extent, true_lb, true_extent; + ptrdiff_t old_lb, old_extent, old_true_lb, old_true_extent; + ptrdiff_t lb, extent, true_lb, true_extent; /* make ompi_proc_local () work ... */ struct ompi_proc_t dummy_proc; diff --git a/test/datatype/opal_datatype_test.c b/test/datatype/opal_datatype_test.c index fcb8164faf5..0dcb508f0d1 100644 --- a/test/datatype/opal_datatype_test.c +++ b/test/datatype/opal_datatype_test.c @@ -12,6 +12,8 @@ * All rights reserved. * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -49,7 +51,7 @@ uint32_t remote_arch = 0xffffffff; */ static size_t compute_memory_size( opal_datatype_t const * const pdt, int count ) { - OPAL_PTRDIFF_TYPE extent, true_lb, true_extent; + ptrdiff_t extent, true_lb, true_extent; opal_datatype_type_extent( pdt, &extent ); opal_datatype_get_true_extent( pdt, &true_lb, &true_extent ); @@ -140,7 +142,7 @@ static int test_upper( unsigned int length ) */ static int local_copy_ddt_count( opal_datatype_t const * const pdt, int count ) { - OPAL_PTRDIFF_TYPE lb, extent; + ptrdiff_t lb, extent; size_t malloced_size; char *odst, *osrc; void *pdst, *psrc; @@ -202,7 +204,7 @@ local_copy_with_convertor_2datatypes( opal_datatype_t const * const send_type, i opal_datatype_t const * const recv_type, int recv_count, int chunk ) { - OPAL_PTRDIFF_TYPE send_lb, send_extent, recv_lb, recv_extent; + ptrdiff_t send_lb, send_extent, recv_lb, recv_extent; void *pdst = NULL, *psrc = NULL, *ptemp = NULL; char *odst, *osrc; opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; @@ -306,7 +308,7 @@ local_copy_with_convertor_2datatypes( opal_datatype_t const * const send_type, i static int local_copy_with_convertor( opal_datatype_t const * const pdt, int count, int chunk ) { - OPAL_PTRDIFF_TYPE lb, extent; + ptrdiff_t lb, extent; void *pdst = NULL, *psrc = NULL, *ptemp = NULL; char *odst, *osrc; opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; diff --git a/test/datatype/opal_ddt_lib.c b/test/datatype/opal_ddt_lib.c index 5fabd90a2b7..f7368960d3a 100644 --- a/test/datatype/opal_ddt_lib.c +++ b/test/datatype/opal_ddt_lib.c @@ -4,6 +4,8 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,14 +29,14 @@ uint32_t outputFlags = VALIDATE_DATA | CHECK_PACK_UNPACK | RESET_CONVERTORS | QU static int32_t opal_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, const opal_datatype_t* oldType, opal_datatype_t** newType ); -static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, const opal_datatype_t* oldType, opal_datatype_t** newType ); static int32_t opal_datatype_create_struct( int count, const int* pBlockLength, - const OPAL_PTRDIFF_TYPE* pDisp, + const ptrdiff_t* pDisp, opal_datatype_t** pTypes, opal_datatype_t** newType ); static int32_t opal_datatype_create_vector( int count, int bLength, int stride, const opal_datatype_t* oldType, opal_datatype_t** newType ); -static int32_t opal_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, +static int32_t opal_datatype_create_hvector( int count, int bLength, ptrdiff_t stride, const opal_datatype_t* oldType, opal_datatype_t** newType ); @@ -136,7 +138,7 @@ opal_datatype_t* test_struct( void ) NULL, (opal_datatype_t*)&opal_datatype_int1 }; int lengths[] = { 2, 1, 3 }; - OPAL_PTRDIFF_TYPE disp[] = { 0, 16, 26 }; + ptrdiff_t disp[] = { 0, 16, 26 }; opal_datatype_t* pdt, *pdt1; printf( "test struct\n" ); @@ -166,7 +168,7 @@ opal_datatype_t* test_struct_char_double( void ) { char_double_t data; int lengths[] = {1, 1}; - OPAL_PTRDIFF_TYPE displ[] = {0, 0}; + ptrdiff_t displ[] = {0, 0}; opal_datatype_t *pdt; opal_datatype_t* types[] = { (opal_datatype_t*)&opal_datatype_int1, (opal_datatype_t*)&opal_datatype_float8}; @@ -200,7 +202,7 @@ typedef struct { opal_datatype_t* create_strange_dt( void ) { sdata_intern v[2]; - OPAL_PTRDIFF_TYPE displ[3]; + ptrdiff_t displ[3]; opal_datatype_t *pdt, *pdt1; opal_datatype_create_contiguous(0, &opal_datatype_empty, &pdt1); @@ -280,7 +282,7 @@ static int32_t opal_datatype_create_indexed( int count, const int* pBlockLength, { opal_datatype_t* pdt; int i, dLength, endat, disp; - OPAL_PTRDIFF_TYPE extent; + ptrdiff_t extent; if( 0 == count ) { *newType = opal_datatype_create( 0 ); @@ -317,12 +319,12 @@ static int32_t opal_datatype_create_indexed( int count, const int* pBlockLength, return OPAL_SUCCESS; } -static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, const opal_datatype_t* oldType, opal_datatype_t** newType ) { opal_datatype_t* pdt; int i, dLength; - OPAL_PTRDIFF_TYPE extent, disp, endat; + ptrdiff_t extent, disp, endat; if( 0 == count ) { *newType = opal_datatype_create( 0 ); @@ -360,11 +362,11 @@ static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength } -static int32_t opal_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, +static int32_t opal_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp, opal_datatype_t** pTypes, opal_datatype_t** newType ) { int i; - OPAL_PTRDIFF_TYPE disp = 0, endto, lastExtent, lastDisp; + ptrdiff_t disp = 0, endto, lastExtent, lastDisp; int lastBlock; opal_datatype_t *pdt, *lastType; @@ -433,7 +435,7 @@ static int32_t opal_datatype_create_vector( int count, int bLength, int stride, const opal_datatype_t* oldType, opal_datatype_t** newType ) { opal_datatype_t *pTempData, *pData; - OPAL_PTRDIFF_TYPE extent = oldType->ub - oldType->lb; + ptrdiff_t extent = oldType->ub - oldType->lb; if( 0 == count ) { @@ -461,11 +463,11 @@ static int32_t opal_datatype_create_vector( int count, int bLength, int stride, } -static int32_t opal_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, +static int32_t opal_datatype_create_hvector( int count, int bLength, ptrdiff_t stride, const opal_datatype_t* oldType, opal_datatype_t** newType ) { opal_datatype_t *pTempData, *pData; - OPAL_PTRDIFF_TYPE extent = oldType->ub - oldType->lb; + ptrdiff_t extent = oldType->ub - oldType->lb; if( 0 == count ) { *newType = opal_datatype_create( 0 ); @@ -637,8 +639,8 @@ opal_datatype_t* test_contiguous( void ) int mpich_typeub( void ) { int errs = 0; - OPAL_PTRDIFF_TYPE extent, lb, extent1, extent2, extent3; - OPAL_PTRDIFF_TYPE displ[2]; + ptrdiff_t extent, lb, extent1, extent2, extent3; + ptrdiff_t displ[2]; int blens[2]; opal_datatype_t *type1, *type2, *type3, *types[2]; @@ -700,7 +702,7 @@ int mpich_typeub2( void ) { int blocklen[3], err = 0; size_t sz1, sz2, sz3; - OPAL_PTRDIFF_TYPE disp[3], lb, ub, ex1, ex2, ex3; + ptrdiff_t disp[3], lb, ub, ex1, ex2, ex3; opal_datatype_t *types[3], *dt1, *dt2, *dt3; blocklen[0] = 1; @@ -779,7 +781,7 @@ int mpich_typeub3( void ) { int blocklen[3], err = 0, idisp[3]; size_t sz; - OPAL_PTRDIFF_TYPE disp[3], lb, ub, ex; + ptrdiff_t disp[3], lb, ub, ex; opal_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5; /* Create a datatype with explicit LB and UB */ diff --git a/test/datatype/position_noncontig.c b/test/datatype/position_noncontig.c index 12a15fa47a7..0fb94c224ab 100644 --- a/test/datatype/position_noncontig.c +++ b/test/datatype/position_noncontig.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2007 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. @@ -23,7 +23,7 @@ /** * The purpose of this test is to simulate the multi-network packing and * unpacking process. The pack operation will happens in-order while the - * will be done randomly. Therefore, before each unpack the correct + * unpack will be done randomly. Therefore, before each unpack the correct * position in the user buffer has to be set. */ diff --git a/test/datatype/unpack_hetero.c b/test/datatype/unpack_hetero.c new file mode 100644 index 00000000000..48c9c1c2746 --- /dev/null +++ b/test/datatype/unpack_hetero.c @@ -0,0 +1,99 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2014-2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/runtime/opal.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_prototypes.h" +#include "opal/util/arch.h" +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#include + +/* Compile with: +gcc -DHAVE_CONFIG_H -I. -I../../include -I../.. -I../../include -I../../../ompi-trunk/opal -I../../../ompi-trunk/orte -g opal_datatype_test.c -o opal_datatype_test +*/ + +uint32_t remote_arch = 0xffffffff; + +/** + * Main function. Call several tests and print-out the results. It try to stress the convertor + * using difficult data-type constructions as well as strange segment sizes for the conversion. + * Usually, it is able to detect most of the data-type and convertor problems. Any modifications + * on the data-type engine should first pass all the tests from this file, before going into other + * tests. + */ +int main( int argc, char* argv[] ) +{ + opal_datatype_init(); + + /** + * By default simulate homogeneous architectures. + */ + remote_arch = opal_local_arch ^ OPAL_ARCH_ISBIGENDIAN; + + opal_convertor_t * pConv; + int sbuf[2], rbuf[2]; + size_t max_data; + struct iovec a; + uint32_t iov_count; + + sbuf[0] = 0x01000000; sbuf[1] = 0x02000000; + + printf( "\n\n#\n * TEST UNPACKING 1 int out of 1\n#\n\n" ); + + pConv = opal_convertor_create( remote_arch, 0 ); + rbuf[0] = -1; rbuf[1] = -1; + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( pConv, &opal_datatype_int4, 1, rbuf ) ) { + printf( "Cannot attach the datatype to a convertor\n" ); + return OPAL_ERROR; + } + + a.iov_base = sbuf; + a.iov_len = 4; + iov_count = 1; + max_data = 4; + opal_unpack_general( pConv, &a, &iov_count, &max_data ); + + assert(1 == rbuf[0]); + assert(-1 == rbuf[1]); + OBJ_RELEASE(pConv); + + printf( "\n\n#\n * TEST UNPACKING 1 int out of 2\n#\n\n" ); + pConv = opal_convertor_create( remote_arch, 0 ); + rbuf[0] = -1; rbuf[1] = -1; + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( pConv, &opal_datatype_int4, 2, rbuf ) ) { + printf( "Cannot attach the datatype to a convertor\n" ); + return OPAL_ERROR; + } + + + a.iov_base = sbuf; + a.iov_len = 4; + iov_count = 1; + max_data = 4; + opal_unpack_general( pConv, &a, &iov_count, &max_data ); + + assert(1 == rbuf[0]); + assert(-1 == rbuf[1]); + OBJ_RELEASE(pConv); + + /* clean-ups all data allocations */ + opal_datatype_finalize(); + opal_finalize(); + return OPAL_SUCCESS; +}