From 7e370948c1a60f9a24521f5103d785f7e1ae0841 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 19 Aug 2015 16:37:35 -0500 Subject: [PATCH 1/5] first cut on the fileview for shared filepointers fix. --- ompi/mca/io/ompio/io_ompio.c | 18 +- ompi/mca/io/ompio/io_ompio_file_set_view.c | 226 ++++++++++--------- ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 12 +- 3 files changed, 135 insertions(+), 121 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index e994b9ff4a..da0d050859 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -106,7 +106,7 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh) { if (NULL != fh) { - ompi_datatype_t *types[2], *default_file_view; + ompi_datatype_t *types[2]; int blocklen[2] = {1, 1}; OPAL_PTRDIFF_TYPE d[2], base; int i; @@ -132,27 +132,21 @@ int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh) fh->f_init_num_aggrs = -1; fh->f_init_aggr_list = NULL; - ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE, - &ompi_mpi_byte.dt, - &default_file_view); - ompi_datatype_commit (&default_file_view); - - fh->f_etype = &ompi_mpi_byte.dt; - fh->f_filetype = default_file_view; - ompi_datatype_duplicate ( &ompi_mpi_byte.dt, &fh->f_orig_filetype ); - /* Default file View */ fh->f_iov_type = MPI_DATATYPE_NULL; fh->f_stripe_size = mca_io_ompio_bytes_per_agg; /*Decoded iovec of the file-view*/ fh->f_decoded_iov = NULL; + fh->f_etype = NULL; + fh->f_filetype = NULL; + fh->f_orig_filetype = NULL; mca_io_ompio_set_view_internal(fh, 0, &ompi_mpi_byte.dt, - default_file_view, - "native", + &ompi_mpi_byte.dt, + "native", fh->f_info); diff --git a/ompi/mca/io/ompio/io_ompio_file_set_view.c b/ompi/mca/io/ompio/io_ompio_file_set_view.c index 9d95dc5a67..efb289d5c2 100644 --- a/ompi/mca/io/ompio/io_ompio_file_set_view.c +++ b/ompi/mca/io/ompio/io_ompio_file_set_view.c @@ -28,6 +28,7 @@ #include "ompi/mca/fs/base/base.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/pml/pml.h" #include "opal/datatype/opal_convertor.h" #include "ompi/datatype/ompi_datatype.h" @@ -53,98 +54,19 @@ int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh, int num_groups = 0; contg *contg_groups; - - - MPI_Aint lb,ub; - - fh->f_iov_count = 0; - fh->f_disp = disp; - fh->f_offset = disp; - fh->f_total_bytes = 0; - - ompi_io_ompio_decode_datatype (fh, - filetype, - 1, - NULL, - &max_data, - &fh->f_decoded_iov, - &fh->f_iov_count); - - opal_datatype_get_extent(&filetype->super, &lb, &fh->f_view_extent); - opal_datatype_type_ub (&filetype->super, &ub); - opal_datatype_type_size (&etype->super, &fh->f_etype_size); - opal_datatype_type_size (&filetype->super, &fh->f_view_size); - ompi_datatype_duplicate (etype, &fh->f_etype); - ompi_datatype_duplicate (filetype, &fh->f_filetype); - - fh->f_cc_size = get_contiguous_chunk_size (fh); - - if (opal_datatype_is_contiguous_memory_layout(&etype->super,1)) { - if (opal_datatype_is_contiguous_memory_layout(&filetype->super,1) && - fh->f_view_extent == (OPAL_PTRDIFF_TYPE)fh->f_view_size ) { - fh->f_flags |= OMPIO_CONTIGUOUS_FVIEW; - } - } - - - contg_groups = (contg*) calloc ( 1, fh->f_size * sizeof(contg)); - if (NULL == contg_groups) { - opal_output (1, "OUT OF MEMORY\n"); - return OMPI_ERR_OUT_OF_RESOURCE; - } - for( i = 0; i < fh->f_size; i++){ - contg_groups[i].procs_in_contg_group = (int*)calloc (1,fh->f_size * sizeof(int)); - if(NULL == contg_groups[i].procs_in_contg_group){ - int j; - opal_output (1, "OUT OF MEMORY\n"); - for(j=0; jf_comm->c_flags & OMPI_COMM_CART) && - (num_groups == 1 || num_groups == fh->f_size)) ) { - mca_io_ompio_finalize_initial_grouping(fh, - num_groups, - contg_groups); - } - for( i = 0; i < fh->f_size; i++){ - free(contg_groups[i].procs_in_contg_group); - } - free(contg_groups); - - - return OMPI_SUCCESS; -} - -int mca_io_ompio_file_set_view (ompi_file_t *fp, - OMPI_MPI_OFFSET_TYPE disp, - ompi_datatype_t *etype, - ompi_datatype_t *filetype, - char *datarep, - ompi_info_t *info) -{ - mca_io_ompio_data_t *data; - mca_io_ompio_file_t *fh; size_t ftype_size; - OPAL_PTRDIFF_TYPE ftype_extent, lb; - - data = (mca_io_ompio_data_t *) fp->f_io_selected_data; - fh = &data->ompio_fh; - - ompi_datatype_destroy (&fh->f_etype); - ompi_datatype_destroy (&fh->f_filetype); - ompi_datatype_destroy (&fh->f_orig_filetype); + OPAL_PTRDIFF_TYPE ftype_extent, lb, ub; + ompi_datatype_t *newfiletype; + if ( NULL != fh->f_etype ) { + ompi_datatype_destroy (&fh->f_etype); + } + if ( NULL != fh->f_filetype ) { + ompi_datatype_destroy (&fh->f_filetype); + } + if ( NULL != fh->f_orig_filetype ) { + ompi_datatype_destroy (&fh->f_orig_filetype); + } if (NULL != fh->f_decoded_iov) { free (fh->f_decoded_iov); fh->f_decoded_iov = NULL; @@ -165,33 +87,93 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp, opal_datatype_get_extent(&filetype->super, &lb, &ftype_extent); opal_datatype_type_size (&filetype->super, &ftype_size); - if ( etype == filetype && - ompi_datatype_is_predefined (filetype ) && + if ( etype == filetype && + ompi_datatype_is_predefined (filetype ) && ftype_extent == (OPAL_PTRDIFF_TYPE)ftype_size ){ - ompi_datatype_t *newfiletype; ompi_datatype_create_contiguous(MCA_IO_DEFAULT_FILE_VIEW_SIZE, &ompi_mpi_byte.dt, &newfiletype); ompi_datatype_commit (&newfiletype); - mca_io_ompio_set_view_internal (fh, - disp, - etype, - newfiletype, - datarep, - info); - ompi_datatype_destroy ( &newfiletype ); } else { - mca_io_ompio_set_view_internal (fh, - disp, - etype, - filetype, - datarep, - info); + newfiletype = filetype; + } + + + + fh->f_iov_count = 0; + fh->f_disp = disp; + fh->f_offset = disp; + fh->f_total_bytes = 0; + + ompi_io_ompio_decode_datatype (fh, + newfiletype, + 1, + NULL, + &max_data, + &fh->f_decoded_iov, + &fh->f_iov_count); + + opal_datatype_get_extent(&newfiletype->super, &lb, &fh->f_view_extent); + opal_datatype_type_ub (&newfiletype->super, &ub); + opal_datatype_type_size (&etype->super, &fh->f_etype_size); + opal_datatype_type_size (&newfiletype->super, &fh->f_view_size); + ompi_datatype_duplicate (etype, &fh->f_etype); + ompi_datatype_duplicate (newfiletype, &fh->f_filetype); + + fh->f_cc_size = get_contiguous_chunk_size (fh); + + if (opal_datatype_is_contiguous_memory_layout(&etype->super,1)) { + if (opal_datatype_is_contiguous_memory_layout(&filetype->super,1) && + fh->f_view_extent == (OPAL_PTRDIFF_TYPE)fh->f_view_size ) { + fh->f_flags |= OMPIO_CONTIGUOUS_FVIEW; + } } - if (OMPI_SUCCESS != mca_fcoll_base_file_select (&data->ompio_fh, - NULL)) { + contg_groups = (contg*) calloc ( 1, fh->f_size * sizeof(contg)); + if (NULL == contg_groups) { + opal_output (1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + for( i = 0; i < fh->f_size; i++){ + contg_groups[i].procs_in_contg_group = (int*)calloc (1,fh->f_size * sizeof(int)); + if(NULL == contg_groups[i].procs_in_contg_group){ + int j; + opal_output (1, "OUT OF MEMORY\n"); + for(j=0; jf_comm->c_flags & OMPI_COMM_CART) && + (num_groups == 1 || num_groups == fh->f_size)) ) { + mca_io_ompio_finalize_initial_grouping(fh, + num_groups, + contg_groups); + } + for( i = 0; i < fh->f_size; i++){ + free(contg_groups[i].procs_in_contg_group); + } + free(contg_groups); + + if ( etype == filetype && + ompi_datatype_is_predefined (filetype ) && + ftype_extent == (OPAL_PTRDIFF_TYPE)ftype_size ){ + ompi_datatype_destroy ( &newfiletype ); + } + + + if (OMPI_SUCCESS != mca_fcoll_base_file_select (fh, NULL)) { opal_output(1, "mca_fcoll_base_file_select() failed\n"); return OMPI_ERROR; } @@ -199,6 +181,34 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp, return OMPI_SUCCESS; } +int mca_io_ompio_file_set_view (ompi_file_t *fp, + OMPI_MPI_OFFSET_TYPE disp, + ompi_datatype_t *etype, + ompi_datatype_t *filetype, + char *datarep, + ompi_info_t *info) +{ + int ret=OMPI_SUCCESS; + mca_io_ompio_data_t *data; + mca_io_ompio_file_t *fh; + mca_io_ompio_file_t *sh; + + data = (mca_io_ompio_data_t *) fp->f_io_selected_data; + + /* we need to call the internal file set view twice: once for the individual + file pointer, once for the shared file pointer (if it is existent) + */ + fh = &data->ompio_fh; + ret = mca_io_ompio_set_view_internal(fh, disp, etype, filetype, datarep, info); + + if ( NULL != fh->f_sharedfp_data) { + sh = ((struct mca_sharedfp_base_data_t *)fh->f_sharedfp_data)->sharedfh; + ret = mca_io_ompio_set_view_internal(sh, disp, etype, filetype, datarep, info); + } + + return ret; +} + int mca_io_ompio_file_get_view (struct ompi_file_t *fp, OMPI_MPI_OFFSET_TYPE *disp, struct ompi_datatype_t **etype, diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 46ede8d6f2..a691f9ecca 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -52,11 +52,12 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, int err = OMPI_SUCCESS; struct mca_sharedfp_base_data_t* sh; struct mca_sharedfp_sm_data * sm_data = NULL; - mca_io_ompio_file_t * shfileHandle; + mca_io_ompio_file_t * shfileHandle, *ompio_fh; char * filename_basename; char * sm_filename; struct mca_sharedfp_sm_offset * sm_offset_ptr; struct mca_sharedfp_sm_offset sm_offset; + mca_io_ompio_data_t *data; int sm_fd; int rank; @@ -75,6 +76,15 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, return err; } shfileHandle->f_fh = fh->f_fh; + data = (mca_io_ompio_data_t *) fh->f_fh->f_io_selected_data; + ompio_fh = &data->ompio_fh; + + err = mca_io_ompio_set_view_internal (shfileHandle, + ompio_fh->f_disp, + ompio_fh->f_etype, + ompio_fh->f_orig_filetype, + ompio_fh->f_datarep, + MPI_INFO_NULL); /*Memory is allocated here for the sh structure*/ if ( mca_sharedfp_sm_verbose ) { From 096fe78d73287bf1631c87422ce2c8b273d7b516 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 19 Aug 2015 17:09:18 -0500 Subject: [PATCH 2/5] the offset provided to the read_at/write_at routines has to be a multiple of the etype. --- ompi/mca/sharedfp/sm/sharedfp_sm_iread.c | 3 +++ ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c | 7 +++++-- ompi/mca/sharedfp/sm/sharedfp_sm_read.c | 3 +++ ompi/mca/sharedfp/sm/sharedfp_sm_write.c | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c b/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c index 7a82f5839f..439b409c1d 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c @@ -70,6 +70,7 @@ int mca_sharedfp_sm_iread(mca_io_ompio_file_t *fh, } /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; if ( -1 != ret ) { if ( mca_sharedfp_sm_verbose ) { @@ -193,6 +194,8 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; + if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, "mca_sharedfp_sm_read_ordered_begin: Offset returned is %lld\n",offset); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c b/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c index f8e2af33af..fbf9a40ce0 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c @@ -70,8 +70,9 @@ int mca_sharedfp_sm_iwrite(mca_io_ompio_file_t *fh, } /* Request the offset to write bytesRequested bytes */ ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset); - - if ( -1 != ret ) { + offset /= sh->sharedfh->f_etype_size; + + if ( -1 != ret ) { if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, "sharedfp_sm_iwrite: Offset received is %lld\n",offset); @@ -194,6 +195,8 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; + if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, "mca_sharedfp_sm_write_ordered_begin: Offset returned is %lld\n",offset); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_read.c b/ompi/mca/sharedfp/sm/sharedfp_sm_read.c index d49ffae425..8f2cd77426 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_read.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_read.c @@ -68,6 +68,7 @@ int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; if ( -1 != ret ) { if ( mca_sharedfp_sm_verbose ) { @@ -186,6 +187,8 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; + if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, "mca_sharedfp_sm_read_ordered: Offset returned is %lld\n",offset); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_write.c b/ompi/mca/sharedfp/sm/sharedfp_sm_write.c index 1cf015b5e0..d547138f9a 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_write.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_write.c @@ -71,6 +71,7 @@ int mca_sharedfp_sm_write (mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; if ( -1 != ret ) { if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, @@ -192,6 +193,7 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh, /* Each process now has its own individual offset */ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_sm_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, From b0461f8d3cc20ac4ec31e000e6098cb9bea0901b Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 19 Aug 2015 17:09:47 -0500 Subject: [PATCH 3/5] the back pointer from the ompio_file structure to the ompi_file_t structure has to be set earlier in case the user disables the lazy_open option. --- ompi/mca/io/ompio/io_ompio_file_open.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index f4c34851a1..680ad5f4b1 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -54,13 +54,13 @@ mca_io_ompio_file_open (ompi_communicator_t *comm, } + /*save pointer back to the file_t structure */ + data->ompio_fh.f_fh = fh; ret = ompio_io_ompio_file_open(comm,filename,amode,info,&data->ompio_fh,use_sharedfp); if ( OMPI_SUCCESS == ret ) { fh->f_flags |= OMPIO_FILE_IS_OPEN; - /*save pointer back to the file_t structure */ - data->ompio_fh.f_fh = fh; } From 8b84da5e3527a4029a4248cf77e03c2ccb86458f Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 20 Aug 2015 09:26:30 -0500 Subject: [PATCH 4/5] bring the lockedfile component up to date with the fileview changes. --- .../lockedfile/sharedfp_lockedfile_file_open.c | 13 ++++++++++++- .../sharedfp/lockedfile/sharedfp_lockedfile_iread.c | 3 +++ .../lockedfile/sharedfp_lockedfile_iwrite.c | 3 +++ .../sharedfp/lockedfile/sharedfp_lockedfile_read.c | 3 +++ .../sharedfp/lockedfile/sharedfp_lockedfile_write.c | 3 +++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index 5fba520c2e..c1cb4a9be3 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -44,7 +44,8 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, int handle, rank; struct mca_sharedfp_lockedfile_data * module_data = NULL; struct mca_sharedfp_base_data_t* sh; - mca_io_ompio_file_t * shfileHandle; + mca_io_ompio_file_t * shfileHandle, *ompio_fh; + mca_io_ompio_data_t *data; /*------------------------------------------------------------*/ /*Open the same file again without shared file pointer support*/ @@ -56,6 +57,16 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, return err; } shfileHandle->f_fh = fh->f_fh; + data = (mca_io_ompio_data_t *) fh->f_fh->f_io_selected_data; + ompio_fh = &data->ompio_fh; + + err = mca_io_ompio_set_view_internal (shfileHandle, + ompio_fh->f_disp, + ompio_fh->f_etype, + ompio_fh->f_orig_filetype, + ompio_fh->f_datarep, + MPI_INFO_NULL); + /*Memory is allocated here for the sh structure*/ sh = (struct mca_sharedfp_base_data_t*)malloc(sizeof(struct mca_sharedfp_base_data_t)); diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c index 23d31e60e1..96e7ec8633 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c @@ -73,6 +73,8 @@ int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if ( -1 != ret ) { if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, @@ -196,6 +198,7 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c index bb8490da1c..e5795f84d5 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c @@ -71,6 +71,8 @@ int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if ( -1 != ret) { if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, @@ -193,6 +195,7 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c index 064b40dc4c..cd7df48e57 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c @@ -68,6 +68,8 @@ int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if (-1 != ret ) { if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, @@ -182,6 +184,7 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c index 1a88a22f74..4365e27ace 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c @@ -70,6 +70,8 @@ int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh, /* Request the offset to write bytesRequested bytes */ ret = mca_sharedfp_lockedfile_request_position ( sh, bytesRequested, &offset); + offset /= sh->sharedfh->f_etype_size; + if (-1 != ret ) { if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, @@ -187,6 +189,7 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh, /*Each process now has its own individual offset*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_lockedfile_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, From 4be20b119f7b4622a6470658d380ea5b37cb2688 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 20 Aug 2015 09:30:58 -0500 Subject: [PATCH 5/5] bring the addproc component up to date with the fileview changes --- .../sharedfp/addproc/sharedfp_addproc_file_open.c | 14 +++++++++++++- ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c | 3 +++ .../mca/sharedfp/addproc/sharedfp_addproc_iwrite.c | 3 +++ ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c | 3 +++ ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c | 2 ++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c index d7ecf4c248..f66a170436 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c @@ -40,9 +40,11 @@ int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, int ret = OMPI_SUCCESS, err; int rank; struct mca_sharedfp_base_data_t* sh; - mca_io_ompio_file_t * shfileHandle; + mca_io_ompio_file_t * shfileHandle, *ompio_fh; MPI_Comm newInterComm; struct mca_sharedfp_addproc_data * addproc_data = NULL; + mca_io_ompio_data_t *data; + /*-------------------------------------------------*/ /*Open the same file again without shared file pointer*/ @@ -53,6 +55,16 @@ int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_addproc_file_open: Error during file open\n"); return ret; } + shfileHandle->f_fh = fh->f_fh; + data = (mca_io_ompio_data_t *) fh->f_fh->f_io_selected_data; + ompio_fh = &data->ompio_fh; + + err = mca_io_ompio_set_view_internal (shfileHandle, + ompio_fh->f_disp, + ompio_fh->f_etype, + ompio_fh->f_orig_filetype, + ompio_fh->f_datarep, + MPI_INFO_NULL); /*Memory is allocated here for the sh structure*/ if ( mca_sharedfp_addproc_verbose ) { diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c index 9b56b6d538..961733b661 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c @@ -58,6 +58,8 @@ int mca_sharedfp_addproc_iread(mca_io_ompio_file_t *fh, /*Request to the additional process for the offset*/ ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if( OMPI_SUCCESS == ret ){ if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, @@ -170,6 +172,7 @@ int mca_sharedfp_addproc_read_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c index 7539c94e08..2fa89ab421 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c @@ -56,6 +56,8 @@ int mca_sharedfp_addproc_iwrite(mca_io_ompio_file_t *fh, } /* Request the offset to write bytesRequested bytes */ ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if ( OMPI_SUCCESS == ret ) { if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, @@ -166,6 +168,7 @@ int mca_sharedfp_addproc_write_ordered_begin(mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c index c20c449a4b..37d78f01f8 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c @@ -54,6 +54,8 @@ int mca_sharedfp_addproc_read ( mca_io_ompio_file_t *fh, /*Request to the additional process for the offset*/ ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset); + offset /= sh->sharedfh->f_etype_size; + if( OMPI_SUCCESS == ret ){ if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, @@ -162,6 +164,7 @@ int mca_sharedfp_addproc_read_ordered (mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c index 02a9fa4589..df230daf49 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c @@ -58,6 +58,7 @@ int mca_sharedfp_addproc_write (mca_io_ompio_file_t *fh, /*Request the offset to write bytesRequested bytes*/ ret = mca_sharedfp_addproc_request_position( sh, bytesRequested, &offset); + offset /= sh->sharedfh->f_etype_size; if ( OMPI_SUCCESS == ret ) { if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output, @@ -163,6 +164,7 @@ int mca_sharedfp_addproc_write_ordered (mca_io_ompio_file_t *fh, /*Each process now has its own individual offset in recvBUFF*/ offset = offsetBuff - sendBuff; + offset /= sh->sharedfh->f_etype_size; if ( mca_sharedfp_addproc_verbose ){ opal_output(ompi_sharedfp_base_framework.framework_output,