Skip to content

Commit 03d8ba8

Browse files
committed
Update fcoll/sharedfp versions and fcoll_base_coll_array functions
Signed-off-by: Jake Tronge <jtronge@lanl.gov>
1 parent 78efe13 commit 03d8ba8

33 files changed

+248
-156
lines changed

ompi/mca/common/ompio/common_ompio_aggregators.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1919
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
20+
* Copyright (c) 2024 Triad National Security, LLC. All rights
21+
* reserved.
2022
* $COPYRIGHT$
2123
*
2224
* Additional copyrights may follow
@@ -1048,19 +1050,19 @@ int mca_common_ompio_merge_groups(ompio_file_t *fh,
10481050
int num_merge_aggrs)
10491051
{
10501052
int i = 0;
1051-
int *sizes_old_group;
1053+
size_t *sizes_old_group;
10521054
int ret;
1053-
int *displs = NULL;
1055+
ptrdiff_t *displs = NULL;
10541056

1055-
sizes_old_group = (int*)malloc(num_merge_aggrs * sizeof(int));
1057+
sizes_old_group = (size_t *)malloc(num_merge_aggrs * sizeof(size_t));
10561058
if (NULL == sizes_old_group) {
10571059
opal_output (1, "OUT OF MEMORY\n");
10581060
ret = OMPI_ERR_OUT_OF_RESOURCE;
10591061
goto exit;
10601062
}
10611063

10621064

1063-
displs = (int*)malloc(num_merge_aggrs * sizeof(int));
1065+
displs = (ptrdiff_t *)malloc(num_merge_aggrs * sizeof(ptrdiff_t));
10641066
if (NULL == displs) {
10651067
opal_output (1, "OUT OF MEMORY\n");
10661068
ret = OMPI_ERR_OUT_OF_RESOURCE;

ompi/mca/common/ompio/common_ompio_file_read_all.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,19 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
8282
/* global iovec at the readers that contain the iovecs created from
8383
file_set_view */
8484
uint32_t total_fview_count = 0;
85-
int local_count = 0;
86-
int *fview_count = NULL, *disp_index=NULL, *temp_disp_index=NULL;
87-
int current_index=0, temp_index=0;
85+
size_t local_count = 0;
86+
int temp_local_count = 0;
87+
size_t *fview_count = NULL;
88+
ptrdiff_t *disp_index=NULL, *temp_disp_index=NULL;
89+
size_t current_index=0, temp_index=0;
8890
int **blocklen_per_process=NULL;
8991
MPI_Aint **displs_per_process=NULL;
9092
char *global_buf = NULL;
9193
mca_io_ompio_local_io_array *file_offsets_for_agg=NULL;
9294

9395
/* array that contains the sorted indices of the global_iov */
9496
int *sorted = NULL;
95-
int *displs = NULL;
97+
ptrdiff_t *displs = NULL;
9698
int base_num_io_procs;
9799
size_t max_data = 0;
98100
MPI_Aint *total_bytes_per_process = NULL;
@@ -189,7 +191,8 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
189191
ret = fh->f_generate_current_file_view ((struct ompio_file_t *) fh,
190192
max_data,
191193
&local_iov_array,
192-
&local_count);
194+
&temp_local_count);
195+
local_count = temp_local_count;
193196

194197
if (ret != OMPI_SUCCESS){
195198
goto exit;
@@ -199,7 +202,7 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
199202
*** 4. Allgather the File View information at all processes
200203
*************************************************************/
201204

202-
fview_count = (int *) malloc (fh->f_procs_per_group * sizeof (int));
205+
fview_count = (size_t *)malloc (fh->f_procs_per_group * sizeof (size_t));
203206
if (NULL == fview_count) {
204207
opal_output (1, "OUT OF MEMORY\n");
205208
ret = OMPI_ERR_OUT_OF_RESOURCE;
@@ -209,11 +212,11 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
209212
start_rcomm_time = MPI_Wtime();
210213
#endif
211214
ret = ompi_fcoll_base_coll_allgather_array (&local_count,
212-
1,
213-
MPI_INT,
215+
sizeof(size_t),
216+
MPI_BYTE,
214217
fview_count,
215-
1,
216-
MPI_INT,
218+
sizeof(size_t),
219+
MPI_BYTE,
217220
0,
218221
fh->f_procs_in_group,
219222
fh->f_procs_per_group,
@@ -227,7 +230,7 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
227230
rcomm_time += end_rcomm_time - start_rcomm_time;
228231
#endif
229232

230-
displs = (int*)malloc (fh->f_procs_per_group*sizeof(int));
233+
displs = (ptrdiff_t *)malloc (fh->f_procs_per_group*sizeof(ptrdiff_t));
231234
if (NULL == displs) {
232235
opal_output (1, "OUT OF MEMORY\n");
233236
ret = OMPI_ERR_OUT_OF_RESOURCE;
@@ -328,7 +331,7 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
328331
cycles = ceil((double)total_bytes/bytes_per_cycle);
329332

330333
if ( my_aggregator == fh->f_rank) {
331-
disp_index = (int *)malloc (fh->f_procs_per_group * sizeof (int));
334+
disp_index = (ptrdiff_t *)malloc (fh->f_procs_per_group * sizeof (ptrdiff_t));
332335
if (NULL == disp_index) {
333336
opal_output (1, "OUT OF MEMORY\n");
334337
ret = OMPI_ERR_OUT_OF_RESOURCE;
@@ -698,7 +701,7 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
698701
******************** DONE READING ************************
699702
*********************************************************/
700703

701-
temp_disp_index = (int *)calloc (1, fh->f_procs_per_group * sizeof (int));
704+
temp_disp_index = (ptrdiff_t *)calloc (1, fh->f_procs_per_group * sizeof (ptrdiff_t));
702705
if (NULL == temp_disp_index) {
703706
opal_output (1, "OUT OF MEMORY\n");
704707
ret = OMPI_ERR_OUT_OF_RESOURCE;
@@ -713,9 +716,9 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
713716
temp_disp_index[temp_index] += 1;
714717
}
715718
else{
716-
printf("temp_disp_index[%d]: %d is greater than disp_index[%d]: %d\n",
717-
temp_index, temp_disp_index[temp_index],
718-
temp_index, disp_index[temp_index]);
719+
printf("temp_disp_index[%zu]: %ld is greater than disp_index[%zu]: %ld\n",
720+
temp_index, (long) temp_disp_index[temp_index],
721+
temp_index, (long) disp_index[temp_index]);
719722
}
720723
}
721724
if (NULL != temp_disp_index){

ompi/mca/fcoll/base/base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1515
* Copyright (c) 2018 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2024 Triad National Security, LLC. All rights
18+
* reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -55,7 +57,7 @@ OMPI_DECLSPEC int ompi_fcoll_base_sort_iovec (struct iovec *iov, int num_entries
5557

5658
OMPI_DECLSPEC mca_fcoll_base_component_t* mca_fcoll_base_component_lookup(const char* name);
5759

58-
OMPI_DECLSPEC int mca_fcoll_base_file_read_all (ompio_file_t *fh, void *buf, int count,
60+
OMPI_DECLSPEC int mca_fcoll_base_file_read_all (ompio_file_t *fh, void *buf, size_t count,
5961
struct ompi_datatype_t *datatype,
6062
ompi_status_public_t *status);
6163

ompi/mca/fcoll/base/fcoll_base_coll_array.c

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636

3737

3838
int ompi_fcoll_base_coll_allgatherv_array (void *sbuf,
39-
int scount,
39+
size_t scount,
4040
ompi_datatype_t *sdtype,
4141
void *rbuf,
42-
int *rcounts,
43-
int *disps,
42+
size_t *rcounts,
43+
ptrdiff_t *disps,
4444
ompi_datatype_t *rdtype,
4545
int root_index,
4646
int *procs_in_group,
@@ -50,6 +50,7 @@ int ompi_fcoll_base_coll_allgatherv_array (void *sbuf,
5050
int err = OMPI_SUCCESS;
5151
ptrdiff_t extent, lb;
5252
int i, rank, j;
53+
int *tmp_rcounts = NULL, *tmp_disps = NULL;
5354
char *send_buf = NULL;
5455
struct ompi_datatype_t *newtype, *send_type;
5556

@@ -92,11 +93,24 @@ int ompi_fcoll_base_coll_allgatherv_array (void *sbuf,
9293
return err;
9394
}
9495

96+
/* TODO:BIGCOUNT: remove tmp_rcounts and tmp_disps once the ompi_datatype
97+
* interface is udpated to use size_t/ptrdiff_t
98+
*/
99+
tmp_rcounts = (int *)malloc(2 * procs_per_group * sizeof(int));
100+
if (NULL == tmp_rcounts) {
101+
return OMPI_ERR_OUT_OF_RESOURCE;
102+
}
103+
tmp_disps = tmp_rcounts + procs_per_group;
104+
for (i = 0; i < procs_per_group; i++) {
105+
tmp_rcounts[i] = (int) rcounts[i];
106+
tmp_disps[i] = (int) disps[i];
107+
}
95108
err = ompi_datatype_create_indexed (procs_per_group,
96-
rcounts,
97-
disps,
109+
tmp_rcounts,
110+
tmp_disps,
98111
rdtype,
99112
&newtype);
113+
free(tmp_rcounts);
100114
if (MPI_SUCCESS != err) {
101115
return err;
102116
}
@@ -119,11 +133,11 @@ int ompi_fcoll_base_coll_allgatherv_array (void *sbuf,
119133
}
120134

121135
int ompi_fcoll_base_coll_gatherv_array (void *sbuf,
122-
int scount,
136+
size_t scount,
123137
ompi_datatype_t *sdtype,
124138
void *rbuf,
125-
int *rcounts,
126-
int *disps,
139+
size_t *rcounts,
140+
ptrdiff_t *disps,
127141
ompi_datatype_t *rdtype,
128142
int root_index,
129143
int *procs_in_group,
@@ -208,11 +222,11 @@ int ompi_fcoll_base_coll_gatherv_array (void *sbuf,
208222
}
209223

210224
int ompi_fcoll_base_coll_scatterv_array (void *sbuf,
211-
int *scounts,
212-
int *disps,
225+
size_t *scounts,
226+
ptrdiff_t *disps,
213227
ompi_datatype_t *sdtype,
214228
void *rbuf,
215-
int rcount,
229+
size_t rcount,
216230
ompi_datatype_t *rdtype,
217231
int root_index,
218232
int *procs_in_group,
@@ -298,10 +312,10 @@ int ompi_fcoll_base_coll_scatterv_array (void *sbuf,
298312
}
299313

300314
int ompi_fcoll_base_coll_allgather_array (void *sbuf,
301-
int scount,
315+
size_t scount,
302316
ompi_datatype_t *sdtype,
303317
void *rbuf,
304-
int rcount,
318+
size_t rcount,
305319
ompi_datatype_t *rdtype,
306320
int root_index,
307321
int *procs_in_group,
@@ -351,10 +365,10 @@ int ompi_fcoll_base_coll_allgather_array (void *sbuf,
351365
}
352366

353367
int ompi_fcoll_base_coll_gather_array (void *sbuf,
354-
int scount,
368+
size_t scount,
355369
ompi_datatype_t *sdtype,
356370
void *rbuf,
357-
int rcount,
371+
size_t rcount,
358372
ompi_datatype_t *rdtype,
359373
int root_index,
360374
int *procs_in_group,
@@ -441,7 +455,7 @@ int ompi_fcoll_base_coll_gather_array (void *sbuf,
441455
}
442456

443457
int ompi_fcoll_base_coll_bcast_array (void *buff,
444-
int count,
458+
size_t count,
445459
ompi_datatype_t *datatype,
446460
int root_index,
447461
int *procs_in_group,

ompi/mca/fcoll/base/fcoll_base_coll_array.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2015 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
1616
* Copyright (c) 2017 IBM Corporation. All rights reserved.
17+
* Copyright (c) 2024 Triad National Security, LLC. All rights
18+
* reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -43,61 +45,61 @@
4345
* Based on an array of procs in group
4446
*/
4547
OMPI_DECLSPEC int ompi_fcoll_base_coll_gatherv_array (void *sbuf,
46-
int scount,
48+
size_t scount,
4749
ompi_datatype_t *sdtype,
4850
void *rbuf,
49-
int *rcounts,
50-
int *disps,
51+
size_t *rcounts,
52+
ptrdiff_t *disps,
5153
ompi_datatype_t *rdtype,
5254
int root_index,
5355
int *procs_in_group,
5456
int procs_per_group,
5557
ompi_communicator_t *comm);
5658
OMPI_DECLSPEC int ompi_fcoll_base_coll_scatterv_array (void *sbuf,
57-
int *scounts,
58-
int *disps,
59+
size_t *scounts,
60+
ptrdiff_t *disps,
5961
ompi_datatype_t *sdtype,
6062
void *rbuf,
61-
int rcount,
63+
size_t rcount,
6264
ompi_datatype_t *rdtype,
6365
int root_index,
6466
int *procs_in_group,
6567
int procs_per_group,
6668
ompi_communicator_t *comm);
6769
OMPI_DECLSPEC int ompi_fcoll_base_coll_allgather_array (void *sbuf,
68-
int scount,
70+
size_t scount,
6971
ompi_datatype_t *sdtype,
7072
void *rbuf,
71-
int rcount,
73+
size_t rcount,
7274
ompi_datatype_t *rdtype,
7375
int root_index,
7476
int *procs_in_group,
7577
int procs_per_group,
7678
ompi_communicator_t *comm);
7779

7880
OMPI_DECLSPEC int ompi_fcoll_base_coll_allgatherv_array (void *sbuf,
79-
int scount,
81+
size_t scount,
8082
ompi_datatype_t *sdtype,
8183
void *rbuf,
82-
int *rcounts,
83-
int *disps,
84+
size_t *rcounts,
85+
ptrdiff_t *disps,
8486
ompi_datatype_t *rdtype,
8587
int root_index,
8688
int *procs_in_group,
8789
int procs_per_group,
8890
ompi_communicator_t *comm);
8991
OMPI_DECLSPEC int ompi_fcoll_base_coll_gather_array (void *sbuf,
90-
int scount,
92+
size_t scount,
9193
ompi_datatype_t *sdtype,
9294
void *rbuf,
93-
int rcount,
95+
size_t rcount,
9496
ompi_datatype_t *rdtype,
9597
int root_index,
9698
int *procs_in_group,
9799
int procs_per_group,
98100
ompi_communicator_t *comm);
99101
OMPI_DECLSPEC int ompi_fcoll_base_coll_bcast_array (void *buff,
100-
int count,
102+
size_t count,
101103
ompi_datatype_t *datatype,
102104
int root_index,
103105
int *procs_in_group,

ompi/mca/fcoll/base/fcoll_base_find_available.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
13+
* Copyright (c) 2024 Triad National Security, LLC. All rights
14+
* reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -31,7 +33,7 @@
3133
static int init_query(const mca_base_component_t *m,
3234
bool enable_progress_threads,
3335
bool enable_mpi_threads);
34-
static int init_query_2_0_0(const mca_base_component_t *component,
36+
static int init_query_3_0_0(const mca_base_component_t *component,
3537
bool enable_progress_threads,
3638
bool enable_mpi_threads);
3739

@@ -83,10 +85,10 @@ static int init_query(const mca_base_component_t *m,
8385
m->mca_component_name);
8486

8587
/* This component has been successfully opened, now try to query it */
86-
if (2 == m->mca_type_major_version &&
88+
if (3 == m->mca_type_major_version &&
8789
0 == m->mca_type_minor_version &&
8890
0 == m->mca_type_release_version) {
89-
ret = init_query_2_0_0(m, enable_progress_threads,
91+
ret = init_query_3_0_0(m, enable_progress_threads,
9092
enable_mpi_threads);
9193
} else {
9294
/* unrecognised API version */
@@ -114,12 +116,12 @@ static int init_query(const mca_base_component_t *m,
114116
}
115117

116118

117-
static int init_query_2_0_0(const mca_base_component_t *component,
119+
static int init_query_3_0_0(const mca_base_component_t *component,
118120
bool enable_progress_threads,
119121
bool enable_mpi_threads)
120122
{
121-
mca_fcoll_base_component_2_0_0_t *fcoll =
122-
(mca_fcoll_base_component_2_0_0_t *) component;
123+
mca_fcoll_base_component_3_0_0_t *fcoll =
124+
(mca_fcoll_base_component_3_0_0_t *) component;
123125

124126
return fcoll->fcollm_init_query(enable_progress_threads,
125127
enable_mpi_threads);

0 commit comments

Comments
 (0)