Skip to content

Commit c5a7e6e

Browse files
committed
add a new option for a simple aggregator selection which has zero communication costs.
1 parent 95cfa14 commit c5a7e6e

File tree

2 files changed

+69
-9
lines changed

2 files changed

+69
-9
lines changed

ompi/mca/io/ompio/io_ompio.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
110110
#define NO_REFINEMENT 6
111111

112112

113-
#define OMPIO_UNIFORM_DIST_THRESHOLD 0.5
114-
#define OMPIO_CONTG_THRESHOLD 1048576
115-
#define OMPIO_PROCS_PER_GROUP_TAG 0
116-
#define OMPIO_PROCS_IN_GROUP_TAG 1
117-
#define OMPIO_MERGE_THRESHOLD 0.5
113+
#define OMPIO_UNIFORM_DIST_THRESHOLD 0.5
114+
#define OMPIO_CONTG_THRESHOLD 1048576
115+
#define OMPIO_CONTG_FACTOR 4
116+
#define OMPIO_DEFAULT_STRIPE_SIZE 1048576
117+
#define OMPIO_PROCS_PER_GROUP_TAG 0
118+
#define OMPIO_PROCS_IN_GROUP_TAG 1
119+
#define OMPIO_MERGE_THRESHOLD 0.5
118120

119121
/*---------------------------*/
120122

@@ -548,6 +550,9 @@ int mca_io_ompio_cart_based_grouping(mca_io_ompio_file_t *ompio_fh);
548550
int mca_io_ompio_fview_based_grouping(mca_io_ompio_file_t *fh,
549551
int *num_groups,
550552
contg *contg_groups);
553+
int mca_io_ompio_simple_grouping(mca_io_ompio_file_t *fh,
554+
int *num_groups,
555+
contg *contg_groups);
551556

552557
int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
553558
int num_groups,

ompi/mca/io/ompio/io_ompio_file_set_view.c

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,26 @@ int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh,
147147
}
148148
}
149149

150-
if( OMPI_SUCCESS != mca_io_ompio_fview_based_grouping(fh,
150+
if ( SIMPLE != mca_io_ompio_grouping_option ) {
151+
if( OMPI_SUCCESS != mca_io_ompio_fview_based_grouping(fh,
151152
&num_groups,
152153
contg_groups)){
153-
opal_output(1, "mca_io_ompio_fview_based_grouping() failed\n");
154-
free(contg_groups);
155-
return OMPI_ERROR;
154+
opal_output(1, "mca_io_ompio_fview_based_grouping() failed\n");
155+
free(contg_groups);
156+
return OMPI_ERROR;
157+
}
158+
}
159+
else {
160+
if( OMPI_SUCCESS != mca_io_ompio_simple_grouping(fh,
161+
&num_groups,
162+
contg_groups)){
163+
opal_output(1, "mca_io_ompio_simple_grouping() failed\n");
164+
free(contg_groups);
165+
return OMPI_ERROR;
166+
}
156167
}
157168

169+
158170
mca_io_ompio_finalize_initial_grouping(fh,
159171
num_groups,
160172
contg_groups);
@@ -298,6 +310,49 @@ OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (mca_io_ompio_file_t *fh)
298310
return global_avg[0];
299311
}
300312

313+
int mca_io_ompio_simple_grouping(mca_io_ompio_file_t *fh,
314+
int *num_groups,
315+
contg *contg_groups)
316+
{
317+
size_t stripe_size = (size_t) fh->f_stripe_size;
318+
int group_size = 0;
319+
int k=0, p=0, g=0;
320+
int total_procs = 0;
321+
322+
if ( 0 < fh->f_stripe_size ) {
323+
stripe_size = OMPIO_DEFAULT_STRIPE_SIZE;
324+
}
325+
326+
if ( stripe_size > fh->f_cc_size ) {
327+
group_size = (((int)stripe_size/(int)fh->f_cc_size) > fh->f_size ) ? fh->f_size : ((int)stripe_size/(int)fh->f_cc_size);
328+
*num_groups = fh->f_size / group_size;
329+
}
330+
else if ( fh->f_cc_size < OMPIO_CONTG_FACTOR * stripe_size) {
331+
*num_groups = fh->f_size / OMPIO_CONTG_FACTOR;
332+
group_size = OMPIO_CONTG_FACTOR;
333+
}
334+
else {
335+
*num_groups = fh->f_size;
336+
group_size = 1;
337+
}
338+
339+
for ( k=0, p=0; p<*num_groups; p++ ) {
340+
if ( p == (*num_groups - 1) ) {
341+
contg_groups[p].procs_per_contg_group = fh->f_size - total_procs;
342+
}
343+
else {
344+
contg_groups[p].procs_per_contg_group = group_size;
345+
total_procs +=group_size;
346+
}
347+
for ( g=0; g<contg_groups[p].procs_per_contg_group; g++ ) {
348+
contg_groups[p].procs_in_contg_group[g] = k;
349+
k++;
350+
}
351+
}
352+
353+
return OMPI_SUCCESS;
354+
}
355+
301356
int mca_io_ompio_fview_based_grouping(mca_io_ompio_file_t *fh,
302357
int *num_groups,
303358
contg *contg_groups)

0 commit comments

Comments
 (0)