@@ -801,7 +801,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
801
801
}
802
802
803
803
for (l = 0 ;l < data -> procs_per_group ;l ++ ){
804
- data -> disp_index [l ] = 1 ;
804
+ data -> disp_index [l ] = 0 ;
805
805
806
806
if (data -> max_disp_index [l ] == 0 ) {
807
807
data -> blocklen_per_process [l ] = (int * ) calloc (INIT_LEN , sizeof (int ));
@@ -880,8 +880,8 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
880
880
if (data -> bytes_remaining <= data -> bytes_to_write_in_cycle ) {
881
881
/* The data fits completely into the block */
882
882
if (aggregator == rank ) {
883
- data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] = data -> bytes_remaining ;
884
- data -> displs_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] =
883
+ data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ]] = data -> bytes_remaining ;
884
+ data -> displs_per_process [data -> n ][data -> disp_index [data -> n ]] =
885
885
(ptrdiff_t )data -> global_iov_array [data -> sorted [data -> current_index ]].iov_base +
886
886
(data -> global_iov_array [data -> sorted [data -> current_index ]].iov_len
887
887
- data -> bytes_remaining );
@@ -914,11 +914,12 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
914
914
/* the remaining data from the previous cycle is larger than the
915
915
data->bytes_to_write_in_cycle, so we have to segment again */
916
916
if (aggregator == rank ) {
917
- data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] = data -> bytes_to_write_in_cycle ;
918
- data -> displs_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] =
917
+ data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ]] = data -> bytes_to_write_in_cycle ;
918
+ data -> displs_per_process [data -> n ][data -> disp_index [data -> n ]] =
919
919
(ptrdiff_t )data -> global_iov_array [data -> sorted [data -> current_index ]].iov_base +
920
920
(data -> global_iov_array [data -> sorted [data -> current_index ]].iov_len
921
921
- data -> bytes_remaining );
922
+ data -> disp_index [data -> n ] += 1 ;
922
923
}
923
924
924
925
if (data -> procs_in_group [data -> n ] == rank ) {
@@ -935,9 +936,10 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
935
936
(MPI_Aint ) data -> global_iov_array [data -> sorted [data -> current_index ]].iov_len ) {
936
937
/* This entry has more data than we can sendin one cycle */
937
938
if (aggregator == rank ) {
938
- data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] = data -> bytes_to_write_in_cycle ;
939
- data -> displs_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] =
939
+ data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ]] = data -> bytes_to_write_in_cycle ;
940
+ data -> displs_per_process [data -> n ][data -> disp_index [data -> n ]] =
940
941
(ptrdiff_t )data -> global_iov_array [data -> sorted [data -> current_index ]].iov_base ;
942
+ data -> disp_index [data -> n ] += 1 ;
941
943
}
942
944
if (data -> procs_in_group [data -> n ] == rank ) {
943
945
bytes_sent += data -> bytes_to_write_in_cycle ;
@@ -951,9 +953,9 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
951
953
else {
952
954
/* Next data entry is less than data->bytes_to_write_in_cycle */
953
955
if (aggregator == rank ) {
954
- data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] =
956
+ data -> blocklen_per_process [data -> n ][data -> disp_index [data -> n ]] =
955
957
data -> global_iov_array [data -> sorted [data -> current_index ]].iov_len ;
956
- data -> displs_per_process [data -> n ][data -> disp_index [data -> n ] - 1 ] = (ptrdiff_t )
958
+ data -> displs_per_process [data -> n ][data -> disp_index [data -> n ]] = (ptrdiff_t )
957
959
data -> global_iov_array [data -> sorted [data -> current_index ]].iov_base ;
958
960
959
961
data -> disp_index [data -> n ] += 1 ;
0 commit comments