@@ -350,36 +350,28 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
350350
351351OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t * fh , int flag )
352352{
353- int uniform = 0 ;
354353 OMPI_MPI_OFFSET_TYPE avg [3 ] = {0 ,0 ,0 };
355354 OMPI_MPI_OFFSET_TYPE global_avg [3 ] = {0 ,0 ,0 };
356355 int i = 0 ;
357356
358- /* This function does two things: first, it determines the average data chunk
359- ** size in the file view for each process and across all processes.
360- ** Second, it establishes whether the view across all processes is uniform.
361- ** By definition, uniform means:
362- ** 1. the file view of each process has the same number of contiguous sections
363- ** 2. each section in the file view has exactly the same size
357+ /* This function determines the average data chunk
358+ ** size in the file view for each process and across all processes,
359+ ** and the avg. file_view size across processes.
364360 */
365361
366362 if ( flag ) {
367363 global_avg [0 ] = MCA_IO_DEFAULT_FILE_VIEW_SIZE ;
364+ fh -> f_avg_view_size = fh -> f_view_size ;
368365 }
369366 else {
370367 for (i = 0 ; i < (int )fh -> f_iov_count ; i ++ ) {
371368 avg [0 ] += fh -> f_decoded_iov [i ].iov_len ;
372- if (i && 0 == uniform ) {
373- if (fh -> f_decoded_iov [i ].iov_len != fh -> f_decoded_iov [i - 1 ].iov_len ) {
374- uniform = 1 ;
375- }
376- }
377369 }
378370 if ( 0 != fh -> f_iov_count ) {
379371 avg [0 ] = avg [0 ]/fh -> f_iov_count ;
380372 }
381373 avg [1 ] = (OMPI_MPI_OFFSET_TYPE ) fh -> f_iov_count ;
382- avg [2 ] = (OMPI_MPI_OFFSET_TYPE ) uniform ;
374+ avg [2 ] = (OMPI_MPI_OFFSET_TYPE ) fh -> f_view_size ;
383375
384376 fh -> f_comm -> c_coll -> coll_allreduce (avg ,
385377 global_avg ,
@@ -390,37 +382,7 @@ OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag)
390382 fh -> f_comm -> c_coll -> coll_allreduce_module );
391383 global_avg [0 ] = global_avg [0 ]/fh -> f_size ;
392384 global_avg [1 ] = global_avg [1 ]/fh -> f_size ;
393-
394- #if 0
395- /* Disabling the feature since we are not using it anyway. Saves us one allreduce operation. */
396- int global_uniform = 0 ;
397-
398- if ( global_avg [0 ] == avg [0 ] &&
399- global_avg [1 ] == avg [1 ] &&
400- 0 == avg [2 ] &&
401- 0 == global_avg [2 ] ) {
402- uniform = 0 ;
403- }
404- else {
405- uniform = 1 ;
406- }
407-
408- /* second confirmation round to see whether all processes agree
409- ** on having a uniform file view or not
410- */
411- fh -> f_comm -> c_coll -> coll_allreduce (& uniform ,
412- & global_uniform ,
413- 1 ,
414- MPI_INT ,
415- MPI_MAX ,
416- fh -> f_comm ,
417- fh -> f_comm -> c_coll -> coll_allreduce_module );
418-
419- if ( 0 == global_uniform ){
420- /* yes, everybody agrees on having a uniform file view */
421- fh -> f_flags |= OMPIO_UNIFORM_FVIEW ;
422- }
423- #endif
385+ fh -> f_avg_view_size = global_avg [2 ]/fh -> f_size ;
424386 }
425387
426388 return global_avg [0 ];
0 commit comments