@@ -328,36 +328,28 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
328328
329329OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t * fh , int flag )
330330{
331- int uniform = 0 ;
332331 OMPI_MPI_OFFSET_TYPE avg [3 ] = {0 ,0 ,0 };
333332 OMPI_MPI_OFFSET_TYPE global_avg [3 ] = {0 ,0 ,0 };
334333 int i = 0 ;
335334
336- /* This function does two things: first, it determines the average data chunk
337- ** size in the file view for each process and across all processes.
338- ** Second, it establishes whether the view across all processes is uniform.
339- ** By definition, uniform means:
340- ** 1. the file view of each process has the same number of contiguous sections
341- ** 2. each section in the file view has exactly the same size
335+ /* This function determines the average data chunk
336+ ** size in the file view for each process and across all processes,
337+ ** and the avg. file_view size across processes.
342338 */
343339
344340 if ( flag ) {
345341 global_avg [0 ] = MCA_IO_DEFAULT_FILE_VIEW_SIZE ;
342+ fh -> f_avg_view_size = fh -> f_view_size ;
346343 }
347344 else {
348345 for (i = 0 ; i < (int )fh -> f_iov_count ; i ++ ) {
349346 avg [0 ] += fh -> f_decoded_iov [i ].iov_len ;
350- if (i && 0 == uniform ) {
351- if (fh -> f_decoded_iov [i ].iov_len != fh -> f_decoded_iov [i - 1 ].iov_len ) {
352- uniform = 1 ;
353- }
354- }
355347 }
356348 if ( 0 != fh -> f_iov_count ) {
357349 avg [0 ] = avg [0 ]/fh -> f_iov_count ;
358350 }
359351 avg [1 ] = (OMPI_MPI_OFFSET_TYPE ) fh -> f_iov_count ;
360- avg [2 ] = (OMPI_MPI_OFFSET_TYPE ) uniform ;
352+ avg [2 ] = (OMPI_MPI_OFFSET_TYPE ) fh -> f_view_size ;
361353
362354 fh -> f_comm -> c_coll -> coll_allreduce (avg ,
363355 global_avg ,
@@ -368,37 +360,7 @@ OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag)
368360 fh -> f_comm -> c_coll -> coll_allreduce_module );
369361 global_avg [0 ] = global_avg [0 ]/fh -> f_size ;
370362 global_avg [1 ] = global_avg [1 ]/fh -> f_size ;
371-
372- #if 0
373- /* Disabling the feature since we are not using it anyway. Saves us one allreduce operation. */
374- int global_uniform = 0 ;
375-
376- if ( global_avg [0 ] == avg [0 ] &&
377- global_avg [1 ] == avg [1 ] &&
378- 0 == avg [2 ] &&
379- 0 == global_avg [2 ] ) {
380- uniform = 0 ;
381- }
382- else {
383- uniform = 1 ;
384- }
385-
386- /* second confirmation round to see whether all processes agree
387- ** on having a uniform file view or not
388- */
389- fh -> f_comm -> c_coll -> coll_allreduce (& uniform ,
390- & global_uniform ,
391- 1 ,
392- MPI_INT ,
393- MPI_MAX ,
394- fh -> f_comm ,
395- fh -> f_comm -> c_coll -> coll_allreduce_module );
396-
397- if ( 0 == global_uniform ){
398- /* yes, everybody agrees on having a uniform file view */
399- fh -> f_flags |= OMPIO_UNIFORM_FVIEW ;
400- }
401- #endif
363+ fh -> f_avg_view_size = global_avg [2 ]/fh -> f_size ;
402364 }
403365
404366 return global_avg [0 ];
0 commit comments