1
1

- extend the explicit offset patch to collective explicit offset operations as

well
- minor restructuring to support the shared file pointer operations correctly
  for explicit offsets

This commit was SVN r32538.
Этот коммит содержится в:
Edgar Gabriel 2014-08-15 14:03:29 +00:00
родитель d773dc8aa5
Коммит fabad95b8e
4 изменённых файлов: 55 добавлений и 17 удалений

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

@ -328,6 +328,10 @@ OMPI_DECLSPEC int ompio_io_ompio_file_read_at_all_end (mca_io_ompio_file_t *ompi
ompi_status_public_t * status); ompi_status_public_t * status);
OMPI_DECLSPEC int ompio_io_ompio_file_get_size (mca_io_ompio_file_t *fh, OMPI_DECLSPEC int ompio_io_ompio_file_get_size (mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *size); OMPI_MPI_OFFSET_TYPE *size);
OMPI_DECLSPEC int ompio_io_ompio_file_get_position (mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *offset);
/* /*
* Function that takes in a datatype and buffer, and decodes that datatype * Function that takes in a datatype and buffer, and decodes that datatype
* into an iovec using the convertor_raw function * into an iovec using the convertor_raw function

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

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

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

@ -174,7 +174,7 @@ int ompio_io_ompio_file_read_at (mca_io_ompio_file_t *fh,
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset; OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset ); ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_read (fh, ret = ompio_io_ompio_file_read (fh,
@ -308,8 +308,7 @@ int ompio_io_ompio_file_iread_at (mca_io_ompio_file_t *fh,
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset; OMPI_MPI_OFFSET_TYPE prev_offset;
ompio_io_ompio_file_get_position (fh, &prev_offset );
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_iread (fh, ret = ompio_io_ompio_file_iread (fh,
@ -386,6 +385,8 @@ int ompio_io_ompio_file_read_at_all (mca_io_ompio_file_t *fh,
ompi_status_public_t * status) ompi_status_public_t * status)
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = fh->f_fcoll->fcoll_file_read_all (fh, ret = fh->f_fcoll->fcoll_file_read_all (fh,
@ -393,6 +394,8 @@ int ompio_io_ompio_file_read_at_all (mca_io_ompio_file_t *fh,
count, count,
datatype, datatype,
status); status);
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret; return ret;
} }
@ -556,20 +559,28 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
return ret; return ret;
} }
int ompio_io_ompio_file_read_at_all_begin (mca_io_ompio_file_t *ompio_fh, int ompio_io_ompio_file_read_at_all_begin (mca_io_ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE offset, OMPI_MPI_OFFSET_TYPE offset,
void *buf, void *buf,
int count, int count,
struct ompi_datatype_t *datatype) struct ompi_datatype_t *datatype)
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (ompio_fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_fh->f_fcoll->fcoll_file_read_all_begin (ompio_fh, ret = fh->f_fcoll->fcoll_file_read_all_begin (fh,
buf, buf,
count, count,
datatype); datatype);
/* 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_read_all_begin operation
*/
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret; return ret;
} }

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

@ -169,7 +169,7 @@ int ompio_io_ompio_file_write_at (mca_io_ompio_file_t *fh,
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset; OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset ); ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_write (fh, ret = ompio_io_ompio_file_write (fh,
@ -297,7 +297,7 @@ int ompio_io_ompio_file_iwrite_at (mca_io_ompio_file_t *fh,
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset; OMPI_MPI_OFFSET_TYPE prev_offset;
mca_io_ompio_file_get_position (fh->f_fh, &prev_offset ); ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = ompio_io_ompio_file_iwrite (fh, ret = ompio_io_ompio_file_iwrite (fh,
@ -498,6 +498,8 @@ int ompio_io_ompio_file_write_at_all (mca_io_ompio_file_t *fh,
ompi_status_public_t *status) ompi_status_public_t *status)
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = fh->f_fcoll->fcoll_file_write_all (fh, ret = fh->f_fcoll->fcoll_file_write_all (fh,
@ -505,6 +507,8 @@ int ompio_io_ompio_file_write_at_all (mca_io_ompio_file_t *fh,
count, count,
datatype, datatype,
status); status);
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret; return ret;
} }
@ -640,6 +644,8 @@ int ompio_io_ompio_file_write_at_all_begin (mca_io_ompio_file_t *fh,
struct ompi_datatype_t *datatype) struct ompi_datatype_t *datatype)
{ {
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
OMPI_MPI_OFFSET_TYPE prev_offset;
ompio_io_ompio_file_get_position (fh, &prev_offset );
ompi_io_ompio_set_explicit_offset (fh, offset); ompi_io_ompio_set_explicit_offset (fh, offset);
ret = fh->f_fcoll->fcoll_file_write_all_begin (fh, ret = fh->f_fcoll->fcoll_file_write_all_begin (fh,
@ -647,6 +653,12 @@ int ompio_io_ompio_file_write_at_all_begin (mca_io_ompio_file_t *fh,
count, count,
datatype); datatype);
/* 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_write_all_begin operation
*/
ompi_io_ompio_set_explicit_offset (fh, prev_offset);
return ret; return ret;
} }