Skip to content

Commit 7877743

Browse files
authored
Merge pull request #6857 from raafatfeki/pr/ompio_coll_write_clean
Pr/ompio_fcoll_write_clean
2 parents 73c5fe8 + 2c6a5ee commit 7877743

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
801801
}
802802

803803
for(l=0;l<data->procs_per_group;l++){
804-
data->disp_index[l] = 1;
804+
data->disp_index[l] = 0;
805805

806806
if(data->max_disp_index[l] == 0) {
807807
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
880880
if (data->bytes_remaining <= data->bytes_to_write_in_cycle) {
881881
/* The data fits completely into the block */
882882
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]] =
885885
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base +
886886
(data->global_iov_array[data->sorted[data->current_index]].iov_len
887887
- data->bytes_remaining);
@@ -914,11 +914,12 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
914914
/* the remaining data from the previous cycle is larger than the
915915
data->bytes_to_write_in_cycle, so we have to segment again */
916916
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]] =
919919
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base +
920920
(data->global_iov_array[data->sorted[data->current_index]].iov_len
921921
- data->bytes_remaining);
922+
data->disp_index[data->n] += 1;
922923
}
923924

924925
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
935936
(MPI_Aint) data->global_iov_array[data->sorted[data->current_index]].iov_len) {
936937
/* This entry has more data than we can sendin one cycle */
937938
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]] =
940941
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base ;
942+
data->disp_index[data->n] += 1;
941943
}
942944
if (data->procs_in_group[data->n] == rank) {
943945
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
951953
else {
952954
/* Next data entry is less than data->bytes_to_write_in_cycle */
953955
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]] =
955957
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)
957959
data->global_iov_array[data->sorted[data->current_index]].iov_base;
958960

959961
data->disp_index[data->n] += 1;

ompi/mca/fcoll/vulcan/fcoll_vulcan_file_write_all.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
836836

837837

838838
for(l=0;l<data->procs_per_group;l++){
839-
data->disp_index[l] = 1;
839+
data->disp_index[l] = 0;
840840

841841
if ( data->max_disp_index[l] == 0 ) {
842842
data->blocklen_per_process[l] = (int *) calloc (INIT_LEN, sizeof(int));
@@ -915,8 +915,8 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
915915
if (data->bytes_remaining <= data->bytes_to_write_in_cycle) {
916916
/* The data fits completely into the block */
917917
if (aggregator == rank) {
918-
data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_remaining;
919-
data->displs_per_process[data->n][data->disp_index[data->n] - 1] =
918+
data->blocklen_per_process[data->n][data->disp_index[data->n]] = data->bytes_remaining;
919+
data->displs_per_process[data->n][data->disp_index[data->n]] =
920920
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base +
921921
(data->global_iov_array[data->sorted[data->current_index]].iov_len
922922
- data->bytes_remaining);
@@ -950,11 +950,12 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
950950
/* the remaining data from the previous cycle is larger than the
951951
data->bytes_to_write_in_cycle, so we have to segment again */
952952
if (aggregator == rank) {
953-
data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_to_write_in_cycle;
954-
data->displs_per_process[data->n][data->disp_index[data->n] - 1] =
953+
data->blocklen_per_process[data->n][data->disp_index[data->n]] = data->bytes_to_write_in_cycle;
954+
data->displs_per_process[data->n][data->disp_index[data->n]] =
955955
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base +
956956
(data->global_iov_array[data->sorted[data->current_index]].iov_len
957957
- data->bytes_remaining);
958+
data->disp_index[data->n] += 1;
958959
}
959960

960961
if (data->procs_in_group[data->n] == rank) {
@@ -971,9 +972,10 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
971972
(MPI_Aint) data->global_iov_array[data->sorted[data->current_index]].iov_len) {
972973
/* This entry has more data than we can sendin one cycle */
973974
if (aggregator == rank) {
974-
data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] = data->bytes_to_write_in_cycle;
975-
data->displs_per_process[data->n][data->disp_index[data->n] - 1] =
975+
data->blocklen_per_process[data->n][data->disp_index[data->n]] = data->bytes_to_write_in_cycle;
976+
data->displs_per_process[data->n][data->disp_index[data->n]] =
976977
(ptrdiff_t)data->global_iov_array[data->sorted[data->current_index]].iov_base ;
978+
data->disp_index[data->n] += 1;
977979
}
978980
if (data->procs_in_group[data->n] == rank) {
979981
bytes_sent += data->bytes_to_write_in_cycle;
@@ -987,9 +989,9 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
987989
else {
988990
/* Next data entry is less than data->bytes_to_write_in_cycle */
989991
if (aggregator == rank) {
990-
data->blocklen_per_process[data->n][data->disp_index[data->n] - 1] =
992+
data->blocklen_per_process[data->n][data->disp_index[data->n]] =
991993
data->global_iov_array[data->sorted[data->current_index]].iov_len;
992-
data->displs_per_process[data->n][data->disp_index[data->n] - 1] = (ptrdiff_t)
994+
data->displs_per_process[data->n][data->disp_index[data->n]] = (ptrdiff_t)
993995
data->global_iov_array[data->sorted[data->current_index]].iov_base;
994996

995997
data->disp_index[data->n] += 1;

0 commit comments

Comments
 (0)