1
1

Re-enable the contiguous buffer optimization to the read_all and the write_all routines.

After long debugging, I found last week the reason this optimization originally broke
some hdf5 tests. We now pass the hdf5 test suite with the optimization being actively used.
Этот коммит содержится в:
Edgar Gabriel 2015-08-31 14:25:40 -05:00
родитель c2c44b11dc
Коммит a1778406d6
2 изменённых файлов: 37 добавлений и 16 удалений

Просмотреть файл

@ -94,6 +94,10 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
ompi_datatype_t **sendtype = NULL;
MPI_Request *send_req=NULL, recv_req=NULL;
int my_aggregator =-1;
bool recvbuf_is_contiguous=false;
size_t ftype_size;
OPAL_PTRDIFF_TYPE ftype_extent, lb;
#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN
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,
/**************************************************************************
** 1. In case the data is not contigous in memory, decode it into an iovec
**************************************************************************/
opal_datatype_type_size ( &datatype->super, &ftype_size );
opal_datatype_get_extent ( &datatype->super, &lb, &ftype_extent );
if ( (ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) &&
opal_datatype_is_contiguous_memory_layout(&datatype->super,1) &&
0 == lb ) {
recvbuf_is_contiguous = true;
}
// if (opal_datatype_is_contiguous_memory_layout(&datatype->super,1)) {
// fh->f_flags |= OMPIO_CONTIGUOUS_MEMORY;
// }
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (! recvbuf_is_contiguous ) {
ret = fh->f_decode_datatype ((struct mca_io_ompio_file_t *)fh,
datatype,
count,
@ -760,7 +771,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
/**********************************************************
*** 7f. Scatter the Data from the readers
*********************************************************/
if (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY) {
if ( recvbuf_is_contiguous ) {
receive_buf = &((char*)buf)[position];
}
else if (bytes_received) {
@ -807,7 +818,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
/* If data is not contigous in memory, copy the data from the
receive buffer into the buffer passed in */
if (!(fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (!recvbuf_is_contiguous ) {
OPAL_PTRDIFF_TYPE mem_address;
size_t remaining = 0;
size_t temp_position = 0;
@ -868,7 +879,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh,
#endif
exit:
if (!(fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (!recvbuf_is_contiguous) {
if (NULL != receive_buf) {
free (receive_buf);
receive_buf = NULL;

Просмотреть файл

@ -96,6 +96,10 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
MPI_Aint *total_bytes_per_process = NULL;
MPI_Request send_req=NULL, *recv_req=NULL;
int my_aggregator=-1;
bool sendbuf_is_contiguous = false;
size_t ftype_size;
OPAL_PTRDIFF_TYPE ftype_extent, lb;
#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN
double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0;
@ -103,16 +107,22 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
double exch_write = 0.0, start_exch = 0.0, end_exch = 0.0;
mca_io_ompio_print_entry nentry;
#endif
// if (opal_datatype_is_contiguous_memory_layout(&datatype->super,1)) {
// fh->f_flags |= OMPIO_CONTIGUOUS_MEMORY;
// }
opal_datatype_type_size ( &datatype->super, &ftype_size );
opal_datatype_get_extent ( &datatype->super, &lb, &ftype_extent );
/**************************************************************************
** 1. In case the data is not contigous in memory, decode it into an iovec
**************************************************************************/
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if ( ( ftype_extent == (OPAL_PTRDIFF_TYPE) ftype_size) &&
opal_datatype_is_contiguous_memory_layout(&datatype->super,1) &&
0 == lb ) {
sendbuf_is_contiguous = true;
}
if (! sendbuf_is_contiguous ) {
ret = fh->f_decode_datatype ((struct mca_io_ompio_file_t *) fh,
datatype,
count,
@ -791,7 +801,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
} /* end if (my_aggregator == fh->f_rank ) */
if (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY) {
if ( sendbuf_is_contiguous ) {
send_buf = &((char*)buf)[total_bytes_written];
}
else if (bytes_sent) {
@ -880,7 +890,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
}
#endif
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (! sendbuf_is_contiguous) {
if (NULL != send_buf) {
free (send_buf);
send_buf = NULL;
@ -1050,7 +1060,7 @@ exit :
}
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (! sendbuf_is_contiguous) {
if (NULL != send_buf) {
free (send_buf);
send_buf = NULL;