@@ -94,6 +94,10 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
9494 ompi_datatype_t * * sendtype = NULL ;
9595 MPI_Request * send_req = NULL , recv_req = NULL ;
9696 int my_aggregator = -1 ;
97+ bool recvbuf_is_contiguous = false;
98+ size_t ftype_size ;
99+ OPAL_PTRDIFF_TYPE ftype_extent , lb ;
100+
97101
98102#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN
99103 double read_time = 0.0 , start_read_time = 0.0 , end_read_time = 0.0 ;
@@ -105,11 +109,18 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
105109 /**************************************************************************
106110 ** 1. In case the data is not contigous in memory, decode it into an iovec
107111 **************************************************************************/
112+
113+ opal_datatype_type_size ( & datatype -> super , & ftype_size );
114+ opal_datatype_get_extent ( & datatype -> super , & lb , & ftype_extent );
115+
116+ if ( (ftype_extent == (OPAL_PTRDIFF_TYPE ) ftype_size ) &&
117+ opal_datatype_is_contiguous_memory_layout (& datatype -> super ,1 ) &&
118+ 0 == lb ) {
119+ recvbuf_is_contiguous = true;
120+ }
121+
108122
109- // if (opal_datatype_is_contiguous_memory_layout(&datatype->super,1)) {
110- // fh->f_flags |= OMPIO_CONTIGUOUS_MEMORY;
111- // }
112- if (! (fh -> f_flags & OMPIO_CONTIGUOUS_MEMORY )) {
123+ if (! recvbuf_is_contiguous ) {
113124 ret = fh -> f_decode_datatype ((struct mca_io_ompio_file_t * )fh ,
114125 datatype ,
115126 count ,
@@ -760,7 +771,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
760771 /**********************************************************
761772 *** 7f. Scatter the Data from the readers
762773 *********************************************************/
763- if (fh -> f_flags & OMPIO_CONTIGUOUS_MEMORY ) {
774+ if ( recvbuf_is_contiguous ) {
764775 receive_buf = & ((char * )buf )[position ];
765776 }
766777 else if (bytes_received ) {
@@ -807,7 +818,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
807818
808819 /* If data is not contigous in memory, copy the data from the
809820 receive buffer into the buffer passed in */
810- if (!( fh -> f_flags & OMPIO_CONTIGUOUS_MEMORY ) ) {
821+ if (!recvbuf_is_contiguous ) {
811822 OPAL_PTRDIFF_TYPE mem_address ;
812823 size_t remaining = 0 ;
813824 size_t temp_position = 0 ;
@@ -868,7 +879,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
868879#endif
869880
870881exit :
871- if (!( fh -> f_flags & OMPIO_CONTIGUOUS_MEMORY ) ) {
882+ if (!recvbuf_is_contiguous ) {
872883 if (NULL != receive_buf ) {
873884 free (receive_buf );
874885 receive_buf = NULL ;
0 commit comments