Skip to content

Commit 1da8f1e

Browse files
committed
fcoll/dynamic_gen2: fix bug exposed by uneven distribution of data
This fixes a bug reported in-house occuring with this component. It is triggered if the data assigned to different aggregators is highly differing, leading to different number of internal iterations required to handle it. Signed-off-by: Edgar Gabriel <[email protected]>
1 parent 95abc9e commit 1da8f1e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,13 +801,18 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
801801
/**************************************************************************
802802
*** 7b. Determine the number of bytes to be actually written in this cycle
803803
**************************************************************************/
804-
if (cycles-1 == index) {
805-
data->bytes_to_write_in_cycle = data->total_bytes - data->bytes_per_cycle*index;
804+
int local_cycles= ceil((double)data->total_bytes / data->bytes_per_cycle);
805+
if ( index < (local_cycles -1) ) {
806+
data->bytes_to_write_in_cycle = data->bytes_per_cycle;
807+
}
808+
else if ( index == (local_cycles -1)) {
809+
data->bytes_to_write_in_cycle = data->total_bytes - data->bytes_per_cycle*index ;
806810
}
807811
else {
808-
data->bytes_to_write_in_cycle = data->bytes_per_cycle;
812+
data->bytes_to_write_in_cycle = 0;
809813
}
810814
data->bytes_to_write = data->bytes_to_write_in_cycle;
815+
811816
#if DEBUG_ON
812817
if (aggregator == rank) {
813818
printf ("****%d: CYCLE %d Bytes %lld**********\n",

0 commit comments

Comments
 (0)