Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ompi/datatype: use size_t for count arguments #12351

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions ompi/datatype/ompi_datatype.h
Expand Up @@ -150,7 +150,7 @@ ompi_datatype_is_predefined( const ompi_datatype_t* type )
}

static inline int32_t
ompi_datatype_is_contiguous_memory_layout( const ompi_datatype_t* type, int32_t count )
ompi_datatype_is_contiguous_memory_layout( const ompi_datatype_t* type, size_t count )
{
return opal_datatype_is_contiguous_memory_layout(&type->super, count);
}
Expand Down Expand Up @@ -188,20 +188,20 @@ ompi_datatype_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, size
OMPI_DECLSPEC int32_t
ompi_datatype_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newType );

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,
OMPI_DECLSPEC int32_t ompi_datatype_create_contiguous( size_t count, const ompi_datatype_t* oldType, ompi_datatype_t** newType );
OMPI_DECLSPEC int32_t ompi_datatype_create_vector( size_t 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, ptrdiff_t stride,
OMPI_DECLSPEC int32_t ompi_datatype_create_hvector( size_t 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,
OMPI_DECLSPEC int32_t ompi_datatype_create_indexed( size_t 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 ptrdiff_t* pDisp,
OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed( size_t 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,
OMPI_DECLSPEC int32_t ompi_datatype_create_indexed_block( size_t 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 ptrdiff_t* pDisp,
OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed_block( size_t 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 ptrdiff_t* pDisp,
OMPI_DECLSPEC int32_t ompi_datatype_create_struct( size_t 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,
Expand Down
2 changes: 1 addition & 1 deletion ompi/datatype/ompi_datatype_create_contiguous.c
Expand Up @@ -24,7 +24,7 @@
#include "ompi/datatype/ompi_datatype_internal.h"
#include "mpi.h"

int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldType,
int32_t ompi_datatype_create_contiguous( size_t count, const ompi_datatype_t* oldType,
ompi_datatype_t** newType )
{
ompi_datatype_t* pdt;
Expand Down
20 changes: 8 additions & 12 deletions ompi/datatype/ompi_datatype_create_indexed.c
Expand Up @@ -31,13 +31,12 @@


/* We try to merge together data that are contiguous */
int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp,
int32_t ompi_datatype_create_indexed( size_t count, const int* pBlockLength, const int* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength;
int i;
size_t i, dLength;

/* ignore all cases that lead to an empty type */
ompi_datatype_type_size(oldType, &dLength);
Expand Down Expand Up @@ -72,13 +71,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 ptrdiff_t* pDisp,
int32_t ompi_datatype_create_hindexed( size_t count, const int* pBlockLength, const ptrdiff_t* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength;
int i;
size_t i, dLength;

/* ignore all cases that lead to an empty type */
ompi_datatype_type_size(oldType, &dLength);
Expand Down Expand Up @@ -113,13 +111,12 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const
}


int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp,
int32_t ompi_datatype_create_indexed_block( size_t count, int bLength, const int* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength;
int i;
size_t i, dLength;

if( (count == 0) || (bLength == 0) ) {
return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType);
Expand Down Expand Up @@ -147,13 +144,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 ptrdiff_t* pDisp,
int32_t ompi_datatype_create_hindexed_block( size_t count, int bLength, const ptrdiff_t* pDisp,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ptrdiff_t extent, disp, endat;
ompi_datatype_t* pdt;
size_t dLength;
int i;
size_t i, dLength;

if( (count == 0) || (bLength == 0) ) {
return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType);
Expand Down
5 changes: 2 additions & 3 deletions ompi/datatype/ompi_datatype_create_struct.c
Expand Up @@ -28,13 +28,12 @@

#include "ompi/datatype/ompi_datatype.h"

int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp,
int32_t ompi_datatype_create_struct( size_t count, const int* pBlockLength, const ptrdiff_t* pDisp,
ompi_datatype_t* const * pTypes, ompi_datatype_t** newType )
{
ptrdiff_t disp = 0, endto, lastExtent, lastDisp;
ompi_datatype_t *pdt, *lastType;
int i, start_from;
size_t lastBlock;
size_t i, start_from, lastBlock;

/* Find first non-zero length element */
for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ );
Expand Down
4 changes: 2 additions & 2 deletions ompi/datatype/ompi_datatype_create_vector.c
Expand Up @@ -28,7 +28,7 @@

#include "ompi/datatype/ompi_datatype.h"

int32_t ompi_datatype_create_vector( int count, int bLength, int stride,
int32_t ompi_datatype_create_vector( size_t count, int bLength, int stride,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ompi_datatype_t *pTempData, *pData;
Expand Down Expand Up @@ -57,7 +57,7 @@ int32_t ompi_datatype_create_vector( int count, int bLength, int stride,
}


int32_t ompi_datatype_create_hvector( int count, int bLength, ptrdiff_t stride,
int32_t ompi_datatype_create_hvector( size_t count, int bLength, ptrdiff_t stride,
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
{
ompi_datatype_t *pTempData, *pData;
Expand Down