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-2011 University of Houston. All rights reserved.
13+ * Copyright (c) 2008-2019 University of Houston. All rights reserved.
1414 * Copyright (c) 2014-2018 Research Organization for Information Science
1515 * and Technology (RIST). All rights reserved.
1616 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
@@ -156,23 +156,26 @@ int mca_fcoll_two_phase_calc_aggregator(ompio_file_t *fh,
156156{
157157
158158
159- int rank_index , rank ;
159+ int rank_index , rank ;
160160 OMPI_MPI_OFFSET_TYPE avail_bytes ;
161-
162- rank_index = (int ) ((off - min_off + fd_size )/ fd_size - 1 );
163-
161+ long long off_ll = (long long ) off ;
162+ long long min_off_ll = (long long ) min_off ;
163+ long long fd_size_ll = (long long ) fd_size ;
164+ long long rank_index_ll ;
165+
166+ rank_index_ll = (((off_ll - min_off_ll + fd_size_ll )/ fd_size_ll ) - 1 );
167+ rank_index = (int ) rank_index_ll ;
164168 if (striping_unit > 0 ){
165169 rank_index = 0 ;
166170 while (off > fd_end [rank_index ]) rank_index ++ ;
167171 }
168172
169-
170173 if (rank_index >= num_aggregators || rank_index < 0 ) {
171174 fprintf (stderr ,
172- "Error in ompi_io_ompio_calcl_aggregator() :" );
175+ "Error in mca_fcoll_two_phase_calc_aggregator :" );
173176 fprintf (stderr ,
174- "rank_index(%d) >= num_aggregators(%d)fd_size=%lld off=%lld \n" ,
175- rank_index ,num_aggregators ,fd_size ,off );
177+ "rank_index(%d) >= num_aggregators(%d) fd_size=%ld off=%ld min_off=%ld striping_unit=%d \n" ,
178+ rank_index , num_aggregators , fd_size , off , min_off , striping_unit );
176179 ompi_mpi_abort (& ompi_mpi_comm_world .comm , 1 );
177180 }
178181
@@ -184,9 +187,9 @@ int mca_fcoll_two_phase_calc_aggregator(ompio_file_t *fh,
184187
185188 rank = aggregator_list [rank_index ];
186189
187- #if 0
190+ #if 0
188191 printf ("rank : %d, rank_index : %d\n" ,rank , rank_index );
189- #endif
192+ #endif
190193
191194 return rank ;
192195}
0 commit comments