Skip to content

Commit 0bbe975

Browse files
committed
SQUASHME: address some compiler warnings
arising from the fact that the OMPI datatype framework is not yet embiggened Signed-off-by: Howard Pritchard <[email protected]>
1 parent 946414a commit 0bbe975

16 files changed

+219
-28
lines changed

ompi/mpi/bindings/ompi_bindings/c.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,26 @@ def print_profiling_header(fn_name, out):
292292
out.dump('#endif')
293293

294294

295+
def print_cdefs_for_bigcount(fn_name, out, enable_count=False):
296+
if enable_count:
297+
out.dump('#undef OMPI_BIGCOUNT_SRC')
298+
out.dump('#define OMPI_BIGCOUNT_SRC 1')
299+
else:
300+
out.dump('#undef OMPI_BIGCOUNT_SRC')
301+
out.dump('#define OMPI_BIGCOUNT_SRC 0')
302+
295303
def ompi_abi(base_name, template, out):
296304
"""Generate the OMPI ABI functions."""
297305
template.print_header(out)
298306
print_profiling_header(base_name, out)
307+
print_cdefs_for_bigcount(base_name, out)
299308
out.dump(template.prototype.signature(base_name, abi_type='ompi'))
300309
template.print_body(func_name=base_name, out=out)
301310
# Check if we need to generate the bigcount interface
302311
if util.prototype_has_bigcount(template.prototype):
303312
base_name_c = f'{base_name}_c'
304313
print_profiling_header(base_name_c, out)
314+
print_cdefs_for_bigcount(base_name_c, out, enable_count=True)
305315
out.dump(template.prototype.signature(base_name_c, abi_type='ompi', enable_count=True))
306316
template.print_body(func_name=base_name_c, out=out)
307317

@@ -324,6 +334,7 @@ def standard_abi(base_name, template, out):
324334
def generate_function(prototype, fn_name, internal_fn, enable_count=False):
325335
"""Generate a function for the standard ABI."""
326336
print_profiling_header(fn_name)
337+
print_cdefs_for_bigcount(fn_name,enable_count)
327338

328339
# Handle type conversions and arguments
329340
params = [param.construct(abi_type='standard') for param in prototype.params]

ompi/mpi/c/pack_external.c.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ PROTOTYPE ERROR_CLASS pack_external(STRING datarep, BUFFER inbuf, COUNT incount,
6060
OMPI_ERRHANDLER_NOHANDLE_CHECK(rc, rc, FUNC_NAME);
6161
}
6262

63+
/* TODO:BIGCOUNT: Update ompi_datatype_pack_external for bigcount */
64+
6365
rc = ompi_datatype_pack_external(datarep, inbuf, incount,
6466
datatype, outbuf,
65-
outsize, position);
67+
outsize, (MPI_Aint *)position);
6668

6769
OMPI_ERRHANDLER_NOHANDLE_RETURN(rc, rc, FUNC_NAME);
6870
}

ompi/mpi/c/type_contiguous.c.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ PROTOTYPE ERROR_CLASS type_contiguous(COUNT count,
5757

5858
/* data description */
5959
{
60+
/* TODO:BIGCOUNT: need to embiggen ompi_datatype_set_args */
61+
#if OMPI_BIGCOUNT_SRC
62+
int icount = (int)count;
63+
const int* a_i[1] = {&icount};
64+
#else
6065
const int* a_i[1] = {&count};
66+
#endif
6167
ompi_datatype_set_args( *newtype, 1, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_CONTIGUOUS );
6268
}
6369

ompi/mpi/c/type_create_darray.c.in

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ PROTOTYPE ERROR_CLASS type_create_darray(INT size,
4545
DATATYPE_OUT newtype)
4646
{
4747
int i, rc;
48+
int *igsize_array = NULL;
4849

4950
MEMCHECKER(
5051
memchecker_datatype(oldtype);
@@ -89,16 +90,33 @@ PROTOTYPE ERROR_CLASS type_create_darray(INT size,
8990
}
9091
}
9192

93+
/* TODO:BIGCOUNT: need to embiggen ompi_datatype_create_array and
94+
* ompi_datatype_set_args.
95+
*/
96+
#if OMPI_BIGCOUNT_SRC
97+
igsize_array = (int *)malloc(ndims * sizeof(int));
98+
if (NULL == igsize_array) {
99+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
100+
}
101+
for (int ii=0;ii<ndims;ii++) {
102+
igsize_array[ii] = (int)gsize_array[ii];
103+
}
104+
#else
105+
igsize_array = (int *)gsize_array;
106+
#endif
92107
rc = ompi_datatype_create_darray( size, rank, ndims,
93-
gsize_array, distrib_array, darg_array, psize_array,
108+
igsize_array, distrib_array, darg_array, psize_array,
94109
order, oldtype, newtype );
95110
if( OMPI_SUCCESS == rc ) {
96-
const int* a_i[8] = {&size, &rank, &ndims, gsize_array, distrib_array, darg_array,
111+
const int* a_i[8] = {&size, &rank, &ndims, igsize_array, distrib_array, darg_array,
97112
psize_array, &order};
98113

99114
ompi_datatype_set_args( *newtype, 4 * ndims + 4, a_i, 0, NULL, 1, &oldtype,
100115
MPI_COMBINER_DARRAY );
101116
}
117+
#if OMPI_BIGCOUNT_SRC
118+
free(igsize_array);
119+
#endif
102120

103121
OMPI_ERRHANDLER_NOHANDLE_RETURN(rc, rc, FUNC_NAME);
104122
}

ompi/mpi/c/type_create_hindexed.c.in

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ PROTOTYPE ERROR_CLASS type_create_hindexed(COUNT count,
4040
DATATYPE_OUT newtype)
4141
{
4242
int rc, i;
43+
int *iarray_of_blocklengths = NULL;
44+
MPI_Aint *iarray_of_displacements = NULL;
4345

4446
MEMCHECKER(
4547
memchecker_datatype(oldtype);
@@ -67,19 +69,43 @@ PROTOTYPE ERROR_CLASS type_create_hindexed(COUNT count,
6769
}
6870
}
6971

70-
rc = ompi_datatype_create_hindexed( count, array_of_blocklengths, array_of_displacements,
72+
/* TODO:BIGCOUNT: need to embiggen ompi_datatype_create_hindexed, etc. */
73+
#if OMPI_BIGCOUNT_SRC
74+
iarray_of_blocklengths = (int *)malloc(count * sizeof(int));
75+
if (NULL == iarray_of_blocklengths) {
76+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
77+
}
78+
iarray_of_displacements = (MPI_Aint *)malloc(count * sizeof(MPI_Aint));
79+
if (NULL == iarray_of_displacements) {
80+
free( iarray_of_blocklengths);
81+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
82+
}
83+
for (i = 0; i < (int)count; i++) {
84+
iarray_of_blocklengths[i] = (int)array_of_blocklengths[i];
85+
iarray_of_displacements[i] = (MPI_Aint)array_of_displacements[i];
86+
}
87+
#else
88+
iarray_of_blocklengths = (int *)array_of_blocklengths;
89+
iarray_of_displacements = (MPI_Aint *)array_of_displacements;
90+
#endif
91+
92+
rc = ompi_datatype_create_hindexed( count, iarray_of_blocklengths, iarray_of_displacements,
7193
oldtype, newtype );
7294
if( rc != MPI_SUCCESS ) {
7395
ompi_datatype_destroy( newtype );
7496
OMPI_ERRHANDLER_NOHANDLE_RETURN( rc, rc, FUNC_NAME );
7597
}
7698
/* data description */
7799
{
78-
const int* a_i[2] = {&count, array_of_blocklengths};
100+
const int* a_i[2] = {(int *)&count, iarray_of_blocklengths};
79101

80-
ompi_datatype_set_args( *newtype, count + 1, a_i, count, array_of_displacements,
102+
ompi_datatype_set_args( *newtype, count + 1, a_i, count, iarray_of_displacements,
81103
1, &oldtype, MPI_COMBINER_HINDEXED );
82104
}
83105

106+
#if OMPI_BIGCOUNT_SRC
107+
free(iarray_of_blocklengths);
108+
free(iarray_of_displacements);
109+
#endif
84110
return MPI_SUCCESS;
85111
}

ompi/mpi/c/type_create_hindexed_block.c.in

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PROTOTYPE ERROR_CLASS type_create_hindexed_block(COUNT count,
3232
DATATYPE_OUT newtype)
3333
{
3434
int rc;
35+
MPI_Aint *iarray_of_displacements = NULL;
3536

3637
MEMCHECKER(
3738
memchecker_datatype(oldtype);
@@ -52,17 +53,33 @@ PROTOTYPE ERROR_CLASS type_create_hindexed_block(COUNT count,
5253
}
5354
}
5455

55-
rc = ompi_datatype_create_hindexed_block( count, blocklength, array_of_displacements,
56+
/* TODO:BIGCOUNT: Need to embiggen ompi_datatype_create_hindexed_block */
57+
#if OMPI_BIGCOUNT_SRC
58+
iarray_of_displacements = (MPI_Aint *)malloc(count * sizeof(MPI_Aint));
59+
if (NULL == iarray_of_displacements) {
60+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
61+
}
62+
for (int ii = 0; ii < (int)count; ii++) {
63+
iarray_of_displacements[ii] = (MPI_Aint)array_of_displacements[ii];
64+
}
65+
#else
66+
iarray_of_displacements = (MPI_Aint *)array_of_displacements;
67+
#endif
68+
69+
rc = ompi_datatype_create_hindexed_block( count, blocklength, iarray_of_displacements,
5670
oldtype, newtype );
5771
if( rc != MPI_SUCCESS ) {
5872
ompi_datatype_destroy( newtype );
5973
OMPI_ERRHANDLER_NOHANDLE_RETURN( rc, rc, FUNC_NAME );
6074
}
6175
{
62-
const int* a_i[2] = {&count, &blocklength};
63-
ompi_datatype_set_args( *newtype, 2, a_i, count, array_of_displacements, 1, &oldtype,
76+
const int* a_i[2] = {(int *)&count, (int *)&blocklength};
77+
ompi_datatype_set_args( *newtype, 2, a_i, count, iarray_of_displacements, 1, &oldtype,
6478
MPI_COMBINER_HINDEXED_BLOCK );
6579
}
80+
#if OMPI_BIGCOUNT_SRC
81+
free(iarray_of_displacements);
82+
#endif
6683

6784
return MPI_SUCCESS;
6885
}

ompi/mpi/c/type_create_hvector.c.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ PROTOTYPE ERROR_CLASS type_create_hvector(COUNT count,
5959
}
6060
}
6161

62+
/* TODO:BIGCOUNT: need to embiggen ompi_datatype_create_hvector */
63+
6264
rc = ompi_datatype_create_hvector ( count, blocklength, stride, oldtype,
6365
newtype );
6466
OMPI_ERRHANDLER_NOHANDLE_CHECK(rc, rc, FUNC_NAME );
6567

6668
{
67-
const int* a_i[2] = {&count, &blocklength};
69+
const int* a_i[2] = {(int *)&count, (int *)&blocklength};
6870
MPI_Aint a_a[1] = {stride};
6971

7072
ompi_datatype_set_args( *newtype, 2, a_i, 1, a_a, 1, &oldtype, MPI_COMBINER_HVECTOR );

ompi/mpi/c/type_create_indexed_block.c.in

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ PROTOTYPE ERROR_CLASS type_create_indexed_block(COUNT count,
3939
DATATYPE_OUT newtype)
4040
{
4141
int rc;
42+
int *iarray_of_displacements = NULL;
4243

4344
MEMCHECKER(
4445
memchecker_datatype(oldtype);
@@ -59,18 +60,32 @@ PROTOTYPE ERROR_CLASS type_create_indexed_block(COUNT count,
5960
}
6061
}
6162

62-
rc = ompi_datatype_create_indexed_block( count, blocklength, array_of_displacements,
63+
#if OMPI_BIGCOUNT_SRC
64+
iarray_of_displacements = (int *)malloc(count * sizeof(int));
65+
if (NULL == iarray_of_displacements) {
66+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
67+
}
68+
for (int ii = 0; ii < (int)count; ii++) {
69+
iarray_of_displacements[ii] = (int)array_of_displacements[ii];
70+
}
71+
#else
72+
iarray_of_displacements = (int *)array_of_displacements;
73+
#endif
74+
rc = ompi_datatype_create_indexed_block( count, blocklength, iarray_of_displacements,
6375
oldtype, newtype );
6476
if( rc != MPI_SUCCESS ) {
6577
ompi_datatype_destroy( newtype );
6678
OMPI_ERRHANDLER_NOHANDLE_RETURN( rc, rc, FUNC_NAME );
6779
}
6880
{
69-
const int* a_i[3] = {&count, &blocklength, array_of_displacements};
81+
const int* a_i[3] = {(int *)&count, (int *)&blocklength, iarray_of_displacements};
7082

7183
ompi_datatype_set_args( *newtype, 2 + count, a_i, 0, NULL, 1, &oldtype,
7284
MPI_COMBINER_INDEXED_BLOCK );
7385
}
7486

87+
#if OMPI_BIGCOUNT_SRC
88+
free(iarray_of_displacements);
89+
#endif
7590
return MPI_SUCCESS;
7691
}

ompi/mpi/c/type_create_struct.c.in

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
3939
DATATYPE_OUT newtype)
4040
{
4141
int i, rc;
42+
int *iarray_of_blocklengths = NULL;
43+
MPI_Aint *iarray_of_displacements = NULL;
4244

4345
if ( count > 0 ) {
4446
for ( i = 0; i < count; i++ ) {
@@ -72,20 +74,46 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
7274
}
7375
}
7476

75-
rc = ompi_datatype_create_struct( count, array_of_blocklengths, array_of_displacements,
77+
#if OMPI_BIGCOUNT_SRC
78+
iarray_of_blocklengths = (int *)malloc(count * sizeof(int));
79+
if (NULL == iarray_of_blocklengths) {
80+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
81+
}
82+
iarray_of_displacements = (MPI_Aint *)malloc(count * sizeof(MPI_Aint));
83+
if (NULL == iarray_of_displacements) {
84+
free(iarray_of_blocklengths);
85+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
86+
}
87+
for (int ii = 0; ii < (int)count; ii++) {
88+
iarray_of_blocklengths[ii] = (int)array_of_blocklengths[ii];
89+
iarray_of_displacements[ii] = (MPI_Aint)array_of_displacements[ii];
90+
}
91+
#else
92+
iarray_of_blocklengths = (int *)array_of_blocklengths;
93+
iarray_of_displacements = (MPI_Aint *)array_of_displacements;
94+
#endif
95+
rc = ompi_datatype_create_struct( count, iarray_of_blocklengths, iarray_of_displacements,
7696
array_of_types, newtype );
7797
if( rc != MPI_SUCCESS ) {
7898
ompi_datatype_destroy( newtype );
99+
#if OMPI_BIGCOUNT_SRC
100+
free(iarray_of_blocklengths);
101+
free(iarray_of_displacements);
102+
#endif
79103
OMPI_ERRHANDLER_NOHANDLE_RETURN( rc,
80104
rc, FUNC_NAME );
81105
}
82106

83107
{
84-
const int* a_i[2] = {&count, array_of_blocklengths};
108+
const int* a_i[2] = {(int *)&count, iarray_of_blocklengths};
85109

86-
ompi_datatype_set_args( *newtype, count + 1, a_i, count, array_of_displacements,
110+
ompi_datatype_set_args( *newtype, count + 1, a_i, count, iarray_of_displacements,
87111
count, array_of_types, MPI_COMBINER_STRUCT );
88112
}
113+
#if OMPI_BIGCOUNT_SRC
114+
free(iarray_of_blocklengths);
115+
free(iarray_of_displacements);
116+
#endif
89117

90118
return MPI_SUCCESS;
91119
}

ompi/mpi/c/type_create_subarray.c.in

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ PROTOTYPE ERROR_CLASS type_create_subarray(INT ndims,
4242
DATATYPE_OUT newtype)
4343
{
4444
int32_t i, rc;
45+
int *isize_array = NULL;
46+
int *isubsize_array = NULL;
47+
int *istart_array = NULL;
4548

4649
MEMCHECKER(
4750
memchecker_datatype(oldtype);
@@ -67,14 +70,47 @@ PROTOTYPE ERROR_CLASS type_create_subarray(INT ndims,
6770
}
6871
}
6972

70-
rc = ompi_datatype_create_subarray( ndims, size_array, subsize_array, start_array,
73+
/* TODO:BIGCOUNT: Need to embiggen ompi_datatype_create_subarray */
74+
75+
#if OMPI_BIGCOUNT_SRC
76+
isize_array = (int *)malloc(ndims * sizeof(int));
77+
if (NULL == isize_array) {
78+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
79+
}
80+
isubsize_array = (int *)malloc(ndims * sizeof(int));
81+
if (NULL == isubsize_array) {
82+
free(isize_array);
83+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
84+
}
85+
istart_array = (int *)malloc(ndims * sizeof(int));
86+
if (NULL == istart_array) {
87+
free(isize_array);
88+
free(isubsize_array);
89+
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_NO_MEM, FUNC_NAME);
90+
}
91+
for (int ii = 0; ii < ndims; ii++) {
92+
isize_array[ii] = (int)size_array[ii];
93+
isubsize_array[ii] = (int)subsize_array[ii];
94+
istart_array[ii] = (int)start_array[ii];
95+
}
96+
#else
97+
isize_array = (int *)size_array;
98+
isubsize_array = (int *)subsize_array;
99+
istart_array = (int *)start_array;
100+
#endif
101+
rc = ompi_datatype_create_subarray( ndims, isize_array, isubsize_array, istart_array,
71102
order, oldtype, newtype);
72103
if( OMPI_SUCCESS == rc ) {
73-
const int* a_i[5] = {&ndims, size_array, subsize_array, start_array, &order};
104+
const int* a_i[5] = {&ndims, isize_array, isubsize_array, istart_array, &order};
74105

75106
ompi_datatype_set_args( *newtype, 3 * ndims + 2, a_i, 0, NULL, 1, &oldtype,
76107
MPI_COMBINER_SUBARRAY );
77108
}
78109

110+
#if OMPI_BIGCOUNT_SRC
111+
free(isize_array);
112+
free(isubsize_array);
113+
free(istart_array);
114+
#endif
79115
OMPI_ERRHANDLER_NOHANDLE_RETURN(rc, rc, FUNC_NAME);
80116
}

0 commit comments

Comments
 (0)