1
1

make arbitrary sequences of explicit and implicit offset operations work properly.

This commit was SVN r32537.
Этот коммит содержится в:
Edgar Gabriel 2014-08-15 01:49:43 +00:00
родитель 9373d6420e
Коммит d773dc8aa5
3 изменённых файлов: 57 добавлений и 5 удалений

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

@ -634,15 +634,26 @@ mca_io_ompio_file_seek (ompi_file_t *fh,
}
int
mca_io_ompio_file_get_position (ompi_file_t *fh,
mca_io_ompio_file_get_position (ompi_file_t *fd,
OMPI_MPI_OFFSET_TYPE *offset)
{
mca_io_ompio_data_t *data;
mca_io_ompio_data_t *data=NULL;
mca_io_ompio_file_t *fh=NULL;
OMPI_MPI_OFFSET_TYPE off;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
data = (mca_io_ompio_data_t *) fd->f_io_selected_data;
fh = &data->ompio_fh;
*offset = data->ompio_fh.f_position_in_file_view / data->ompio_fh.f_etype_size;
/* No of copies of the entire file view */
off = (fh->f_offset - fh->f_disp)/fh->f_view_extent;
/* No of elements per view */
off *= (fh->f_view_size / fh->f_etype_size);
/* No of bytes used in the current copy of the view */
off += fh->f_total_bytes / fh->f_etype_size;
*offset = off;
return OMPI_SUCCESS;
}

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

@ -172,6 +172,9 @@ int ompio_io_ompio_file_read_at (mca_io_ompio_file_t *fh,
ompi_status_public_t * status)
{
int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_read (fh,
@ -179,6 +182,12 @@ int ompio_io_ompio_file_read_at (mca_io_ompio_file_t *fh,
count,
datatype,
status);
// An explicit offset file operation is not suppsed to modify
// the internal file pointer. So reset the pointer
// to the previous value
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret;
}
@ -298,6 +307,9 @@ int ompio_io_ompio_file_iread_at (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_iread (fh,
@ -305,6 +317,17 @@ int ompio_io_ompio_file_iread_at (mca_io_ompio_file_t *fh,
count,
datatype,
request);
/* An explicit offset file operation is not suppsed to modify
** the internal file pointer. So reset the pointer
** to the previous value
** It is OK to reset the position already here, althgouth
** the operation might still be pending/ongoing, since
** the entire array of <offset, length, memaddress> have
** already been constructed in the file_iread operation
*/
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret;
}

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

@ -168,6 +168,8 @@ int ompio_io_ompio_file_write_at (mca_io_ompio_file_t *fh,
ompi_status_public_t *status)
{
int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_write (fh,
@ -175,7 +177,10 @@ int ompio_io_ompio_file_write_at (mca_io_ompio_file_t *fh,
count,
datatype,
status);
// An explicit offset file operation is not suppsed to modify
// the internal file pointer. So reset the pointer
// to the previous value
ompi_io_ompio_set_explicit_offset (fh, prev_offset );
return ret;
}
@ -291,6 +296,8 @@ int ompio_io_ompio_file_iwrite_at (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_iwrite (fh,
@ -298,6 +305,17 @@ int ompio_io_ompio_file_iwrite_at (mca_io_ompio_file_t *fh,
count,
datatype,
request);
/* An explicit offset file operation is not suppsed to modify
** the internal file pointer. So reset the pointer
** to the previous value
** It is OK to reset the position already here, althgouth
** the operation might still be pending/ongoing, since
** the entire array of <offset, length, memaddress> have
** already been constructed in the file_iwrite operation
*/
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret;
}