Skip to content

Commit 4654149

Browse files
authored
Merge pull request #7828 from edgargabriel/pr/v4.1.x-avg-fview-size
common/ompio: use avg. file view size in the aggregator selection logic
2 parents 173142b + eeee011 commit 4654149

File tree

3 files changed

+9
-46
lines changed

3 files changed

+9
-46
lines changed

ompi/mca/common/ompio/common_ompio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
13+
* Copyright (c) 2008-2020 University of Houston. All rights reserved.
1414
* Copyright (c) 2018 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
1616
* Copyright (c) 2018 DataDirect Networks. All rights reserved.
@@ -166,6 +166,7 @@ struct ompio_file_t {
166166
size_t f_stripe_size;
167167
int f_stripe_count;
168168
size_t f_cc_size;
169+
size_t f_avg_view_size;
169170
int f_bytes_per_agg;
170171
enum ompio_fs_type f_fstype;
171172
ompi_request_t *f_split_coll_req;

ompi/mca/common/ompio/common_ompio_aggregators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int mca_common_ompio_simple_grouping(ompio_file_t *fh,
107107
/* Determine whether to use the formula for 1-D or 2-D data decomposition. Anything
108108
** that is not 1-D is assumed to be 2-D in this version
109109
*/
110-
mode = ( fh->f_cc_size == fh->f_view_size ) ? 1 : 2;
110+
mode = ( fh->f_cc_size == fh->f_avg_view_size ) ? 1 : 2;
111111

112112
/* Determine the increment size when searching the optimal
113113
** no. of aggregators

ompi/mca/common/ompio/common_ompio_file_view.c

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -328,36 +328,28 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
328328

329329
OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag)
330330
{
331-
int uniform = 0;
332331
OMPI_MPI_OFFSET_TYPE avg[3] = {0,0,0};
333332
OMPI_MPI_OFFSET_TYPE global_avg[3] = {0,0,0};
334333
int i = 0;
335334

336-
/* This function does two things: first, it determines the average data chunk
337-
** size in the file view for each process and across all processes.
338-
** Second, it establishes whether the view across all processes is uniform.
339-
** By definition, uniform means:
340-
** 1. the file view of each process has the same number of contiguous sections
341-
** 2. each section in the file view has exactly the same size
335+
/* This function determines the average data chunk
336+
** size in the file view for each process and across all processes,
337+
** and the avg. file_view size across processes.
342338
*/
343339

344340
if ( flag ) {
345341
global_avg[0] = MCA_IO_DEFAULT_FILE_VIEW_SIZE;
342+
fh->f_avg_view_size = fh->f_view_size;
346343
}
347344
else {
348345
for (i=0 ; i<(int)fh->f_iov_count ; i++) {
349346
avg[0] += fh->f_decoded_iov[i].iov_len;
350-
if (i && 0 == uniform) {
351-
if (fh->f_decoded_iov[i].iov_len != fh->f_decoded_iov[i-1].iov_len) {
352-
uniform = 1;
353-
}
354-
}
355347
}
356348
if ( 0 != fh->f_iov_count ) {
357349
avg[0] = avg[0]/fh->f_iov_count;
358350
}
359351
avg[1] = (OMPI_MPI_OFFSET_TYPE) fh->f_iov_count;
360-
avg[2] = (OMPI_MPI_OFFSET_TYPE) uniform;
352+
avg[2] = (OMPI_MPI_OFFSET_TYPE) fh->f_view_size;
361353

362354
fh->f_comm->c_coll->coll_allreduce (avg,
363355
global_avg,
@@ -368,37 +360,7 @@ OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag)
368360
fh->f_comm->c_coll->coll_allreduce_module);
369361
global_avg[0] = global_avg[0]/fh->f_size;
370362
global_avg[1] = global_avg[1]/fh->f_size;
371-
372-
#if 0
373-
/* Disabling the feature since we are not using it anyway. Saves us one allreduce operation. */
374-
int global_uniform=0;
375-
376-
if ( global_avg[0] == avg[0] &&
377-
global_avg[1] == avg[1] &&
378-
0 == avg[2] &&
379-
0 == global_avg[2] ) {
380-
uniform = 0;
381-
}
382-
else {
383-
uniform = 1;
384-
}
385-
386-
/* second confirmation round to see whether all processes agree
387-
** on having a uniform file view or not
388-
*/
389-
fh->f_comm->c_coll->coll_allreduce (&uniform,
390-
&global_uniform,
391-
1,
392-
MPI_INT,
393-
MPI_MAX,
394-
fh->f_comm,
395-
fh->f_comm->c_coll->coll_allreduce_module);
396-
397-
if ( 0 == global_uniform ){
398-
/* yes, everybody agrees on having a uniform file view */
399-
fh->f_flags |= OMPIO_UNIFORM_FVIEW;
400-
}
401-
#endif
363+
fh->f_avg_view_size = global_avg[2]/fh->f_size;
402364
}
403365

404366
return global_avg[0];

0 commit comments

Comments
 (0)