From 3d1780f1a267709c64de00454d4cefde1d21d6ae Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 5 Aug 2015 15:07:21 +0900 Subject: [PATCH 1/3] sharedfp: set f_fh when opening a shared file --- ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index ce2158145be..6c444836913 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013 University of Houston. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -53,6 +55,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_lockedfile_file_open: Error during file open\n"); return err; } + shfileHandle->f_fh = fh->f_fh; /*Memory is allocated here for the sh structure*/ sh = (struct mca_sharedfp_base_data_t*)malloc(sizeof(struct mca_sharedfp_base_data_t)); From 02a4eb2f13866f03b0bfb23ff66a91932f6bae4c Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 5 Aug 2015 14:28:27 -0500 Subject: [PATCH 2/3] add the ompi_file_t pointer correctly on the ompio file handle for the sm and individual component. --- ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c | 1 + ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 1 + 2 files changed, 2 insertions(+) diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c index 886985adf01..4dd8a539479 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c @@ -54,6 +54,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_individual_file_open: Error during file open\n"); return err; } + shfileHandle->f_fh = fh->f_fh; sh = (struct mca_sharedfp_base_data_t*) malloc ( sizeof(struct mca_sharedfp_base_data_t)); if ( NULL == sh ){ diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 1d609532aba..7cd3fdd5af7 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -69,6 +69,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_sm_file_open: Error during file open\n"); return err; } + shfileHandle->f_fh = fh->f_fh; /*Memory is allocated here for the sh structure*/ if ( mca_sharedfp_sm_verbose ) { From 16d4171f6be0c401907f3270bc22ab4d5d006a13 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 5 Aug 2015 14:31:11 -0500 Subject: [PATCH 3/3] the individual component should call internal ompio functions directly. The reason is that otherwise the redirection to the ompi_file_t structure (and back to the ompio internal structure) is ambiguise and wrong for the shared file pointer scenario. --- ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c | 5 ++--- ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c b/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c index 225ad781553..bde6f9a92df 100644 --- a/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c +++ b/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2015 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,6 +38,5 @@ mca_fcoll_individual_file_read_all (mca_io_ompio_file_t *fh, struct ompi_datatype_t *datatype, ompi_status_public_t *status) { - return fh->f_fh->f_io_selected_module.v2_0_0. - io_module_file_read( fh->f_fh, buf, count, datatype, status); + return ompio_io_ompio_file_read( fh, buf, count, datatype, status); } diff --git a/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c b/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c index 43147cf03d0..1423ac0e1af 100644 --- a/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c +++ b/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2015 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,6 +35,5 @@ int mca_fcoll_individual_file_write_all (mca_io_ompio_file_t *fh, struct ompi_datatype_t *datatype, ompi_status_public_t *status) { - return fh->f_fh->f_io_selected_module.v2_0_0. - io_module_file_write (fh->f_fh, buf, count, datatype, status); + return ompio_io_ompio_file_write (fh, buf, count, datatype, status); }