1
1

use the fbtl return value as originally intended, namely to retrieve the

number of bytes written and read. Status contains now the actual number of
bytes written for individual operations. For collective operations, this is
unfortunately not possible.

This commit was SVN r32674.
Этот коммит содержится в:
Edgar Gabriel 2014-09-07 15:14:57 +00:00
родитель 6323b226c7
Коммит 0f59ce6591
10 изменённых файлов: 44 добавлений и 22 удалений

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

@ -32,7 +32,9 @@ size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
struct iovec *iov = NULL;
int iov_count = 0;
OMPI_MPI_OFFSET_TYPE iov_offset = 0;
ssize_t bytes_read=0, ret_code=0;
size_t ret=0;
if (NULL == fh->f_io_array) {
return OMPI_ERROR;
}
@ -79,12 +81,18 @@ size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
perror ("fseek");
return OMPI_ERROR;
}
if (-1 == readv (fh->fd, iov, iov_count)) {
ret_code = readv (fh->fd, iov, iov_count);
if ( 0 < ret_code ) {
bytes_read+=ret_code;
}
else if ( ret_code == -1 ) {
perror ("readv");
return OMPI_ERROR;
}
else {
else if ( 0 == ret_code ){
/* end of file reached, no point in continue reading; */
iov_count = 0;
break;
}
}
@ -93,5 +101,6 @@ size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
iov = NULL;
}
return OMPI_SUCCESS;
ret = (size_t) bytes_read;
return ret;
}

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

@ -27,13 +27,15 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh )
size_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
{
/*int *fp = NULL;*/
int i, block = 1;
struct iovec *iov = NULL;
int iov_count = 0;
OMPI_MPI_OFFSET_TYPE iov_offset = 0;
size_t ret=0;
ssize_t ret_code=0, bytes_written=0;
if (NULL == fh->f_io_array) {
return OMPI_ERROR;
@ -92,18 +94,23 @@ size_t mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh )
perror ("lseek");
return OMPI_ERROR;
}
if (-1 == writev (fh->fd, iov, iov_count)) {
ret_code = writev (fh->fd, iov, iov_count);
if ( 0 < ret_code ) {
bytes_written += ret_code;
}
else if (-1 == ret_code ) {
perror ("writev");
return OMPI_ERROR;
goto exit;
}
iov_count = 0;
}
exit:
if (NULL != iov) {
free (iov);
iov = NULL;
}
return OMPI_SUCCESS;
ret = (size_t) bytes_written;
return ret;
}

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

@ -617,7 +617,7 @@
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
if ( 0 > fh->f_fbtl->fbtl_preadv (fh)) {
opal_output (1, "READ FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -926,7 +926,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
if ( 0 > fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output (1, "WRITE FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -687,7 +687,7 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
if ( 0 > fh->f_fbtl->fbtl_preadv (fh)) {
opal_output (1, "READ FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -849,7 +849,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
if ( 0 > fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output (1, "WRITE FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -706,7 +706,7 @@ static int two_phase_read_and_exch(mca_io_ompio_file_t *fh,
fh->f_num_of_io_entries = 1;
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
if ( 0 > fh->f_fbtl->fbtl_preadv (fh)) {
opal_output(1, "READ FAILED\n");
return OMPI_ERROR;
}

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

@ -809,7 +809,7 @@ static int two_phase_exch_and_write(mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
if ( 0 > fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output(1, "WRITE FAILED\n");
return OMPI_ERROR;
}
@ -1050,7 +1050,7 @@ static int two_phase_exchage_data(mca_io_ompio_file_t *fh,
fh->f_io_array[0].length = size;
fh->f_io_array[0].memory_address = write_buf;
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
if ( 0 > fh->f_fbtl->fbtl_preadv (fh)) {
opal_output(1, "READ FAILED\n");
return OMPI_ERROR;
}

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

@ -80,7 +80,7 @@ int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh,
uint32_t iov_count = 0;
struct iovec *decoded_iov = NULL;
size_t max_data = 0;
size_t max_data=0, ret_code=0, real_bytes_read=0;
int i = 0; /* index into the decoded iovec of the buffer */
int j = 0; /* index into the file vie iovec */
@ -128,7 +128,10 @@ int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh,
&total_bytes_read);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_preadv (fh);
ret_code = fh->f_fbtl->fbtl_preadv (fh);
if ( 0<= ret_code ) {
real_bytes_read+=ret_code;
}
}
fh->f_num_of_io_entries = 0;
@ -144,7 +147,7 @@ int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh,
}
if ( MPI_STATUS_IGNORE != status ) {
status->_ucount = max_data;
status->_ucount = real_bytes_read;
}
return ret;

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

@ -83,7 +83,7 @@ int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh,
struct iovec *decoded_iov = NULL;
size_t bytes_per_cycle=0;
size_t total_bytes_written = 0;
size_t max_data = 0;
size_t max_data=0, ret_code=0, real_bytes_written=0;
int i = 0; /* index into the decoded iovec of the buffer */
int j = 0; /* index into the file view iovec */
@ -123,7 +123,10 @@ int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh,
&total_bytes_written);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_pwritev (fh);
ret_code =fh->f_fbtl->fbtl_pwritev (fh);
if ( 0<= ret_code ) {
real_bytes_written+=ret_code;
}
}
fh->f_num_of_io_entries = 0;
@ -139,7 +142,7 @@ int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh,
}
if ( MPI_STATUS_IGNORE != status ) {
status->_ucount = max_data;
status->_ucount = real_bytes_written;
}
return ret;