Skip to content

Commit 2fef284

Browse files
committed
external data pack: switch to using size_t
for count args. This helps with the big count effort. Related to #12226 Related to #13152 Signed-off-by: Howard Pritchard <[email protected]>
1 parent 45258b6 commit 2fef284

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

ompi/datatype/ompi_datatype.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* and Technology (RIST). All rights reserved.
1212
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
1313
* Copyright (c) 2021 IBM Corporation. All rights reserved.
14+
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -377,15 +378,15 @@ OMPI_DECLSPEC int ompi_datatype_safeguard_pointer_debug_breakpoint( const void*
377378
int count );
378379
#endif /* OPAL_ENABLE_DEBUG */
379380

380-
OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, int incount,
381+
OMPI_DECLSPEC int ompi_datatype_pack_external( const char datarep[], const void *inbuf, size_t incount,
381382
ompi_datatype_t *datatype, void *outbuf,
382383
MPI_Aint outsize, MPI_Aint *position);
383384

384385
OMPI_DECLSPEC int ompi_datatype_unpack_external( const char datarep[], const void *inbuf, MPI_Aint insize,
385-
MPI_Aint *position, void *outbuf, int outcount,
386+
MPI_Aint *position, void *outbuf, size_t outcount,
386387
ompi_datatype_t *datatype);
387388

388-
OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int incount,
389+
OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], size_t incount,
389390
ompi_datatype_t *datatype, MPI_Aint *size);
390391

391392
#define OMPI_DATATYPE_RETAIN(ddt) \

ompi/datatype/ompi_datatype_external.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* reserved.
1616
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2025 Triad National Security, LLC. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -29,7 +30,7 @@
2930
#include "ompi/datatype/ompi_datatype.h"
3031
#include "opal/datatype/opal_convertor.h"
3132

32-
int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int incount,
33+
int ompi_datatype_pack_external(const char datarep[], const void *inbuf, size_t incount,
3334
ompi_datatype_t *datatype, void *outbuf,
3435
MPI_Aint outsize, MPI_Aint *position)
3536
{
@@ -73,7 +74,7 @@ int ompi_datatype_pack_external(const char datarep[], const void *inbuf, int inc
7374
}
7475

7576
int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_Aint insize,
76-
MPI_Aint *position, void *outbuf, int outcount,
77+
MPI_Aint *position, void *outbuf, size_t outcount,
7778
ompi_datatype_t *datatype)
7879
{
7980
int rc = MPI_SUCCESS;
@@ -92,7 +93,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_
9293

9394
/* Check for truncation */
9495
opal_convertor_get_packed_size( &local_convertor, &size );
95-
if( (*position + size) > (unsigned int)insize ) {
96+
if( (*position + (MPI_Aint)size) > insize ) {
9697
OBJ_DESTRUCT( &local_convertor );
9798
return MPI_ERR_TRUNCATE;
9899
}
@@ -112,7 +113,7 @@ int ompi_datatype_unpack_external (const char datarep[], const void *inbuf, MPI_
112113
return (rc == 1) ? OMPI_SUCCESS : MPI_ERR_UNKNOWN;
113114
}
114115

115-
int ompi_datatype_pack_external_size(const char datarep[], int incount,
116+
int ompi_datatype_pack_external_size(const char datarep[], size_t incount,
116117
ompi_datatype_t *datatype, MPI_Aint *size)
117118
{
118119
opal_convertor_t local_convertor;

0 commit comments

Comments
 (0)