From af67c8f2390ad71dc55a85a0221b62dfe406f292 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 19 Jul 2016 06:28:15 -0500 Subject: [PATCH 1/6] first cut on moving some ompio functionality to common/ompio --- ompi/mca/common/ompio/Makefile.am | 82 +++++ .../common/ompio/common_ompio_print_queue.c | 293 ++++++++++++++++++ .../common/ompio/common_ompio_print_queue.h | 79 +++++ ompi/mca/io/ompio/io_ompio.h | 4 +- 4 files changed, 456 insertions(+), 2 deletions(-) create mode 100644 ompi/mca/common/ompio/Makefile.am create mode 100644 ompi/mca/common/ompio/common_ompio_print_queue.c create mode 100644 ompi/mca/common/ompio/common_ompio_print_queue.h diff --git a/ompi/mca/common/ompio/Makefile.am b/ompi/mca/common/ompio/Makefile.am new file mode 100644 index 0000000000..c491e00e74 --- /dev/null +++ b/ompi/mca/common/ompio/Makefile.am @@ -0,0 +1,82 @@ +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2007 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2008-2016 University of Houston. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = \ + common_ompio_print_queue.h + +sources = \ + common_ompio_print_queue.c + + +# To simplify components that link to this library, we will *always* +# have an output libtool library named libmca__.la -- even +# for case 2) described above (i.e., so there's no conditional logic +# necessary in component Makefile.am's that link to this library). +# Hence, if we're creating a noinst version of this library (i.e., +# case 2), we sym link it to the libmca__.la name +# (libtool will do the Right Things under the covers). See the +# all-local and clean-local rules, below, for how this is effected. + +lib_LTLIBRARIES = +noinst_LTLIBRARIES = +comp_inst = lib@OPAL_LIB_PREFIX@mca_common_ompio.la +comp_noinst = lib@OPAL_LIB_PREFIX@mca_common_ompio_noinst.la + +if MCA_BUILD_ompi_common_ompio_DSO +lib_LTLIBRARIES += $(comp_inst) +else +noinst_LTLIBRARIES += $(comp_noinst) +endif + +lib@OPAL_LIB_PREFIX@mca_common_ompio_la_SOURCES = $(headers) $(sources) +lib@OPAL_LIB_PREFIX@mca_common_ompio_la_CPPFLAGS = $(common_ompio_CPPFLAGS) +lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LDFLAGS = \ + -version-info $(libmca_opal_common_ompio_so_version) \ + $(common_ompio_LDFLAGS) +lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LIBADD = $(common_ompio_LIBS) +lib@OPAL_LIB_PREFIX@mca_common_ompio_noinst_la_SOURCES = $(headers) $(sources) + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +ompidir = $(ompiincludedir)/ompi/mca/common/ompio +ompi_HEADERS = $(headers) +else +ompidir = $(includedir) +endif + +# These two rules will sym link the "noinst" libtool library filename +# to the installable libtool library filename in the case where we are +# compiling this component statically (case 2), described above). +V=0 +OMPI_V_LN_SCOMP = $(ompi__v_LN_SCOMP_$V) +ompi__v_LN_SCOMP_ = $(ompi__v_LN_SCOMP_$AM_DEFAULT_VERBOSITY) +ompi__v_LN_SCOMP_0 = @echo " LN_S " `basename $(comp_inst)`; + +all-local: + $(OMPI_V_LN_SCOMP) if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + $(LN_S) "$(comp_noinst)" "$(comp_inst)"; \ + fi + +clean-local: + if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + fi diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.c b/ompi/mca/common/ompio/common_ompio_print_queue.c new file mode 100644 index 0000000000..30ba98ed42 --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio_print_queue.c @@ -0,0 +1,293 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2013 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/datatype/ompi_datatype.h" + +#include "common_ompio_print_queue.h" + +mca_common_ompio_print_queue *coll_write_time=NULL; +mca_common_ompio_print_queue *coll_read_time=NULL; + +/* Print queue related function implementations */ +int common_ompio_set_print_queue (mca_common_ompio_print_queue **q, + int queue_type){ + + int ret = OMPI_SUCCESS; + + switch(queue_type) { + + case WRITE_PRINT_QUEUE: + *q = coll_write_time; + break; + case READ_PRINT_QUEUE: + *q = coll_read_time; + break; + } + + if (NULL == q){ + ret = OMPI_ERROR; + } + return ret; + +} + + +int common_ompio_initialize_print_queue(void *r){ + + mca_common_ompio_print_queue *q; + int ret = OMPI_SUCCESS; + + q = (mca_common_ompio_print_queue *) malloc ( sizeof(mca_common_ompio_print_queue)); + if ( NULL == q ) { + ret = OMPI_ERR_OUT_OF_RESOURCE; + } + q->first = 0; + q->last = COMMON_OMPIO_QUEUESIZE - 1; + q->count = 0; + + *r = ( void *) *q; + return ret; +} +int common_ompio_register_print_entry (int queue_type, + mca_common_ompio_print_entry x){ + + int ret = OMPI_SUCCESS; + mca_common_ompio_print_queue *q=NULL; + + ret = common_ompio_set_print_queue(&q, queue_type); + + if (ret != OMPI_ERROR){ + if (q->count >= COMMON_OMPIO_QUEUESIZE){ + return OMPI_ERROR; + } + else{ + q->last = (q->last + 1) % COMMON_OMPIO_QUEUESIZE; + q->entry[q->last] = x; + q->count = q->count + 1; + } + } + return ret; +} + +int common_ompio_unregister_print_entry (int queue_type, + mca_common_ompio_print_entry *x){ + + int ret = OMPI_SUCCESS; + mca_common_ompio_print_queue *q=NULL; + ret = common_ompio_set_print_queue(&q, queue_type); + if (ret != OMPI_ERROR){ + if (q->count <= 0){ + return OMPI_ERROR; + } + else{ + *x = q->entry[q->first]; + q->first = (q->first+1) % COMMON_OMPIO_QUEUESIZE; + q->count = q->count - 1; + } + } + return OMPI_SUCCESS; +} + +int common_ompio_empty_print_queue(int queue_type){ + + int ret = OMPI_SUCCESS; + mca_common_ompio_print_queue *q=NULL; + ret = common_ompio_set_print_queue(&q, queue_type); + + assert (ret != OMPI_ERROR); + (void)ret; // silence compiler warning + if (q->count == 0) + return 1; + else + return 0; + + +} + +int common_ompio_full_print_queue(int queue_type){ + + + int ret = OMPI_SUCCESS; + mca_common_ompio_print_queue *q=NULL; + ret = common_ompio_set_print_queue(&q, queue_type); + + assert ( ret != OMPI_ERROR); + (void)ret; // silence compiler warning + if (q->count < COMMON_OMPIO_QUEUESIZE) + return 0; + else + return 1; + +} + + +int common_ompio_print_time_info(int queue_type, + char *name, + mca_io_ompio_file_t *fh){ + + int i = 0, j=0, nprocs_for_coll = 0, ret = OMPI_SUCCESS, count = 0; + double *time_details = NULL, *final_sum = NULL; + double *final_max = NULL, *final_min = NULL; + double *final_time_details=NULL; + mca_common_ompio_print_queue *q=NULL; + + ret = common_ompio_set_print_queue(&q, queue_type); + + assert (ret != OMPI_ERROR); + nprocs_for_coll = q->entry[0].nprocs_for_coll; + time_details = (double *) malloc (4*sizeof(double)); + if ( NULL == time_details){ + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + + } + + if (!fh->f_rank){ + + final_min = (double *) malloc (3*sizeof(double)); + if ( NULL == final_min){ + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + } + + final_max = (double *) malloc (3*sizeof(double)); + if ( NULL == final_max){ + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + + } + + final_sum = (double *) malloc (3*sizeof(double)); + if ( NULL == final_sum){ + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + } + + final_time_details = + (double *)malloc + (fh->f_size * 4 * sizeof(double)); + if (NULL == final_time_details){ + ret = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; + } + + count = 4 * fh->f_size; + for(i=0;icount > 0){ + for (i=0; i < q->count; i++){ + for (j=0;j<3;j++){ + if (!fh->f_rank){ + final_min[j] = 100000.0; + final_max[j] = 0.0; + final_sum[j] = 0.0; + } + time_details[j] += q->entry[i].time[j]; + } + time_details[3] = q->entry[i].aggregator; + } + } + + fh->f_comm->c_coll.coll_gather(time_details, + 4, + MPI_DOUBLE, + final_time_details, + 4, + MPI_DOUBLE, + 0, + fh->f_comm, + fh->f_comm->c_coll.coll_gather_module); + + + + if (!fh->f_rank){ + + for (i=0;i final_max[0]) + final_max[0] = final_time_details[i]; + if ( final_time_details[i+1] > final_max[1]) + final_max[1] = final_time_details[i+1]; + if ( final_time_details[i+2] > final_max[2]) + final_max[2] = final_time_details[i+2]; + + } + } + + printf ("\n# MAX-%s AVG-%s MIN-%s MAX-COMM AVG-COMM MIN-COMM", + name, name, name); + printf (" MAX-EXCH AVG-EXCH MIN-EXCH\n"); + printf (" %f %f %f %f %f %f %f %f %f\n\n", + final_max[0], final_sum[0]/nprocs_for_coll, final_min[0], + final_max[1], final_sum[1]/nprocs_for_coll, final_min[1], + final_max[2], final_sum[2]/nprocs_for_coll, final_min[2]); + + } + + exit: + if ( NULL != final_max){ + free(final_max); + final_max = NULL; + } + if (NULL != final_min){ + free(final_min); + final_min = NULL; + } + if (NULL != final_sum){ + free(final_sum); + final_sum = NULL; + } + if (NULL != time_details){ + free(time_details); + time_details = NULL; + } + + return ret; +} + diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.h b/ompi/mca/common/ompio/common_ompio_print_queue.h new file mode 100644 index 0000000000..00180b8e9b --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio_print_queue.h @@ -0,0 +1,79 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2007 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 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 + * + * $HEADER$ + */ + +#ifndef MCA_COMMON_OMPIO_PRINT_QUEUE_H +#define MCA_COMMON_OMPIO_PRINT_QUEUE_H + + +#include "mpi.h" +#include "ompi/mca/io/ompio/io_ompio.h" + +OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info; + +#define COMMON_OMPIO_QUEUESIZE 2048 + +/* PRINT QUEUES*/ +#define WRITE_PRINT_QUEUE 1809 +#define READ_PRINT_QUEUE 2178 +/*---------------------------*/ + +/*To extract time-information */ +typedef struct { + double time[3]; + int nprocs_for_coll; + int aggregator; +}mca_common_ompio_print_entry; + +typedef struct { + mca_common_ompio_print_entry entry[COMMON_OMPIO_QUEUESIZE + 1]; + int first; + int last; + int count; +} mca_common_ompio_print_queue; + + +OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_write_time; +OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_read_time; + + +OMPI_DECLSPEC int common_ompio_register_print_entry (int queue_type, + mca_common_ompio_print_entry x); + +OMPI_DECLSPEC int common_ompio_unregister_print_entry (int queue_type, + mca_common_ompio_print_entry *x); + +OMPI_DECLSPEC int common_ompio_empty_print_queue(int queue_type); + +OMPI_DECLSPEC int common_ompio_full_print_queue(int queue_type); + +OMPI_DECLSPEC int common_ompio_initialize_print_queue(mca_common_ompio_print_queue *q); + +OMPI_DECLSPEC int common_ompio_print_time_info(int queue_type, + char *name_operation, + mca_io_ompio_file_t *fh); +int common_ompio_set_print_queue (mca_common_ompio_print_queue **q, + int queue_type); + + +END_C_DECLS + +#endif /* MCA_COMMON_OMPIO_PRINT_QUEUE_H */ diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index d24493b3c3..4661af08ae 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -341,8 +341,8 @@ struct mca_io_ompio_data_t { }; typedef struct mca_io_ompio_data_t mca_io_ompio_data_t; -OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_write_time; -OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_read_time; +//OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_write_time; +// OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_read_time; /* functions to retrieve the number of aggregators and the size of the temporary buffer on aggregators from the fcoll modules */ From fe17410943d5be95367d3712dc6f1e8eb4780470 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 19 Jul 2016 09:15:49 -0500 Subject: [PATCH 2/6] next step in making the print_queue functionality move to common/ompio --- ompi/mca/common/ompio/Makefile.am | 3 +- ompi/mca/common/ompio/common_ompio.h | 27 ++ .../common/ompio/common_ompio_print_queue.c | 184 +++++-------- .../common/ompio/common_ompio_print_queue.h | 36 +-- ompi/mca/io/ompio/io_ompio.c | 253 ------------------ ompi/mca/io/ompio/io_ompio.h | 52 +--- ompi/mca/io/ompio/io_ompio_file_open.c | 36 +-- 7 files changed, 126 insertions(+), 465 deletions(-) create mode 100644 ompi/mca/common/ompio/common_ompio.h diff --git a/ompi/mca/common/ompio/Makefile.am b/ompi/mca/common/ompio/Makefile.am index c491e00e74..d6e33ff05c 100644 --- a/ompi/mca/common/ompio/Makefile.am +++ b/ompi/mca/common/ompio/Makefile.am @@ -19,7 +19,8 @@ # headers = \ - common_ompio_print_queue.h + common_ompio_print_queue.h \ + common_ompio.h sources = \ common_ompio_print_queue.c diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h new file mode 100644 index 0000000000..501e7db0d5 --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio.h @@ -0,0 +1,27 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2007 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_COMMON_OMPIO_H +#define MCA_COMMON_OMPIO_H + +#include "ompi/mca/common/ompio/common_ompio_print_queue.h" +#include "ompi/mca/io/ompio/io_ompio.h" + +#endif /* MCA_COMMON_OMPIO_H */ diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.c b/ompi/mca/common/ompio/common_ompio_print_queue.c index 30ba98ed42..75831272b2 100644 --- a/ompi/mca/common/ompio/common_ompio_print_queue.c +++ b/ompi/mca/common/ompio/common_ompio_print_queue.c @@ -11,10 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2016 University of Houston. All rights reserved. - * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,38 +24,13 @@ #include "ompi/communicator/communicator.h" #include "ompi/datatype/ompi_datatype.h" -#include "common_ompio_print_queue.h" +#include "ompi/mca/common/ompio/common_ompio.h" -mca_common_ompio_print_queue *coll_write_time=NULL; -mca_common_ompio_print_queue *coll_read_time=NULL; /* Print queue related function implementations */ -int common_ompio_set_print_queue (mca_common_ompio_print_queue **q, - int queue_type){ +int mca_common_ompio_initialize_print_queue( mca_common_ompio_print_queue **r){ - int ret = OMPI_SUCCESS; - - switch(queue_type) { - - case WRITE_PRINT_QUEUE: - *q = coll_write_time; - break; - case READ_PRINT_QUEUE: - *q = coll_read_time; - break; - } - - if (NULL == q){ - ret = OMPI_ERROR; - } - return ret; - -} - - -int common_ompio_initialize_print_queue(void *r){ - - mca_common_ompio_print_queue *q; + mca_common_ompio_print_queue *q=NULL; int ret = OMPI_SUCCESS; q = (mca_common_ompio_print_queue *) malloc ( sizeof(mca_common_ompio_print_queue)); @@ -66,100 +38,74 @@ int common_ompio_initialize_print_queue(void *r){ ret = OMPI_ERR_OUT_OF_RESOURCE; } q->first = 0; - q->last = COMMON_OMPIO_QUEUESIZE - 1; + q->last = MCA_COMMON_OMPIO_QUEUESIZE - 1; q->count = 0; - *r = ( void *) *q; - return ret; -} -int common_ompio_register_print_entry (int queue_type, - mca_common_ompio_print_entry x){ - - int ret = OMPI_SUCCESS; - mca_common_ompio_print_queue *q=NULL; - - ret = common_ompio_set_print_queue(&q, queue_type); - - if (ret != OMPI_ERROR){ - if (q->count >= COMMON_OMPIO_QUEUESIZE){ - return OMPI_ERROR; - } - else{ - q->last = (q->last + 1) % COMMON_OMPIO_QUEUESIZE; - q->entry[q->last] = x; - q->count = q->count + 1; - } - } + *r = q; return ret; } -int common_ompio_unregister_print_entry (int queue_type, - mca_common_ompio_print_entry *x){ - - int ret = OMPI_SUCCESS; - mca_common_ompio_print_queue *q=NULL; - ret = common_ompio_set_print_queue(&q, queue_type); - if (ret != OMPI_ERROR){ - if (q->count <= 0){ - return OMPI_ERROR; - } - else{ - *x = q->entry[q->first]; - q->first = (q->first+1) % COMMON_OMPIO_QUEUESIZE; - q->count = q->count - 1; - } +int mca_common_ompio_register_print_entry ( mca_common_ompio_print_queue *q, + mca_common_ompio_print_entry x) +{ + if (q->count >= MCA_COMMON_OMPIO_QUEUESIZE){ + return OMPI_ERROR; } + else{ + q->last = (q->last + 1) % MCA_COMMON_OMPIO_QUEUESIZE; + q->entry[q->last] = x; + q->count = q->count + 1; + } + return OMPI_SUCCESS; } -int common_ompio_empty_print_queue(int queue_type){ - - int ret = OMPI_SUCCESS; - mca_common_ompio_print_queue *q=NULL; - ret = common_ompio_set_print_queue(&q, queue_type); - - assert (ret != OMPI_ERROR); - (void)ret; // silence compiler warning - if (q->count == 0) - return 1; - else - return 0; +int mca_common_ompio_unregister_print_entry ( mca_common_ompio_print_queue *q, + mca_common_ompio_print_entry *x) +{ + if (q->count <= 0){ + return OMPI_ERROR; + } + else{ + *x = q->entry[q->first]; + q->first = (q->first+1) % MCA_COMMON_OMPIO_QUEUESIZE; + q->count = q->count - 1; + } + return OMPI_SUCCESS; } -int common_ompio_full_print_queue(int queue_type){ +int mca_common_ompio_empty_print_queue(mca_common_ompio_print_queue *q) +{ + if (q->count == 0) { + return 1; + } + + return 0; +} +int mca_common_ompio_full_print_queue(mca_common_ompio_print_queue *q) +{ + if (q->count < MCA_COMMON_OMPIO_QUEUESIZE) { + return 0; + } - int ret = OMPI_SUCCESS; - mca_common_ompio_print_queue *q=NULL; - ret = common_ompio_set_print_queue(&q, queue_type); - - assert ( ret != OMPI_ERROR); - (void)ret; // silence compiler warning - if (q->count < COMMON_OMPIO_QUEUESIZE) - return 0; - else - return 1; - + return 1; } -int common_ompio_print_time_info(int queue_type, - char *name, - mca_io_ompio_file_t *fh){ +int mca_common_ompio_print_time_info( mca_common_ompio_print_queue *q, + char *name, + struct mca_io_ompio_file_t *fh){ int i = 0, j=0, nprocs_for_coll = 0, ret = OMPI_SUCCESS, count = 0; double *time_details = NULL, *final_sum = NULL; double *final_max = NULL, *final_min = NULL; double *final_time_details=NULL; - mca_common_ompio_print_queue *q=NULL; - ret = common_ompio_set_print_queue(&q, queue_type); - - assert (ret != OMPI_ERROR); nprocs_for_coll = q->entry[0].nprocs_for_coll; - time_details = (double *) malloc (4*sizeof(double)); + time_details = (double *) calloc (4,sizeof(double)); if ( NULL == time_details){ ret = OMPI_ERR_OUT_OF_RESOURCE; goto exit; @@ -187,24 +133,13 @@ int common_ompio_print_time_info(int queue_type, goto exit; } - final_time_details = - (double *)malloc - (fh->f_size * 4 * sizeof(double)); + final_time_details = (double *)calloc (fh->f_size, 4 * sizeof(double)); if (NULL == final_time_details){ ret = OMPI_ERR_OUT_OF_RESOURCE; goto exit; } count = 4 * fh->f_size; - for(i=0;icount > 0){ @@ -221,17 +156,18 @@ int common_ompio_print_time_info(int queue_type, } } - fh->f_comm->c_coll.coll_gather(time_details, - 4, - MPI_DOUBLE, - final_time_details, - 4, - MPI_DOUBLE, - 0, - fh->f_comm, - fh->f_comm->c_coll.coll_gather_module); - - + ret = fh->f_comm->c_coll.coll_gather(time_details, + 4, + MPI_DOUBLE, + final_time_details, + 4, + MPI_DOUBLE, + 0, + fh->f_comm, + fh->f_comm->c_coll.coll_gather_module); + + if ( OMPI_SUCCESS != ret ) { + } if (!fh->f_rank){ diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.h b/ompi/mca/common/ompio/common_ompio_print_queue.h index 00180b8e9b..deb869eeee 100644 --- a/ompi/mca/common/ompio/common_ompio_print_queue.h +++ b/ompi/mca/common/ompio/common_ompio_print_queue.h @@ -25,16 +25,11 @@ #include "mpi.h" -#include "ompi/mca/io/ompio/io_ompio.h" OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info; +struct mca_io_ompio_file_t; -#define COMMON_OMPIO_QUEUESIZE 2048 - -/* PRINT QUEUES*/ -#define WRITE_PRINT_QUEUE 1809 -#define READ_PRINT_QUEUE 2178 -/*---------------------------*/ +#define MCA_COMMON_OMPIO_QUEUESIZE 2048 /*To extract time-information */ typedef struct { @@ -44,34 +39,27 @@ typedef struct { }mca_common_ompio_print_entry; typedef struct { - mca_common_ompio_print_entry entry[COMMON_OMPIO_QUEUESIZE + 1]; + mca_common_ompio_print_entry entry[MCA_COMMON_OMPIO_QUEUESIZE + 1]; int first; int last; int count; } mca_common_ompio_print_queue; -OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_write_time; -OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_read_time; +OMPI_DECLSPEC int mca_common_ompio_register_print_entry (mca_common_ompio_print_queue *q, + mca_common_ompio_print_entry x); +OMPI_DECLSPEC int mca_common_ompio_unregister_print_entry (mca_common_ompio_print_queue *q, + mca_common_ompio_print_entry *x); -OMPI_DECLSPEC int common_ompio_register_print_entry (int queue_type, - mca_common_ompio_print_entry x); +OMPI_DECLSPEC int mca_common_ompio_empty_print_queue(mca_common_ompio_print_queue *q); -OMPI_DECLSPEC int common_ompio_unregister_print_entry (int queue_type, - mca_common_ompio_print_entry *x); +OMPI_DECLSPEC int mca_common_ompio_full_print_queue(mca_common_ompio_print_queue *q); -OMPI_DECLSPEC int common_ompio_empty_print_queue(int queue_type); +OMPI_DECLSPEC int mca_common_ompio_initialize_print_queue(mca_common_ompio_print_queue **q); -OMPI_DECLSPEC int common_ompio_full_print_queue(int queue_type); - -OMPI_DECLSPEC int common_ompio_initialize_print_queue(mca_common_ompio_print_queue *q); - -OMPI_DECLSPEC int common_ompio_print_time_info(int queue_type, - char *name_operation, - mca_io_ompio_file_t *fh); -int common_ompio_set_print_queue (mca_common_ompio_print_queue **q, - int queue_type); +OMPI_DECLSPEC int mca_common_ompio_print_time_info( mca_common_ompio_print_queue *q, + char *name_operation, struct mca_io_ompio_file_t *fh); END_C_DECLS diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index 5ec6d9c594..dc1ea18f89 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -52,9 +52,6 @@ #endif #include "io_ompio.h" -mca_io_ompio_print_queue *coll_write_time=NULL; -mca_io_ompio_print_queue *coll_read_time=NULL; - static int mca_io_ompio_create_groups(mca_io_ompio_file_t *fh, size_t bytes_per_proc); @@ -1179,256 +1176,6 @@ void mca_io_ompio_get_bytes_per_agg ( int *bytes_per_agg) return; } -/* Print queue related function implementations */ -int ompi_io_ompio_set_print_queue (mca_io_ompio_print_queue **q, - int queue_type){ - - int ret = OMPI_SUCCESS; - - switch(queue_type) { - - case WRITE_PRINT_QUEUE: - *q = coll_write_time; - break; - case READ_PRINT_QUEUE: - *q = coll_read_time; - break; - } - - if (NULL == q){ - ret = OMPI_ERROR; - } - return ret; - -} - - -int ompi_io_ompio_initialize_print_queue(mca_io_ompio_print_queue *q){ - - int ret = OMPI_SUCCESS; - q->first = 0; - q->last = QUEUESIZE - 1; - q->count = 0; - return ret; -} -int ompi_io_ompio_register_print_entry (int queue_type, - mca_io_ompio_print_entry x){ - - int ret = OMPI_SUCCESS; - mca_io_ompio_print_queue *q=NULL; - - ret = ompi_io_ompio_set_print_queue(&q, queue_type); - - if (ret != OMPI_ERROR){ - if (q->count >= QUEUESIZE){ - return OMPI_ERROR; - } - else{ - q->last = (q->last + 1) % QUEUESIZE; - q->entry[q->last] = x; - q->count = q->count + 1; - } - } - return ret; -} - -int ompi_io_ompio_unregister_print_entry (int queue_type, - mca_io_ompio_print_entry *x){ - - int ret = OMPI_SUCCESS; - mca_io_ompio_print_queue *q=NULL; - ret = ompi_io_ompio_set_print_queue(&q, queue_type); - if (ret != OMPI_ERROR){ - if (q->count <= 0){ - return OMPI_ERROR; - } - else{ - *x = q->entry[q->first]; - q->first = (q->first+1) % QUEUESIZE; - q->count = q->count - 1; - } - } - return OMPI_SUCCESS; -} - -int ompi_io_ompio_empty_print_queue(int queue_type){ - - int ret = OMPI_SUCCESS; - mca_io_ompio_print_queue *q=NULL; - ret = ompi_io_ompio_set_print_queue(&q, queue_type); - - assert (ret != OMPI_ERROR); - (void)ret; // silence compiler warning - if (q->count == 0) - return 1; - else - return 0; - - -} - -int ompi_io_ompio_full_print_queue(int queue_type){ - - - int ret = OMPI_SUCCESS; - mca_io_ompio_print_queue *q=NULL; - ret = ompi_io_ompio_set_print_queue(&q, queue_type); - - assert ( ret != OMPI_ERROR); - (void)ret; // silence compiler warning - if (q->count < QUEUESIZE) - return 0; - else - return 1; - -} - - -int ompi_io_ompio_print_time_info(int queue_type, - char *name, - mca_io_ompio_file_t *fh){ - - int i = 0, j=0, nprocs_for_coll = 0, ret = OMPI_SUCCESS, count = 0; - double *time_details = NULL, *final_sum = NULL; - double *final_max = NULL, *final_min = NULL; - double *final_time_details=NULL; - mca_io_ompio_print_queue *q=NULL; - - ret = ompi_io_ompio_set_print_queue(&q, queue_type); - - assert (ret != OMPI_ERROR); - nprocs_for_coll = q->entry[0].nprocs_for_coll; - time_details = (double *) malloc (4*sizeof(double)); - if ( NULL == time_details){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - - } - - if (!fh->f_rank){ - - final_min = (double *) malloc (3*sizeof(double)); - if ( NULL == final_min){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - - final_max = (double *) malloc (3*sizeof(double)); - if ( NULL == final_max){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - - } - - final_sum = (double *) malloc (3*sizeof(double)); - if ( NULL == final_sum){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - - final_time_details = - (double *)malloc - (fh->f_size * 4 * sizeof(double)); - if (NULL == final_time_details){ - ret = OMPI_ERR_OUT_OF_RESOURCE; - goto exit; - } - - count = 4 * fh->f_size; - for(i=0;icount > 0){ - for (i=0; i < q->count; i++){ - for (j=0;j<3;j++){ - if (!fh->f_rank){ - final_min[j] = 100000.0; - final_max[j] = 0.0; - final_sum[j] = 0.0; - } - time_details[j] += q->entry[i].time[j]; - } - time_details[3] = q->entry[i].aggregator; - } - } - - fh->f_comm->c_coll.coll_gather(time_details, - 4, - MPI_DOUBLE, - final_time_details, - 4, - MPI_DOUBLE, - 0, - fh->f_comm, - fh->f_comm->c_coll.coll_gather_module); - - - - if (!fh->f_rank){ - - for (i=0;i final_max[0]) - final_max[0] = final_time_details[i]; - if ( final_time_details[i+1] > final_max[1]) - final_max[1] = final_time_details[i+1]; - if ( final_time_details[i+2] > final_max[2]) - final_max[2] = final_time_details[i+2]; - - } - } - - printf ("\n# MAX-%s AVG-%s MIN-%s MAX-COMM AVG-COMM MIN-COMM", - name, name, name); - printf (" MAX-EXCH AVG-EXCH MIN-EXCH\n"); - printf (" %f %f %f %f %f %f %f %f %f\n\n", - final_max[0], final_sum[0]/nprocs_for_coll, final_min[0], - final_max[1], final_sum[1]/nprocs_for_coll, final_min[1], - final_max[2], final_sum[2]/nprocs_for_coll, final_min[2]); - - } - - exit: - if ( NULL != final_max){ - free(final_max); - final_max = NULL; - } - if (NULL != final_min){ - free(final_min); - final_min = NULL; - } - if (NULL != final_sum){ - free(final_sum); - final_sum = NULL; - } - if (NULL != time_details){ - free(time_details); - time_details = NULL; - } - - return ret; -} int mca_io_ompio_create_groups(mca_io_ompio_file_t *fh, size_t bytes_per_proc) diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 4661af08ae..949044ee3a 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -41,6 +41,8 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" +#include "ompi/mca/common/ompio/common_ompio.h" + extern int mca_io_ompio_cycle_buffer_size; extern int mca_io_ompio_bytes_per_agg; extern int mca_io_ompio_num_aggregators; @@ -91,9 +93,6 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info; #define OMPIO_MODE_APPEND 128 #define OMPIO_MODE_SEQUENTIAL 256 -/* PRINT QUEUES*/ -#define WRITE_PRINT_QUEUE 1809 -#define READ_PRINT_QUEUE 2178 /*---------------------------*/ @@ -162,19 +161,6 @@ typedef struct mca_io_ompio_offlen_array_t{ int process_id; }mca_io_ompio_offlen_array_t; -/*To extract time-information */ -typedef struct { - double time[3]; - int nprocs_for_coll; - int aggregator; -}mca_io_ompio_print_entry; - -typedef struct { - mca_io_ompio_print_entry entry[QUEUESIZE + 1]; - int first; - int last; - int count; -} mca_io_ompio_print_queue; typedef struct { int ndims; @@ -233,10 +219,6 @@ typedef int (*mca_io_ompio_set_aggregator_props_fn_t) (struct mca_io_ompio_file_ size_t bytes_per_proc); -typedef int (*mca_io_ompio_full_print_queue_fn_t) (int queue_type); -typedef int (*mca_io_ompio_register_print_entry_fn_t) (int queue_type, - mca_io_ompio_print_entry x); - /** * Back-end structure for MPI_File @@ -306,10 +288,9 @@ struct mca_io_ompio_file_t { mca_fbtl_base_module_t *f_fbtl; mca_sharedfp_base_module_t *f_sharedfp; - /* No Error handling done yet - struct ompi_errhandler_t *error_handler; - ompi_errhandler_type_t errhandler_type; - */ + /* Timing information */ + mca_common_ompio_print_queue *f_coll_write_queue; + mca_common_ompio_print_queue *f_coll_read_queue; /*initial list of aggregators and groups*/ int *f_init_aggr_list; @@ -330,9 +311,6 @@ struct mca_io_ompio_file_t { mca_io_ompio_get_num_aggregators_fn_t f_get_num_aggregators; mca_io_ompio_get_bytes_per_agg_fn_t f_get_bytes_per_agg; mca_io_ompio_set_aggregator_props_fn_t f_set_aggregator_props; - - mca_io_ompio_full_print_queue_fn_t f_full_print_queue; - mca_io_ompio_register_print_entry_fn_t f_register_print_entry; }; typedef struct mca_io_ompio_file_t mca_io_ompio_file_t; @@ -341,8 +319,6 @@ struct mca_io_ompio_data_t { }; typedef struct mca_io_ompio_data_t mca_io_ompio_data_t; -//OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_write_time; -// OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_read_time; /* functions to retrieve the number of aggregators and the size of the temporary buffer on aggregators from the fcoll modules */ @@ -518,24 +494,6 @@ OMPI_DECLSPEC int ompi_io_ompio_break_file_view (mca_io_ompio_file_t *fh, int *broken_count); -OMPI_DECLSPEC int ompi_io_ompio_register_print_entry (int queue_type, - mca_io_ompio_print_entry x); - -OMPI_DECLSPEC int ompi_io_ompio_unregister_print_entry (int queue_type, mca_io_ompio_print_entry *x); - -OMPI_DECLSPEC int ompi_io_ompio_empty_print_queue(int queue_type); - -OMPI_DECLSPEC int ompi_io_ompio_full_print_queue(int queue_type); - -OMPI_DECLSPEC int ompi_io_ompio_initialize_print_queue(mca_io_ompio_print_queue *q); - -OMPI_DECLSPEC int ompi_io_ompio_print_time_info(int queue_type, - char *name_operation, - mca_io_ompio_file_t *fh); -int ompi_io_ompio_set_print_queue (mca_io_ompio_print_queue **q, - int queue_type); - - /* * ****************************************************************** * ********* functions which are implemented in this module ********* diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index 35498307f1..e46884f5d2 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -131,11 +131,8 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm, ompio_fh->f_split_coll_in_use = false; /*Initialize the print_queues queues here!*/ - coll_write_time = (mca_io_ompio_print_queue *) malloc (sizeof(mca_io_ompio_print_queue)); - coll_read_time = (mca_io_ompio_print_queue *) malloc (sizeof(mca_io_ompio_print_queue)); - - ompi_io_ompio_initialize_print_queue(coll_write_time); - ompi_io_ompio_initialize_print_queue(coll_read_time); + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_write_queue); + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_read_queue); /* set some function pointers required for fcoll, fbtls and sharedfp modules*/ ompio_fh->f_decode_datatype=ompi_io_ompio_decode_datatype; @@ -148,9 +145,6 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm, ompio_fh->f_get_bytes_per_agg=mca_io_ompio_get_bytes_per_agg; ompio_fh->f_set_aggregator_props=ompi_io_ompio_set_aggregator_props; - ompio_fh->f_full_print_queue=ompi_io_ompio_full_print_queue; - ompio_fh->f_register_print_entry=ompi_io_ompio_register_print_entry; - /* This fix is needed for data seiving to work with two-phase collective I/O */ if ((amode & MPI_MODE_WRONLY)){ @@ -292,20 +286,20 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) if(mca_io_ompio_coll_timing_info){ strcpy (name, "WRITE"); - if (!ompi_io_ompio_empty_print_queue(WRITE_PRINT_QUEUE)){ - ret = ompi_io_ompio_print_time_info(WRITE_PRINT_QUEUE, - name, - ompio_fh); + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_write_queue)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_write_queue, + name, + ompio_fh); if (OMPI_SUCCESS != ret){ printf("Error in print_time_info "); } } strcpy (name, "READ"); - if (!ompi_io_ompio_empty_print_queue(READ_PRINT_QUEUE)){ - ret = ompi_io_ompio_print_time_info(READ_PRINT_QUEUE, - name, - ompio_fh); + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_read_queue)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_read_queue, + name, + ompio_fh); if (OMPI_SUCCESS != ret){ printf("Error in print_time_info "); } @@ -374,6 +368,16 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) } + if ( NULL != ompio_fh->f_coll_write_queue ) { + free ( ompio_fh->f_coll_write_queue ); + ompio_fh->f_coll_write_queue = NULL; + } + + if ( NULL != ompio_fh->f_coll_read_queue ) { + free ( ompio_fh->f_coll_read_queue ); + ompio_fh->f_coll_read_queue = NULL; + } + if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) { ompi_datatype_destroy (&ompio_fh->f_iov_type); } From 39ae93b87b7b3c89bbe8512321d48e0f0cb61fea Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 19 Jul 2016 09:46:41 -0500 Subject: [PATCH 3/6] modify the fcoll components to use the common/ompio print queues --- .../dynamic/fcoll_dynamic_file_read_all.c | 8 +-- .../dynamic/fcoll_dynamic_file_write_all.c | 8 +-- .../fcoll_dynamic_gen2_file_read_all.c | 8 +-- .../fcoll_dynamic_gen2_file_write_all.c | 52 +++++++++++-------- .../fcoll/static/fcoll_static_file_read_all.c | 8 +-- .../static/fcoll_static_file_write_all.c | 8 +-- .../two_phase/fcoll_two_phase_file_read_all.c | 8 +-- .../fcoll_two_phase_file_write_all.c | 8 +-- ompi/mca/io/ompio/io_ompio.h | 6 +-- ompi/mca/io/ompio/io_ompio_file_open.c | 24 ++++----- 10 files changed, 73 insertions(+), 65 deletions(-) diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c index 39b9e1d2dd..dd397a5669 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c @@ -104,7 +104,7 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, double read_time = 0.0, start_read_time = 0.0, end_read_time = 0.0; double rcomm_time = 0.0, start_rcomm_time = 0.0, end_rcomm_time = 0.0; double read_exch = 0.0, start_rexch = 0.0, end_rexch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif /************************************************************************** @@ -866,9 +866,9 @@ mca_fcoll_dynamic_file_read_all (mca_io_ompio_file_t *fh, else nentry.aggregator = 0; nentry.nprocs_for_coll = dynamic_num_io_procs; - if (!fh->f_full_print_queue(READ_PRINT_QUEUE)){ - fh->f_register_print_entry(READ_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_read_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_read_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c index 9af60b606b..bc1618dfb9 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c @@ -108,7 +108,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0; double comm_time = 0.0, start_comm_time = 0.0, end_comm_time = 0.0; double exch_write = 0.0, start_exch = 0.0, end_exch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif opal_datatype_type_size ( &datatype->super, &ftype_size ); @@ -979,9 +979,9 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, else nentry.aggregator = 0; nentry.nprocs_for_coll = dynamic_num_io_procs; - if (!fh->f_full_print_queue(WRITE_PRINT_QUEUE)){ - fh->f_register_print_entry(WRITE_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_write_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_write_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c index 40438100a5..e45f9dbc9e 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_read_all.c @@ -104,7 +104,7 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, double read_time = 0.0, start_read_time = 0.0, end_read_time = 0.0; double rcomm_time = 0.0, start_rcomm_time = 0.0, end_rcomm_time = 0.0; double read_exch = 0.0, start_rexch = 0.0, end_rexch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif /************************************************************************** @@ -866,9 +866,9 @@ mca_fcoll_dynamic_gen2_file_read_all (mca_io_ompio_file_t *fh, else nentry.aggregator = 0; nentry.nprocs_for_coll = dynamic_gen2_num_io_procs; - if (!fh->f_full_print_queue(READ_PRINT_QUEUE)){ - fh->f_register_print_entry(READ_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_read_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_read_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c index 8946d33652..a2f5db635f 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c @@ -152,7 +152,7 @@ int mca_fcoll_dynamic_gen2_file_write_all (mca_io_ompio_file_t *fh, double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0; double comm_time = 0.0, start_comm_time = 0.0, end_comm_time = 0.0; double exch_write = 0.0, start_exch = 0.0, end_exch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif @@ -470,7 +470,7 @@ int mca_fcoll_dynamic_gen2_file_write_all (mca_io_ompio_file_t *fh, #if DEBUG_ON - if (my_aggregator == fh->f_rank) { + if (aggregators[i] == fh->f_rank) { uint32_t tv=0; for (tv=0 ; tvprev_sendbuf_is_contiguous && aggr_data[i]->prev_bytes_sent) { free (aggr_data[i]->prev_send_buf); @@ -617,10 +624,17 @@ int mca_fcoll_dynamic_gen2_file_write_all (mca_io_ompio_file_t *fh, /* Write data for iteration i=cycles-1 */ for ( i=0; iprev_sendbuf_is_contiguous && aggr_data[i]->prev_bytes_sent) { free (aggr_data[i]->prev_send_buf); @@ -635,14 +649,15 @@ int mca_fcoll_dynamic_gen2_file_write_all (mca_io_ompio_file_t *fh, nentry.time[0] = write_time; nentry.time[1] = comm_time; nentry.time[2] = exch_write; - if (my_aggregator == fh->f_rank) + nentry.aggregator = 0; + for ( i=0; if_rank) nentry.aggregator = 1; - else - nentry.aggregator = 0; + } nentry.nprocs_for_coll = dynamic_gen2_num_io_procs; - if (!fh->f_full_print_queue(WRITE_PRINT_QUEUE)){ - fh->f_register_print_entry(WRITE_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_write_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_write_time, + nentry); } #endif @@ -725,19 +740,12 @@ static int write_init (mca_io_ompio_file_t *fh, int aggregator, mca_io_ompio_agg aggr_data->prev_num_io_entries, &last_array_pos, &last_pos, write_chunksize ); -#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - start_write_time = MPI_Wtime(); -#endif if ( 0 > fh->f_fbtl->fbtl_pwritev (fh)) { free ( aggr_data->prev_io_array); opal_output (1, "dynamic_gen2_write_all: fbtl_pwritev failed\n"); ret = OMPI_ERROR; goto exit; } -#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - end_write_time = MPI_Wtime(); - write_time += end_write_time - start_write_time; -#endif } free ( fh->f_io_array ); free ( aggr_data->prev_io_array); @@ -1087,9 +1095,9 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i printf("%d : global_count : %ld, bytes_sent : %d\n", rank,global_count, bytes_sent); #endif -#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - start_comm_time = MPI_Wtime(); -#endif +//#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN +// start_comm_time = MPI_Wtime(); +//#endif /************************************************************************* *** 7e. Perform the actual communication *************************************************************************/ @@ -1198,10 +1206,10 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i } #endif -#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - end_comm_time = MPI_Wtime(); - comm_time += (end_comm_time - start_comm_time); -#endif +//#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN +// end_comm_time = MPI_Wtime(); +// comm_time += (end_comm_time - start_comm_time); +//#endif /********************************************************** *** 7f. Create the io array, and pass it to fbtl *********************************************************/ diff --git a/ompi/mca/fcoll/static/fcoll_static_file_read_all.c b/ompi/mca/fcoll/static/fcoll_static_file_read_all.c index 17206628c3..41fdc514ce 100644 --- a/ompi/mca/fcoll/static/fcoll_static_file_read_all.c +++ b/ompi/mca/fcoll/static/fcoll_static_file_read_all.c @@ -103,7 +103,7 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, double read_time = 0.0, start_read_time = 0.0, end_read_time = 0.0; double rcomm_time = 0.0, start_rcomm_time = 0.0, end_rcomm_time = 0.0; double read_exch = 0.0, start_rexch = 0.0, end_rexch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif #if DEBUG_ON MPI_Aint gc_in; @@ -919,9 +919,9 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh, else nentry.aggregator = 0; nentry.nprocs_for_coll = static_num_io_procs; - if (!fh->f_full_print_queue(READ_PRINT_QUEUE)){ - fh->f_register_print_entry(READ_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_read_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_read_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c index 9e817b9dac..70d3275602 100644 --- a/ompi/mca/fcoll/static/fcoll_static_file_write_all.c +++ b/ompi/mca/fcoll/static/fcoll_static_file_write_all.c @@ -104,7 +104,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, double write_time = 0.0, start_write_time = 0.0, end_write_time = 0.0; double comm_time = 0.0, start_comm_time = 0.0, end_comm_time = 0.0; double exch_write = 0.0, start_exch = 0.0, end_exch = 0.0; - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif @@ -952,9 +952,9 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh, else nentry.aggregator = 0; nentry.nprocs_for_coll = static_num_io_procs; - if (!fh->f_full_print_queue(WRITE_PRINT_QUEUE)){ - fh->f_register_print_entry(WRITE_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_write_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_write_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c index cfae9c1ec6..8474f0bf0f 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_read_all.c @@ -140,7 +140,7 @@ mca_fcoll_two_phase_file_read_all (mca_io_ompio_file_t *fh, Flatlist_node *flat_buf=NULL; mca_io_ompio_access_array_t *my_req=NULL, *others_req=NULL; #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif // if (opal_datatype_is_predefined(&datatype->super)) { // fh->f_flags = fh->f_flags | OMPIO_CONTIGUOUS_MEMORY; @@ -479,9 +479,9 @@ mca_fcoll_two_phase_file_read_all (mca_io_ompio_file_t *fh, nentry.nprocs_for_coll = two_phase_num_io_procs; - if (!fh->f_full_print_queue(READ_PRINT_QUEUE)){ - fh->f_register_print_entry(READ_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_read_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_read_time, + nentry); } #endif diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c index dd8b7ce94a..393cf1ad69 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c @@ -168,7 +168,7 @@ mca_fcoll_two_phase_file_write_all (mca_io_ompio_file_t *fh, mca_io_ompio_access_array_t *my_req=NULL, *others_req=NULL; MPI_Aint send_buf_addr; #if OMPIO_FCOLL_WANT_TIME_BREAKDOWN - mca_io_ompio_print_entry nentry; + mca_common_ompio_print_entry nentry; #endif @@ -543,9 +543,9 @@ mca_fcoll_two_phase_file_write_all (mca_io_ompio_file_t *fh, nentry.aggregator = 0; } nentry.nprocs_for_coll = two_phase_num_io_procs; - if (!fh->f_full_print_queue(WRITE_PRINT_QUEUE)){ - fh->f_register_print_entry(WRITE_PRINT_QUEUE, - nentry); + if (!mca_common_ompio_full_print_queue(fh->f_coll_write_time)){ + mca_common_ompio_register_print_entry(fh->f_coll_write_time, + nentry); } #endif diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 949044ee3a..4477d21d91 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -64,7 +64,7 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info; #define QUEUESIZE 2048 #define MCA_IO_DEFAULT_FILE_VIEW_SIZE 4*1024*1024 -#define OMPIO_FCOLL_WANT_TIME_BREAKDOWN 0 +#define OMPIO_FCOLL_WANT_TIME_BREAKDOWN 1 #define OMPIO_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define OMPIO_MAX(a, b) (((a) < (b)) ? (b) : (a)) @@ -289,8 +289,8 @@ struct mca_io_ompio_file_t { mca_sharedfp_base_module_t *f_sharedfp; /* Timing information */ - mca_common_ompio_print_queue *f_coll_write_queue; - mca_common_ompio_print_queue *f_coll_read_queue; + mca_common_ompio_print_queue *f_coll_write_time; + mca_common_ompio_print_queue *f_coll_read_time; /*initial list of aggregators and groups*/ int *f_init_aggr_list; diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index e46884f5d2..5c57257006 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -131,8 +131,8 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm, ompio_fh->f_split_coll_in_use = false; /*Initialize the print_queues queues here!*/ - mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_write_queue); - mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_read_queue); + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_write_time); + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_read_time); /* set some function pointers required for fcoll, fbtls and sharedfp modules*/ ompio_fh->f_decode_datatype=ompi_io_ompio_decode_datatype; @@ -286,8 +286,8 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) if(mca_io_ompio_coll_timing_info){ strcpy (name, "WRITE"); - if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_write_queue)){ - ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_write_queue, + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_write_time)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_write_time, name, ompio_fh); if (OMPI_SUCCESS != ret){ @@ -296,8 +296,8 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) } strcpy (name, "READ"); - if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_read_queue)){ - ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_read_queue, + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_read_time)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_read_time, name, ompio_fh); if (OMPI_SUCCESS != ret){ @@ -368,14 +368,14 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) } - if ( NULL != ompio_fh->f_coll_write_queue ) { - free ( ompio_fh->f_coll_write_queue ); - ompio_fh->f_coll_write_queue = NULL; + if ( NULL != ompio_fh->f_coll_write_time ) { + free ( ompio_fh->f_coll_write_time ); + ompio_fh->f_coll_write_time = NULL; } - if ( NULL != ompio_fh->f_coll_read_queue ) { - free ( ompio_fh->f_coll_read_queue ); - ompio_fh->f_coll_read_queue = NULL; + if ( NULL != ompio_fh->f_coll_read_time ) { + free ( ompio_fh->f_coll_read_time ); + ompio_fh->f_coll_read_time = NULL; } if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) { From 688710d40883669d7280bea1c1f2848c71f7c26e Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 19 Jul 2016 10:55:59 -0500 Subject: [PATCH 4/6] make common/ompio compile --- VERSION | 1 + configure.ac | 1 + ompi/mca/common/ompio/Makefile.am | 2 +- ompi/mca/io/ompio/Makefile.am | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d99e143945..1add62a40a 100644 --- a/VERSION +++ b/VERSION @@ -98,6 +98,7 @@ liboshmem_so_version=0:0:0 # components-don't-affect-the-build-system abstraction. # OMPI layer +libmca_ompi_common_ompio_so_version=0:0:0 # ORTE layer libmca_orte_common_alps_so_version=0:0:0 diff --git a/configure.ac b/configure.ac index 03911bb7f3..b9b8cf43d1 100644 --- a/configure.ac +++ b/configure.ac @@ -149,6 +149,7 @@ AC_SUBST(libmca_opal_common_sm_so_version) AC_SUBST(libmca_opal_common_ugni_so_version) AC_SUBST(libmca_opal_common_verbs_so_version) AC_SUBST(libmca_orte_common_alps_so_version) +AC_SUBST(libmca_ompi_common_ompio_so_version) # # Get the versions of the autotools that were used to bootstrap us diff --git a/ompi/mca/common/ompio/Makefile.am b/ompi/mca/common/ompio/Makefile.am index d6e33ff05c..c6cac52216 100644 --- a/ompi/mca/common/ompio/Makefile.am +++ b/ompi/mca/common/ompio/Makefile.am @@ -49,7 +49,7 @@ endif lib@OPAL_LIB_PREFIX@mca_common_ompio_la_SOURCES = $(headers) $(sources) lib@OPAL_LIB_PREFIX@mca_common_ompio_la_CPPFLAGS = $(common_ompio_CPPFLAGS) lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LDFLAGS = \ - -version-info $(libmca_opal_common_ompio_so_version) \ + -version-info $(libmca_ompi_common_ompio_so_version) \ $(common_ompio_LDFLAGS) lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LIBADD = $(common_ompio_LIBS) lib@OPAL_LIB_PREFIX@mca_common_ompio_noinst_la_SOURCES = $(headers) $(sources) diff --git a/ompi/mca/io/ompio/Makefile.am b/ompi/mca/io/ompio/Makefile.am index 887e4e7ebf..0bb3a508ac 100644 --- a/ompi/mca/io/ompio/Makefile.am +++ b/ompi/mca/io/ompio/Makefile.am @@ -33,6 +33,8 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_io_ompio_la_SOURCES = $(sources) mca_io_ompio_la_LDFLAGS = -module -avoid-version +mca_io_ompio_la_LIBADD = $(io_ompio_LIBS) \ + $(OMPI_TOP_BUILDDIR)/ompi/mca/common/ompio/lib@OPAL_LIB_PREFIX@mca_common_ompio.la noinst_LTLIBRARIES = $(component_noinst) libmca_io_ompio_la_SOURCES = $(sources) From ccf76b779130e065de326f71fe6bac868c565300 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 20 Jul 2016 14:46:44 -0500 Subject: [PATCH 5/6] moving the internal read/write functions to common/ompio and update all fs/fcoll/sharedfp components to use these functions. --- ompi/mca/common/ompio/Makefile.am | 4 +- ompi/mca/common/ompio/common_ompio.h | 51 ++ .../mca/common/ompio/common_ompio_file_read.c | 353 ++++++++++++++ .../common/ompio/common_ompio_file_write.c | 448 ++++++++++++++++++ .../common/ompio/common_ompio_print_queue.c | 19 +- .../common/ompio/common_ompio_print_queue.h | 23 +- ompi/mca/fbtl/base/fbtl_base_file_select.c | 2 +- ompi/mca/fbtl/base/fbtl_base_file_unselect.c | 2 +- ompi/mca/fbtl/plfs/fbtl_plfs.h | 2 +- ompi/mca/fbtl/posix/fbtl_posix.h | 4 +- ompi/mca/fbtl/pvfs2/fbtl_pvfs2.h | 2 +- ompi/mca/fcoll/base/fcoll_base_coll_array.c | 2 +- ompi/mca/fcoll/base/fcoll_base_file_select.c | 2 +- .../mca/fcoll/base/fcoll_base_file_unselect.c | 4 +- ompi/mca/fcoll/dynamic/fcoll_dynamic.h | 4 +- .../fcoll/dynamic_gen2/fcoll_dynamic_gen2.h | 2 +- ompi/mca/fcoll/individual/fcoll_individual.h | 4 +- .../fcoll_individual_file_read_all.c | 5 +- .../fcoll_individual_file_write_all.c | 5 +- ompi/mca/fcoll/static/fcoll_static.h | 4 +- ompi/mca/fcoll/two_phase/fcoll_two_phase.h | 4 +- ompi/mca/fs/base/fs_base_file_select.c | 4 +- ompi/mca/fs/base/fs_base_file_unselect.c | 5 +- ompi/mca/fs/base/fs_base_get_parent_dir.c | 2 +- ompi/mca/fs/lustre/fs_lustre.h | 4 +- ompi/mca/fs/plfs/fs_plfs.h | 4 +- ompi/mca/fs/pvfs2/fs_pvfs2.h | 4 +- ompi/mca/fs/ufs/fs_ufs.h | 4 +- ompi/mca/io/ompio/io_ompio.h | 89 +--- ompi/mca/io/ompio/io_ompio_file_read.c | 316 +----------- ompi/mca/io/ompio/io_ompio_file_write.c | 426 +---------------- ompi/mca/sharedfp/addproc/sharedfp_addproc.h | 4 +- .../sharedfp/addproc/sharedfp_addproc_iread.c | 6 +- .../addproc/sharedfp_addproc_iwrite.c | 6 +- .../sharedfp/addproc/sharedfp_addproc_read.c | 6 +- .../sharedfp/addproc/sharedfp_addproc_write.c | 6 +- .../sharedfp/base/sharedfp_base_file_select.c | 4 +- .../base/sharedfp_base_file_unselect.c | 5 +- .../sharedfp/individual/sharedfp_individual.h | 4 +- .../sharedfp_individual_collaborate_data.c | 9 +- .../sharedfp_individual_insert_metadata.c | 8 +- .../individual/sharedfp_individual_iwrite.c | 12 +- .../individual/sharedfp_individual_write.c | 10 +- .../sharedfp/lockedfile/sharedfp_lockedfile.h | 4 +- .../lockedfile/sharedfp_lockedfile_iread.c | 6 +- .../lockedfile/sharedfp_lockedfile_iwrite.c | 6 +- .../lockedfile/sharedfp_lockedfile_read.c | 6 +- .../lockedfile/sharedfp_lockedfile_write.c | 6 +- ompi/mca/sharedfp/sm/sharedfp_sm.h | 4 +- ompi/mca/sharedfp/sm/sharedfp_sm_iread.c | 6 +- ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c | 6 +- ompi/mca/sharedfp/sm/sharedfp_sm_read.c | 6 +- ompi/mca/sharedfp/sm/sharedfp_sm_write.c | 6 +- 53 files changed, 1010 insertions(+), 930 deletions(-) create mode 100644 ompi/mca/common/ompio/common_ompio_file_read.c create mode 100644 ompi/mca/common/ompio/common_ompio_file_write.c diff --git a/ompi/mca/common/ompio/Makefile.am b/ompi/mca/common/ompio/Makefile.am index c6cac52216..d6f255819f 100644 --- a/ompi/mca/common/ompio/Makefile.am +++ b/ompi/mca/common/ompio/Makefile.am @@ -23,7 +23,9 @@ headers = \ common_ompio.h sources = \ - common_ompio_print_queue.c + common_ompio_print_queue.c \ + common_ompio_file_read.c \ + common_ompio_file_write.c # To simplify components that link to this library, we will *always* diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index 501e7db0d5..fcc3702c64 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -24,4 +24,55 @@ #include "ompi/mca/common/ompio/common_ompio_print_queue.h" #include "ompi/mca/io/ompio/io_ompio.h" +OMPI_DECLSPEC int mca_common_ompio_file_write (mca_io_ompio_file_t *fh, const void *buf, int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t *status); + +OMPI_DECLSPEC int mca_common_ompio_file_write_at (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, const void *buf, + int count, struct ompi_datatype_t *datatype, + ompi_status_public_t *status); + +OMPI_DECLSPEC int mca_common_ompio_file_iwrite (mca_io_ompio_file_t *fh, const void *buf, int count, + struct ompi_datatype_t *datatype, ompi_request_t **request); + +OMPI_DECLSPEC int mca_common_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, + const void *buf, int count, struct ompi_datatype_t *datatype, + ompi_request_t **request); + +OMPI_DECLSPEC int mca_common_ompio_file_write_at_all (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, const void *buf, + int count, struct ompi_datatype_t *datatype, + ompi_status_public_t *status); + + +OMPI_DECLSPEC int mca_common_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fp, OMPI_MPI_OFFSET_TYPE offset, const void *buf, + int count, struct ompi_datatype_t *datatype, ompi_request_t **request); + +OMPI_DECLSPEC int mca_common_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cycles, + size_t bytes_per_cycle, int max_data, uint32_t iov_count, + struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw ); + + +OMPI_DECLSPEC int mca_common_ompio_file_read (mca_io_ompio_file_t *fh, void *buf, int count, + struct ompi_datatype_t *datatype, ompi_status_public_t *status); + +OMPI_DECLSPEC int mca_common_ompio_file_read_at (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, void *buf, + int count, struct ompi_datatype_t *datatype, + ompi_status_public_t * status); + +OMPI_DECLSPEC int mca_common_ompio_file_iread (mca_io_ompio_file_t *fh, void *buf, int count, + struct ompi_datatype_t *datatype, ompi_request_t **request); + +OMPI_DECLSPEC int mca_common_ompio_file_iread_at (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, + void *buf, int count, struct ompi_datatype_t *datatype, + ompi_request_t **request); + +OMPI_DECLSPEC int mca_common_ompio_file_read_at_all (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, + void *buf, int count, struct ompi_datatype_t *datatype, + ompi_status_public_t * status); + +OMPI_DECLSPEC int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, OMPI_MPI_OFFSET_TYPE offset, + void *buf, int count, struct ompi_datatype_t *datatype, + ompi_request_t **request); + + #endif /* MCA_COMMON_OMPIO_H */ diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c new file mode 100644 index 0000000000..6c6014c5a0 --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -0,0 +1,353 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2016 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/info/info.h" +#include "ompi/file/file.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fcoll/fcoll.h" +#include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/fbtl/base/base.h" + +#include "common_ompio.h" +#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/io/ompio/io_ompio_request.h" +#include "math.h" +#include + +/* Read and write routines are split into two interfaces. +** The +** mca_io_ompio_file_read/write[_at] +** +** routines are the ones registered with the ompio modules. +** The +** +** mca_common_ompio_file_read/write[_at] +** +** routesin are used e.g. from the shared file pointer modules. +** The main difference is, that the first one takes an ompi_file_t +** as a file pointer argument, while the second uses the ompio internal +** mca_io_ompio_file_t structure. +*/ + +int mca_common_ompio_file_read (mca_io_ompio_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t *status) +{ + int ret = OMPI_SUCCESS; + + size_t total_bytes_read = 0; /* total bytes that have been read*/ + size_t bytes_per_cycle = 0; /* total read in each cycle by each process*/ + int index = 0; + int cycles = 0; + + uint32_t iov_count = 0; + struct iovec *decoded_iov = NULL; + + size_t max_data=0, real_bytes_read=0; + ssize_t ret_code=0; + int i = 0; /* index into the decoded iovec of the buffer */ + int j = 0; /* index into the file vie iovec */ + + if ( 0 == count ) { + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = 0; + } + return ret; + } + + if (fh->f_amode & MPI_MODE_WRONLY){ + printf("Improper use of FILE Mode, Using WRONLY for Read!\n"); + ret = OMPI_ERROR; + return ret; + } + + ompi_io_ompio_decode_datatype (fh, + datatype, + count, + buf, + &max_data, + &decoded_iov, + &iov_count); + + if ( -1 == mca_io_ompio_cycle_buffer_size ) { + bytes_per_cycle = max_data; + } + else { + bytes_per_cycle = mca_io_ompio_cycle_buffer_size; + } + cycles = ceil((float)max_data/bytes_per_cycle); + +#if 0 + printf ("Bytes per Cycle: %d Cycles: %d max_data:%d \n",bytes_per_cycle, cycles, max_data); +#endif + + j = fh->f_index_in_file_view; + + for (index = 0; index < cycles; index++) { + + mca_common_ompio_build_io_array ( fh, + index, + cycles, + bytes_per_cycle, + max_data, + iov_count, + decoded_iov, + &i, + &j, + &total_bytes_read); + + if (fh->f_num_of_io_entries) { + ret_code = fh->f_fbtl->fbtl_preadv (fh); + if ( 0<= ret_code ) { + real_bytes_read+=(size_t)ret_code; + } + } + + fh->f_num_of_io_entries = 0; + if (NULL != fh->f_io_array) { + free (fh->f_io_array); + fh->f_io_array = NULL; + } + } + + if (NULL != decoded_iov) { + free (decoded_iov); + decoded_iov = NULL; + } + + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = real_bytes_read; + } + + return ret; +} + +int mca_common_ompio_file_read_at (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + 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); + ret = mca_common_ompio_file_read (fh, + buf, + 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; +} + + +int mca_common_ompio_file_iread (mca_io_ompio_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret = OMPI_SUCCESS; + mca_ompio_request_t *ompio_req=NULL; + + ompio_req = OBJ_NEW(mca_ompio_request_t); + ompio_req->req_type = MCA_OMPIO_REQUEST_READ; + ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE; + + if ( 0 == count ) { + ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; + ompio_req->req_ompi.req_status._ucount = 0; + ompi_request_complete (&ompio_req->req_ompi, false); + *request = (ompi_request_t *) ompio_req; + + return OMPI_SUCCESS; + } + + if ( NULL != fh->f_fbtl->fbtl_ipreadv ) { + // This fbtl has support for non-blocking operations + + size_t total_bytes_read = 0; /* total bytes that have been read*/ + uint32_t iov_count = 0; + struct iovec *decoded_iov = NULL; + + size_t max_data = 0; + int i = 0; /* index into the decoded iovec of the buffer */ + int j = 0; /* index into the file vie iovec */ + + ompi_io_ompio_decode_datatype (fh, + datatype, + count, + buf, + &max_data, + &decoded_iov, + &iov_count); + + // Non-blocking operations have to occur in a single cycle + j = fh->f_index_in_file_view; + + mca_common_ompio_build_io_array ( fh, + 0, // index + 1, // no. of cyces + max_data, // setting bytes per cycle to match data + max_data, + iov_count, + decoded_iov, + &i, + &j, + &total_bytes_read); + + if (fh->f_num_of_io_entries) { + fh->f_fbtl->fbtl_ipreadv (fh, (ompi_request_t *) ompio_req); + } + + if ( false == mca_io_ompio_progress_is_registered ) { + // Lazy initialization of progress function to minimize impact + // on other ompi functionality in case its not used. + opal_progress_register (mca_io_ompio_component_progress); + mca_io_ompio_progress_is_registered=true; + } + + fh->f_num_of_io_entries = 0; + if (NULL != fh->f_io_array) { + free (fh->f_io_array); + fh->f_io_array = NULL; + } + + if (NULL != decoded_iov) { + free (decoded_iov); + decoded_iov = NULL; + } + } + else { + // This fbtl does not support non-blocking operations + ompi_status_public_t status; + ret = mca_common_ompio_file_read (fh, buf, count, datatype, &status); + + ompio_req->req_ompi.req_status.MPI_ERROR = ret; + ompio_req->req_ompi.req_status._ucount = status._ucount; + ompi_request_complete (&ompio_req->req_ompi, false); + } + + *request = (ompi_request_t *) ompio_req; + return ret; +} + + +int mca_common_ompio_file_iread_at (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + 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); + ret = mca_common_ompio_file_iread (fh, + buf, + 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 have + ** already been constructed in the file_iread operation + */ + ompi_io_ompio_set_explicit_offset (fh, prev_offset); + + return ret; +} + + +/* Infrastructure for collective operations */ +int mca_common_ompio_file_read_at_all (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + 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); + ret = fh->f_fcoll->fcoll_file_read_all (fh, + buf, + count, + datatype, + status); + + ompi_io_ompio_set_explicit_offset (fh, prev_offset); + return ret; +} + +int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, + OMPI_MPI_OFFSET_TYPE offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret = OMPI_SUCCESS; + OMPI_MPI_OFFSET_TYPE prev_offset; + + ompio_io_ompio_file_get_position (fp, &prev_offset ); + ompi_io_ompio_set_explicit_offset (fp, offset); + + if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) { + ret = fp->f_fcoll->fcoll_file_iread_all (fp, + buf, + count, + datatype, + request); + } + else { + /* this fcoll component does not support non-blocking + collective I/O operations. WE fake it with + individual non-blocking I/O operations. */ + ret = mca_common_ompio_file_iread ( fp, buf, count, datatype, request ); + } + + + ompi_io_ompio_set_explicit_offset (fp, prev_offset); + return ret; +} diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c new file mode 100644 index 0000000000..c633a14de4 --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -0,0 +1,448 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2016 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 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 + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/info/info.h" +#include "ompi/file/file.h" +#include "ompi/mca/fcoll/fcoll.h" +#include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/fbtl/base/base.h" + +#include "common_ompio.h" +#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/io/ompio/io_ompio_request.h" +#include "math.h" +#include + +int mca_common_ompio_file_write (mca_io_ompio_file_t *fh, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t *status) +{ + int ret = OMPI_SUCCESS; + int index = 0; + int cycles = 0; + + uint32_t iov_count = 0; + struct iovec *decoded_iov = NULL; + size_t bytes_per_cycle=0; + size_t total_bytes_written = 0; + size_t max_data=0, real_bytes_written=0; + ssize_t ret_code=0; + int i = 0; /* index into the decoded iovec of the buffer */ + int j = 0; /* index into the file view iovec */ + + if ( 0 == count ) { + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = 0; + } + return ret; + } + + ompi_io_ompio_decode_datatype (fh, + datatype, + count, + buf, + &max_data, + &decoded_iov, + &iov_count); + + if ( -1 == mca_io_ompio_cycle_buffer_size ) { + bytes_per_cycle = max_data; + } + else { + bytes_per_cycle = mca_io_ompio_cycle_buffer_size; + } + cycles = ceil((float)max_data/bytes_per_cycle); + +#if 0 + printf ("Bytes per Cycle: %d Cycles: %d\n", bytes_per_cycle, cycles); +#endif + + j = fh->f_index_in_file_view; + for (index = 0; index < cycles; index++) { + mca_common_ompio_build_io_array ( fh, + index, + cycles, + bytes_per_cycle, + max_data, + iov_count, + decoded_iov, + &i, + &j, + &total_bytes_written); + + if (fh->f_num_of_io_entries) { + ret_code =fh->f_fbtl->fbtl_pwritev (fh); + if ( 0<= ret_code ) { + real_bytes_written+= (size_t)ret_code; + } + } + + fh->f_num_of_io_entries = 0; + if (NULL != fh->f_io_array) { + free (fh->f_io_array); + fh->f_io_array = NULL; + } + } + + if (NULL != decoded_iov) { + free (decoded_iov); + decoded_iov = NULL; + } + + if ( MPI_STATUS_IGNORE != status ) { + status->_ucount = real_bytes_written; + } + + return ret; +} + +int mca_common_ompio_file_write_at (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t *status) +{ + 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); + ret = mca_common_ompio_file_write (fh, + buf, + 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; +} + +int mca_common_ompio_file_iwrite (mca_io_ompio_file_t *fh, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret = OMPI_SUCCESS; + mca_ompio_request_t *ompio_req=NULL; + + ompio_req = OBJ_NEW(mca_ompio_request_t); + ompio_req->req_type = MCA_OMPIO_REQUEST_WRITE; + ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE; + + if ( 0 == count ) { + ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; + ompio_req->req_ompi.req_status._ucount = 0; + ompi_request_complete (&ompio_req->req_ompi, false); + *request = (ompi_request_t *) ompio_req; + + return OMPI_SUCCESS; + } + + if ( NULL != fh->f_fbtl->fbtl_ipwritev ) { + /* This fbtl has support for non-blocking operations */ + + uint32_t iov_count = 0; + struct iovec *decoded_iov = NULL; + size_t max_data = 0; + size_t total_bytes_written =0; + int i = 0; /* index into the decoded iovec of the buffer */ + int j = 0; /* index into the file vie iovec */ + + ompi_io_ompio_decode_datatype (fh, + datatype, + count, + buf, + &max_data, + &decoded_iov, + &iov_count); + j = fh->f_index_in_file_view; + + /* Non blocking operations have to occur in a single cycle */ + mca_common_ompio_build_io_array ( fh, + 0, // index of current cycle iteration + 1, // number of cycles + max_data, // setting bytes_per_cycle to max_data + max_data, + iov_count, + decoded_iov, + &i, + &j, + &total_bytes_written); + + if (fh->f_num_of_io_entries) { + fh->f_fbtl->fbtl_ipwritev (fh, (ompi_request_t *) ompio_req); + } + + if ( false == mca_io_ompio_progress_is_registered ) { + // Lazy initialization of progress function to minimize impact + // on other ompi functionality in case its not used. + opal_progress_register (mca_io_ompio_component_progress); + mca_io_ompio_progress_is_registered=true; + } + + fh->f_num_of_io_entries = 0; + if (NULL != fh->f_io_array) { + free (fh->f_io_array); + fh->f_io_array = NULL; + } + if (NULL != decoded_iov) { + free (decoded_iov); + decoded_iov = NULL; + } + } + else { + // This fbtl does not support non-blocking write operations + ompi_status_public_t status; + ret = mca_common_ompio_file_write(fh,buf,count,datatype, &status); + + ompio_req->req_ompi.req_status.MPI_ERROR = ret; + ompio_req->req_ompi.req_status._ucount = status._ucount; + ompi_request_complete (&ompio_req->req_ompi, false); + } + + *request = (ompi_request_t *) ompio_req; + return ret; +} + +int mca_common_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + 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); + ret = mca_common_ompio_file_iwrite (fh, + buf, + 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 have + ** already been constructed in the file_iwrite operation + */ + ompi_io_ompio_set_explicit_offset (fh, prev_offset); + + return ret; +} + +/* Collective operations */ +/******************************************************************/ + +int mca_common_ompio_file_write_at_all (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t *status) +{ + 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); + ret = fh->f_fcoll->fcoll_file_write_all (fh, + buf, + count, + datatype, + status); + + ompi_io_ompio_set_explicit_offset (fh, prev_offset); + return ret; +} + +int mca_common_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fp, + OMPI_MPI_OFFSET_TYPE offset, + const void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + + int ret = OMPI_SUCCESS; + OMPI_MPI_OFFSET_TYPE prev_offset; + + ompio_io_ompio_file_get_position (fp, &prev_offset ); + + ompi_io_ompio_set_explicit_offset (fp, offset); + + if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) { + ret = fp->f_fcoll->fcoll_file_iwrite_all (fp, + buf, + count, + datatype, + request); + } + else { + /* this fcoll component does not support non-blocking + collective I/O operations. WE fake it with + individual non-blocking I/O operations. */ + ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request ); + } + + ompi_io_ompio_set_explicit_offset (fp, prev_offset); + return ret; +} + + +/* Helper function used by both read and write operations */ +/**************************************************************/ + +int mca_common_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cycles, + size_t bytes_per_cycle, int max_data, uint32_t iov_count, + struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw ) +{ + OPAL_PTRDIFF_TYPE disp; + int block = 1; + size_t total_bytes_written = *tbw; /* total bytes that have been written*/ + size_t bytes_to_write_in_cycle = 0; /* left to be written in a cycle*/ + size_t sum_previous_counts = 0; + size_t sum_previous_length = 0; + int k = 0; /* index into the io_array */ + int i = *ii; + int j = *jj; + + sum_previous_length = fh->f_position_in_file_view; + + if ((index == cycles-1) && (max_data % bytes_per_cycle)) { + bytes_to_write_in_cycle = max_data % bytes_per_cycle; + } + else { + bytes_to_write_in_cycle = bytes_per_cycle; + } + + fh->f_io_array = (mca_io_ompio_io_array_t *)malloc + (OMPIO_IOVEC_INITIAL_SIZE * sizeof (mca_io_ompio_io_array_t)); + if (NULL == fh->f_io_array) { + opal_output(1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + + while (bytes_to_write_in_cycle) { + /* reallocate if needed */ + if (OMPIO_IOVEC_INITIAL_SIZE*block <= k) { + block ++; + fh->f_io_array = (mca_io_ompio_io_array_t *)realloc + (fh->f_io_array, OMPIO_IOVEC_INITIAL_SIZE * + block * sizeof (mca_io_ompio_io_array_t)); + if (NULL == fh->f_io_array) { + opal_output(1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + } + + if (decoded_iov[i].iov_len - + (total_bytes_written - sum_previous_counts) <= 0) { + sum_previous_counts += decoded_iov[i].iov_len; + i = i + 1; + } + + disp = (OPAL_PTRDIFF_TYPE)decoded_iov[i].iov_base + + (total_bytes_written - sum_previous_counts); + fh->f_io_array[k].memory_address = (IOVBASE_TYPE *)disp; + + if (decoded_iov[i].iov_len - + (total_bytes_written - sum_previous_counts) >= + bytes_to_write_in_cycle) { + fh->f_io_array[k].length = bytes_to_write_in_cycle; + } + else { + fh->f_io_array[k].length = decoded_iov[i].iov_len - + (total_bytes_written - sum_previous_counts); + } + + if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) { + if (fh->f_decoded_iov[j].iov_len - + (fh->f_total_bytes - sum_previous_length) <= 0) { + sum_previous_length += fh->f_decoded_iov[j].iov_len; + j = j + 1; + if (j == (int)fh->f_iov_count) { + j = 0; + sum_previous_length = 0; + fh->f_offset += fh->f_view_extent; + fh->f_position_in_file_view = sum_previous_length; + fh->f_index_in_file_view = j; + fh->f_total_bytes = 0; + } + } + } + + disp = (OPAL_PTRDIFF_TYPE)fh->f_decoded_iov[j].iov_base + + (fh->f_total_bytes - sum_previous_length); + fh->f_io_array[k].offset = (IOVBASE_TYPE *)(intptr_t)(disp + fh->f_offset); + + if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) { + if (fh->f_decoded_iov[j].iov_len - + (fh->f_total_bytes - sum_previous_length) + < fh->f_io_array[k].length) { + fh->f_io_array[k].length = fh->f_decoded_iov[j].iov_len - + (fh->f_total_bytes - sum_previous_length); + } + } + + total_bytes_written += fh->f_io_array[k].length; + fh->f_total_bytes += fh->f_io_array[k].length; + bytes_to_write_in_cycle -= fh->f_io_array[k].length; + k = k + 1; + } + fh->f_position_in_file_view = sum_previous_length; + fh->f_index_in_file_view = j; + fh->f_num_of_io_entries = k; + +#if 0 + if (fh->f_rank == 0) { + int d; + printf("*************************** %d\n", fh->f_num_of_io_entries); + + for (d=0 ; df_num_of_io_entries ; d++) { + printf(" ADDRESS: %p OFFSET: %p LENGTH: %d\n", + fh->f_io_array[d].memory_address, + fh->f_io_array[d].offset, + fh->f_io_array[d].length); + } + } +#endif + *ii = i; + *jj = j; + *tbw = total_bytes_written; + + return OMPI_SUCCESS; +} + diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.c b/ompi/mca/common/ompio/common_ompio_print_queue.c index 75831272b2..7b2be822bf 100644 --- a/ompi/mca/common/ompio/common_ompio_print_queue.c +++ b/ompi/mca/common/ompio/common_ompio_print_queue.c @@ -25,15 +25,16 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/common/ompio/common_ompio.h" +#include "ompi/mca/io/ompio/io_ompio.h" /* Print queue related function implementations */ -int mca_common_ompio_initialize_print_queue( mca_common_ompio_print_queue **r){ +int mca_common_ompio_initialize_print_queue( struct mca_common_ompio_print_queue **r){ - mca_common_ompio_print_queue *q=NULL; + struct mca_common_ompio_print_queue *q=NULL; int ret = OMPI_SUCCESS; - q = (mca_common_ompio_print_queue *) malloc ( sizeof(mca_common_ompio_print_queue)); + q = (struct mca_common_ompio_print_queue *) malloc ( sizeof(mca_common_ompio_print_queue)); if ( NULL == q ) { ret = OMPI_ERR_OUT_OF_RESOURCE; } @@ -45,8 +46,8 @@ int mca_common_ompio_initialize_print_queue( mca_common_ompio_print_queue **r){ return ret; } -int mca_common_ompio_register_print_entry ( mca_common_ompio_print_queue *q, - mca_common_ompio_print_entry x) +int mca_common_ompio_register_print_entry ( struct mca_common_ompio_print_queue *q, + mca_common_ompio_print_entry x) { if (q->count >= MCA_COMMON_OMPIO_QUEUESIZE){ return OMPI_ERROR; @@ -60,7 +61,7 @@ int mca_common_ompio_register_print_entry ( mca_common_ompio_print_queue *q, return OMPI_SUCCESS; } -int mca_common_ompio_unregister_print_entry ( mca_common_ompio_print_queue *q, +int mca_common_ompio_unregister_print_entry ( struct mca_common_ompio_print_queue *q, mca_common_ompio_print_entry *x) { @@ -76,7 +77,7 @@ int mca_common_ompio_unregister_print_entry ( mca_common_ompio_print_queue *q, return OMPI_SUCCESS; } -int mca_common_ompio_empty_print_queue(mca_common_ompio_print_queue *q) +int mca_common_ompio_empty_print_queue( struct mca_common_ompio_print_queue *q) { if (q->count == 0) { return 1; @@ -85,7 +86,7 @@ int mca_common_ompio_empty_print_queue(mca_common_ompio_print_queue *q) return 0; } -int mca_common_ompio_full_print_queue(mca_common_ompio_print_queue *q) +int mca_common_ompio_full_print_queue( struct mca_common_ompio_print_queue *q) { if (q->count < MCA_COMMON_OMPIO_QUEUESIZE) { return 0; @@ -95,7 +96,7 @@ int mca_common_ompio_full_print_queue(mca_common_ompio_print_queue *q) } -int mca_common_ompio_print_time_info( mca_common_ompio_print_queue *q, +int mca_common_ompio_print_time_info( struct mca_common_ompio_print_queue *q, char *name, struct mca_io_ompio_file_t *fh){ diff --git a/ompi/mca/common/ompio/common_ompio_print_queue.h b/ompi/mca/common/ompio/common_ompio_print_queue.h index deb869eeee..ba74e30a55 100644 --- a/ompi/mca/common/ompio/common_ompio_print_queue.h +++ b/ompi/mca/common/ompio/common_ompio_print_queue.h @@ -32,33 +32,36 @@ struct mca_io_ompio_file_t; #define MCA_COMMON_OMPIO_QUEUESIZE 2048 /*To extract time-information */ -typedef struct { +struct mca_common_ompio_print_entry{ double time[3]; int nprocs_for_coll; int aggregator; -}mca_common_ompio_print_entry; +}; -typedef struct { +typedef struct mca_common_ompio_print_entry mca_common_ompio_print_entry; + +struct mca_common_ompio_print_queue { mca_common_ompio_print_entry entry[MCA_COMMON_OMPIO_QUEUESIZE + 1]; int first; int last; int count; -} mca_common_ompio_print_queue; +}; +typedef struct mca_common_ompio_print_queue mca_common_ompio_print_queue; -OMPI_DECLSPEC int mca_common_ompio_register_print_entry (mca_common_ompio_print_queue *q, +OMPI_DECLSPEC int mca_common_ompio_register_print_entry (struct mca_common_ompio_print_queue *q, mca_common_ompio_print_entry x); -OMPI_DECLSPEC int mca_common_ompio_unregister_print_entry (mca_common_ompio_print_queue *q, +OMPI_DECLSPEC int mca_common_ompio_unregister_print_entry (struct mca_common_ompio_print_queue *q, mca_common_ompio_print_entry *x); -OMPI_DECLSPEC int mca_common_ompio_empty_print_queue(mca_common_ompio_print_queue *q); +OMPI_DECLSPEC int mca_common_ompio_empty_print_queue( struct mca_common_ompio_print_queue *q); -OMPI_DECLSPEC int mca_common_ompio_full_print_queue(mca_common_ompio_print_queue *q); +OMPI_DECLSPEC int mca_common_ompio_full_print_queue( struct mca_common_ompio_print_queue *q); -OMPI_DECLSPEC int mca_common_ompio_initialize_print_queue(mca_common_ompio_print_queue **q); +OMPI_DECLSPEC int mca_common_ompio_initialize_print_queue(struct mca_common_ompio_print_queue **q); -OMPI_DECLSPEC int mca_common_ompio_print_time_info( mca_common_ompio_print_queue *q, +OMPI_DECLSPEC int mca_common_ompio_print_time_info( struct mca_common_ompio_print_queue *q, char *name_operation, struct mca_io_ompio_file_t *fh); diff --git a/ompi/mca/fbtl/base/fbtl_base_file_select.c b/ompi/mca/fbtl/base/fbtl_base_file_select.c index 36393fc6d9..1c133ace6a 100644 --- a/ompi/mca/fbtl/base/fbtl_base_file_select.c +++ b/ompi/mca/fbtl/base/fbtl_base_file_select.c @@ -27,7 +27,7 @@ #include "opal/mca/base/base.h" #include "ompi/mca/fbtl/fbtl.h" #include "ompi/mca/fbtl/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" /* * This structure is needed so that we can close the modules diff --git a/ompi/mca/fbtl/base/fbtl_base_file_unselect.c b/ompi/mca/fbtl/base/fbtl_base_file_unselect.c index 280965f934..bf54f6c802 100644 --- a/ompi/mca/fbtl/base/fbtl_base_file_unselect.c +++ b/ompi/mca/fbtl/base/fbtl_base_file_unselect.c @@ -24,12 +24,12 @@ #include #include "mpi.h" -#include "ompi/mca/io/ompio/io_ompio.h" #include "opal/util/show_help.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/mca/fbtl/fbtl.h" #include "ompi/mca/fbtl/base/base.h" +#include "ompi/mca/common/ompio/common_ompio.h" int mca_fbtl_base_file_unselect(mca_io_ompio_file_t *file) { diff --git a/ompi/mca/fbtl/plfs/fbtl_plfs.h b/ompi/mca/fbtl/plfs/fbtl_plfs.h index 40173b2524..dc1f4ea785 100644 --- a/ompi/mca/fbtl/plfs/fbtl_plfs.h +++ b/ompi/mca/fbtl/plfs/fbtl_plfs.h @@ -23,7 +23,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fbtl/fbtl.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include extern int mca_fbtl_plfs_priority; diff --git a/ompi/mca/fbtl/posix/fbtl_posix.h b/ompi/mca/fbtl/posix/fbtl_posix.h index df6fd29e4f..9111cba761 100644 --- a/ompi/mca/fbtl/posix/fbtl_posix.h +++ b/ompi/mca/fbtl/posix/fbtl_posix.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +23,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fbtl/fbtl.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include "ompi/mca/io/ompio/io_ompio_request.h" extern int mca_fbtl_posix_priority; diff --git a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2.h b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2.h index eab4e2c1dd..270d8e7b81 100644 --- a/ompi/mca/fbtl/pvfs2/fbtl_pvfs2.h +++ b/ompi/mca/fbtl/pvfs2/fbtl_pvfs2.h @@ -23,7 +23,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fbtl/fbtl.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include "ompi/mca/fs/pvfs2/fs_pvfs2.h" #include "pvfs2.h" #include "pvfs2-compat.h" diff --git a/ompi/mca/fcoll/base/fcoll_base_coll_array.c b/ompi/mca/fcoll/base/fcoll_base_coll_array.c index a903a43cd2..4b334f1331 100644 --- a/ompi/mca/fcoll/base/fcoll_base_coll_array.c +++ b/ompi/mca/fcoll/base/fcoll_base_coll_array.c @@ -29,7 +29,7 @@ #include #include "ompi/mca/fcoll/base/fcoll_base_coll_array.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" int fcoll_base_coll_allgatherv_array (void *sbuf, diff --git a/ompi/mca/fcoll/base/fcoll_base_file_select.c b/ompi/mca/fcoll/base/fcoll_base_file_select.c index 3c260074f2..b0a410937a 100644 --- a/ompi/mca/fcoll/base/fcoll_base_file_select.c +++ b/ompi/mca/fcoll/base/fcoll_base_file_select.c @@ -27,7 +27,7 @@ #include "opal/mca/base/base.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" /* * This structure is needed so that we can close the modules diff --git a/ompi/mca/fcoll/base/fcoll_base_file_unselect.c b/ompi/mca/fcoll/base/fcoll_base_file_unselect.c index b4b614ca8f..db70a84cae 100644 --- a/ompi/mca/fcoll/base/fcoll_base_file_unselect.c +++ b/ompi/mca/fcoll/base/fcoll_base_file_unselect.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-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,12 +24,12 @@ #include #include "mpi.h" -#include "ompi/mca/io/ompio/io_ompio.h" #include "opal/util/show_help.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/common/ompio/common_ompio.h" int mca_fcoll_base_file_unselect(mca_io_ompio_file_t *file) { diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic.h b/ompi/mca/fcoll/dynamic/fcoll_dynamic.h index 4ca2cab823..eaa634c93b 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic.h +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic.h @@ -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-2014 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -28,7 +28,7 @@ #include "ompi/mca/mca.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2.h b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2.h index dfd8d16e92..7c83b42e17 100644 --- a/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2.h +++ b/ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2.h @@ -28,7 +28,7 @@ #include "ompi/mca/mca.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/fcoll/individual/fcoll_individual.h b/ompi/mca/fcoll/individual/fcoll_individual.h index 298fae795b..26fb833fb6 100644 --- a/ompi/mca/fcoll/individual/fcoll_individual.h +++ b/ompi/mca/fcoll/individual/fcoll_individual.h @@ -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-2014 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -28,7 +28,7 @@ #include "ompi/mca/mca.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS 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 bde6f9a92d..127080b2b7 100644 --- a/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c +++ b/ompi/mca/fcoll/individual/fcoll_individual_file_read_all.c @@ -23,8 +23,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "ompi/mca/fcoll/fcoll.h" -#include "ompi/mca/io/ompio/io_ompio.h" -#include "ompi/mca/io/io.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include "math.h" #include @@ -38,5 +37,5 @@ mca_fcoll_individual_file_read_all (mca_io_ompio_file_t *fh, struct ompi_datatype_t *datatype, ompi_status_public_t *status) { - return ompio_io_ompio_file_read( fh, buf, count, datatype, status); + return mca_common_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 8b4b6fa881..550fca715b 100644 --- a/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c +++ b/ompi/mca/fcoll/individual/fcoll_individual_file_write_all.c @@ -25,8 +25,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "ompi/mca/fcoll/fcoll.h" -#include "ompi/mca/io/ompio/io_ompio.h" -#include "ompi/mca/io/io.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include "math.h" #include @@ -37,5 +36,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 ompio_io_ompio_file_write (fh, buf, count, datatype, status); + return mca_common_ompio_file_write (fh, buf, count, datatype, status); } diff --git a/ompi/mca/fcoll/static/fcoll_static.h b/ompi/mca/fcoll/static/fcoll_static.h index 91a9dd4900..e21574bb6f 100644 --- a/ompi/mca/fcoll/static/fcoll_static.h +++ b/ompi/mca/fcoll/static/fcoll_static.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -28,7 +28,7 @@ #include "ompi/mca/mca.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase.h b/ompi/mca/fcoll/two_phase/fcoll_two_phase.h index 8ffa620812..942cd85793 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase.h +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase.h @@ -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-2014 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -28,7 +28,7 @@ #include "ompi/mca/mca.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/fs/base/fs_base_file_select.c b/ompi/mca/fs/base/fs_base_file_select.c index 6d91087b7d..f0927cdf3c 100644 --- a/ompi/mca/fs/base/fs_base_file_select.c +++ b/ompi/mca/fs/base/fs_base_file_select.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-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,7 +27,7 @@ #include "opal/mca/base/base.h" #include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" /* * This structure is needed so that we can close the modules diff --git a/ompi/mca/fs/base/fs_base_file_unselect.c b/ompi/mca/fs/base/fs_base_file_unselect.c index 1252bc2497..7b6bbd8267 100644 --- a/ompi/mca/fs/base/fs_base_file_unselect.c +++ b/ompi/mca/fs/base/fs_base_file_unselect.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-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,13 +24,14 @@ #include #include "mpi.h" -#include "ompi/mca/io/ompio/io_ompio.h" #include "opal/util/show_help.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/base/base.h" +#include "ompi/mca/common/ompio/common_ompio.h" + int mca_fs_base_file_unselect(mca_io_ompio_file_t *file) { if (NULL != file->f_fs && NULL != file->f_fs->fs_module_finalize) { diff --git a/ompi/mca/fs/base/fs_base_get_parent_dir.c b/ompi/mca/fs/base/fs_base_get_parent_dir.c index fb1d8ef814..bad67cac90 100644 --- a/ompi/mca/fs/base/fs_base_get_parent_dir.c +++ b/ompi/mca/fs/base/fs_base_get_parent_dir.c @@ -29,7 +29,7 @@ #include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #ifdef HAVE_SYS_STATFS_H #include /* or */ diff --git a/ompi/mca/fs/lustre/fs_lustre.h b/ompi/mca/fs/lustre/fs_lustre.h index ad4844c618..8e36a3933f 100644 --- a/ompi/mca/fs/lustre/fs_lustre.h +++ b/ompi/mca/fs/lustre/fs_lustre.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fs/fs.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" extern int mca_fs_lustre_priority; extern int mca_fs_lustre_stripe_size; diff --git a/ompi/mca/fs/plfs/fs_plfs.h b/ompi/mca/fs/plfs/fs_plfs.h index 69221d4c9b..755a8c6b8c 100644 --- a/ompi/mca/fs/plfs/fs_plfs.h +++ b/ompi/mca/fs/plfs/fs_plfs.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fs/fs.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2.h b/ompi/mca/fs/pvfs2/fs_pvfs2.h index a2e372770c..01bc4efa66 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2.h +++ b/ompi/mca/fs/pvfs2/fs_pvfs2.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -36,7 +36,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fs/fs.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" extern int mca_fs_pvfs2_priority; extern int mca_fs_pvfs2_stripe_size; diff --git a/ompi/mca/fs/ufs/fs_ufs.h b/ompi/mca/fs/ufs/fs_ufs.h index daebc5d505..66ec4c6ce2 100644 --- a/ompi/mca/fs/ufs/fs_ufs.h +++ b/ompi/mca/fs/ufs/fs_ufs.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/fs/fs.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" extern int mca_fs_ufs_priority; diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 4477d21d91..60b2fea826 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -41,7 +41,6 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" -#include "ompi/mca/common/ompio/common_ompio.h" extern int mca_io_ompio_cycle_buffer_size; extern int mca_io_ompio_bytes_per_agg; @@ -219,6 +218,7 @@ typedef int (*mca_io_ompio_set_aggregator_props_fn_t) (struct mca_io_ompio_file_ size_t bytes_per_proc); +struct mca_common_ompio_print_queue; /** * Back-end structure for MPI_File @@ -289,8 +289,8 @@ struct mca_io_ompio_file_t { mca_sharedfp_base_module_t *f_sharedfp; /* Timing information */ - mca_common_ompio_print_queue *f_coll_write_time; - mca_common_ompio_print_queue *f_coll_read_time; + struct mca_common_ompio_print_queue *f_coll_write_time; + struct mca_common_ompio_print_queue *f_coll_read_time; /*initial list of aggregators and groups*/ int *f_init_aggr_list; @@ -320,17 +320,15 @@ struct mca_io_ompio_data_t { typedef struct mca_io_ompio_data_t mca_io_ompio_data_t; +#include "ompi/mca/common/ompio/common_ompio.h" + + /* functions to retrieve the number of aggregators and the size of the temporary buffer on aggregators from the fcoll modules */ OMPI_DECLSPEC void mca_io_ompio_get_num_aggregators ( int *num_aggregators); OMPI_DECLSPEC void mca_io_ompio_get_bytes_per_agg ( int *bytes_per_agg); -OMPI_DECLSPEC int mca_io_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cycles, - size_t bpc, int max_data, uint32_t iov_count, - struct iovec *decoded_iov, int *ii, int *jj, - size_t *tbw ); - OMPI_DECLSPEC int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh); OMPI_DECLSPEC int ompio_io_ompio_file_open (ompi_communicator_t *comm, @@ -339,82 +337,9 @@ OMPI_DECLSPEC int ompio_io_ompio_file_open (ompi_communicator_t *comm, ompi_info_t *info, mca_io_ompio_file_t *fh,bool use_sharedfp); -OMPI_DECLSPEC int ompio_io_ompio_file_write_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status); - -OMPI_DECLSPEC int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status); - OMPI_DECLSPEC int ompio_io_ompio_file_close (mca_io_ompio_file_t *fh); -OMPI_DECLSPEC int ompio_io_ompio_file_write_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status); -OMPI_DECLSPEC int ompio_io_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); - -OMPI_DECLSPEC int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); - -OMPI_DECLSPEC int ompio_io_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); -OMPI_DECLSPEC int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); - -OMPI_DECLSPEC int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status); -OMPI_DECLSPEC int ompio_io_ompio_file_iread_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); -OMPI_DECLSPEC int ompio_io_ompio_file_iread_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request); -OMPI_DECLSPEC int ompio_io_ompio_file_read_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t * status); -OMPI_DECLSPEC int ompio_io_ompio_file_read_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t * status); OMPI_DECLSPEC int ompio_io_ompio_file_get_size (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE *size); diff --git a/ompi/mca/io/ompio/io_ompio_file_read.c b/ompi/mca/io/ompio/io_ompio_file_read.c index d60c181912..4f2ef58255 100644 --- a/ompi/mca/io/ompio/io_ompio_file_read.c +++ b/ompi/mca/io/ompio/io_ompio_file_read.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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,102 +59,7 @@ int mca_io_ompio_file_read (ompi_file_t *fp, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fp->f_io_selected_data; - ret = ompio_io_ompio_file_read(&data->ompio_fh,buf,count,datatype,status); - - return ret; -} - -int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status) -{ - int ret = OMPI_SUCCESS; - - size_t total_bytes_read = 0; /* total bytes that have been read*/ - size_t bytes_per_cycle = 0; /* total read in each cycle by each process*/ - int index = 0; - int cycles = 0; - - uint32_t iov_count = 0; - struct iovec *decoded_iov = NULL; - - size_t max_data=0, real_bytes_read=0; - ssize_t ret_code=0; - int i = 0; /* index into the decoded iovec of the buffer */ - int j = 0; /* index into the file vie iovec */ - - if ( 0 == count ) { - if ( MPI_STATUS_IGNORE != status ) { - status->_ucount = 0; - } - return ret; - } - - if (fh->f_amode & MPI_MODE_WRONLY){ - printf("Improper use of FILE Mode, Using WRONLY for Read!\n"); - ret = OMPI_ERROR; - return ret; - } - - ompi_io_ompio_decode_datatype (fh, - datatype, - count, - buf, - &max_data, - &decoded_iov, - &iov_count); - - if ( -1 == mca_io_ompio_cycle_buffer_size ) { - bytes_per_cycle = max_data; - } - else { - bytes_per_cycle = mca_io_ompio_cycle_buffer_size; - } - cycles = ceil((float)max_data/bytes_per_cycle); - -#if 0 - printf ("Bytes per Cycle: %d Cycles: %d max_data:%d \n",bytes_per_cycle, cycles, max_data); -#endif - - j = fh->f_index_in_file_view; - - for (index = 0; index < cycles; index++) { - - mca_io_ompio_build_io_array ( fh, - index, - cycles, - bytes_per_cycle, - max_data, - iov_count, - decoded_iov, - &i, - &j, - &total_bytes_read); - - if (fh->f_num_of_io_entries) { - ret_code = fh->f_fbtl->fbtl_preadv (fh); - if ( 0<= ret_code ) { - real_bytes_read+=(size_t)ret_code; - } - } - - fh->f_num_of_io_entries = 0; - if (NULL != fh->f_io_array) { - free (fh->f_io_array); - fh->f_io_array = NULL; - } - } - - if (NULL != decoded_iov) { - free (decoded_iov); - decoded_iov = NULL; - } - - if ( MPI_STATUS_IGNORE != status ) { - status->_ucount = real_bytes_read; - } + ret = mca_common_ompio_file_read(&data->ompio_fh,buf,count,datatype,status); return ret; } @@ -170,39 +75,11 @@ int mca_io_ompio_file_read_at (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_read_at(&data->ompio_fh, offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at(&data->ompio_fh, offset,buf,count,datatype,status); return ret; } -int ompio_io_ompio_file_read_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t * status) -{ - 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); - ret = ompio_io_ompio_file_read (fh, - buf, - 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; -} - - int mca_io_ompio_file_iread (ompi_file_t *fh, void *buf, int count, @@ -213,103 +90,12 @@ int mca_io_ompio_file_iread (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_iread(&data->ompio_fh,buf,count,datatype,request); + ret = mca_common_ompio_file_iread(&data->ompio_fh,buf,count,datatype,request); return ret; } -int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - int ret = OMPI_SUCCESS; - mca_ompio_request_t *ompio_req=NULL; - - ompio_req = OBJ_NEW(mca_ompio_request_t); - ompio_req->req_type = MCA_OMPIO_REQUEST_READ; - ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE; - - if ( 0 == count ) { - ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; - ompio_req->req_ompi.req_status._ucount = 0; - ompi_request_complete (&ompio_req->req_ompi, false); - *request = (ompi_request_t *) ompio_req; - - return OMPI_SUCCESS; - } - - if ( NULL != fh->f_fbtl->fbtl_ipreadv ) { - // This fbtl has support for non-blocking operations - - size_t total_bytes_read = 0; /* total bytes that have been read*/ - uint32_t iov_count = 0; - struct iovec *decoded_iov = NULL; - - size_t max_data = 0; - int i = 0; /* index into the decoded iovec of the buffer */ - int j = 0; /* index into the file vie iovec */ - - ompi_io_ompio_decode_datatype (fh, - datatype, - count, - buf, - &max_data, - &decoded_iov, - &iov_count); - - // Non-blocking operations have to occur in a single cycle - j = fh->f_index_in_file_view; - - mca_io_ompio_build_io_array ( fh, - 0, // index - 1, // no. of cyces - max_data, // setting bytes per cycle to match data - max_data, - iov_count, - decoded_iov, - &i, - &j, - &total_bytes_read); - - if (fh->f_num_of_io_entries) { - fh->f_fbtl->fbtl_ipreadv (fh, (ompi_request_t *) ompio_req); - } - - if ( false == mca_io_ompio_progress_is_registered ) { - // Lazy initialization of progress function to minimize impact - // on other ompi functionality in case its not used. - opal_progress_register (mca_io_ompio_component_progress); - mca_io_ompio_progress_is_registered=true; - } - - fh->f_num_of_io_entries = 0; - if (NULL != fh->f_io_array) { - free (fh->f_io_array); - fh->f_io_array = NULL; - } - - if (NULL != decoded_iov) { - free (decoded_iov); - decoded_iov = NULL; - } - } - else { - // This fbtl does not support non-blocking operations - ompi_status_public_t status; - ret = ompio_io_ompio_file_read (fh, buf, count, datatype, &status); - - ompio_req->req_ompi.req_status.MPI_ERROR = ret; - ompio_req->req_ompi.req_status._ucount = status._ucount; - ompi_request_complete (&ompio_req->req_ompi, false); - } - - *request = (ompi_request_t *) ompio_req; - return ret; -} - int mca_io_ompio_file_iread_at (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, void *buf, @@ -321,38 +107,7 @@ int mca_io_ompio_file_iread_at (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_iread_at(&data->ompio_fh,offset,buf,count,datatype,request); - - return ret; -} - -int ompio_io_ompio_file_iread_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - 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); - ret = ompio_io_ompio_file_iread (fh, - buf, - 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 have - ** already been constructed in the file_iread operation - */ - ompi_io_ompio_set_explicit_offset (fh, prev_offset); + ret = mca_common_ompio_file_iread_at(&data->ompio_fh,offset,buf,count,datatype,request); return ret; } @@ -411,7 +166,7 @@ int mca_io_ompio_file_iread_all (ompi_file_t *fh, /* this fcoll component does not support non-blocking collective I/O operations. WE fake it with individual non-blocking I/O operations. */ - ret = ompio_io_ompio_file_iread ( fp, buf, count, datatype, request ); + ret = mca_common_ompio_file_iread ( fp, buf, count, datatype, request ); } return ret; @@ -429,33 +184,11 @@ int mca_io_ompio_file_read_at_all (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_read_at_all(&data->ompio_fh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at_all(&data->ompio_fh,offset,buf,count,datatype,status); return ret; } -int ompio_io_ompio_file_read_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t * status) -{ - 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); - ret = fh->f_fcoll->fcoll_file_read_all (fh, - buf, - count, - datatype, - status); - - ompi_io_ompio_set_explicit_offset (fh, prev_offset); - return ret; -} - int mca_io_ompio_file_iread_at_all (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, void *buf, @@ -467,41 +200,10 @@ int mca_io_ompio_file_iread_at_all (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_iread_at_all ( &data->ompio_fh, offset, buf, count, datatype, request ); + ret = mca_common_ompio_file_iread_at_all ( &data->ompio_fh, offset, buf, count, datatype, request ); return ret; } -int ompio_io_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, - OMPI_MPI_OFFSET_TYPE offset, - void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - int ret = OMPI_SUCCESS; - OMPI_MPI_OFFSET_TYPE prev_offset; - - ompio_io_ompio_file_get_position (fp, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fp, offset); - - if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) { - ret = fp->f_fcoll->fcoll_file_iread_all (fp, - buf, - count, - datatype, - request); - } - else { - /* this fcoll component does not support non-blocking - collective I/O operations. WE fake it with - individual non-blocking I/O operations. */ - ret = ompio_io_ompio_file_iread ( fp, buf, count, datatype, request ); - } - - - ompi_io_ompio_set_explicit_offset (fp, prev_offset); - return ret; -} /* Infrastructure for shared file pointer operations ** (individual and ordered)*/ @@ -685,7 +387,7 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh, printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n"); return MPI_ERR_REQUEST; } - ret = ompio_io_ompio_file_iread_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req ); + ret = mca_common_ompio_file_iread_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req ); fp->f_split_coll_in_use = true; return ret; } diff --git a/ompi/mca/io/ompio/io_ompio_file_write.c b/ompi/mca/io/ompio/io_ompio_file_write.c index 637cafe863..7b4f674d2c 100644 --- a/ompi/mca/io/ompio/io_ompio_file_write.c +++ b/ompi/mca/io/ompio/io_ompio_file_write.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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -45,7 +45,7 @@ ** routines are the ones registered with the ompio modules. ** The ** -** ompio_io_ompio_file_read/write[_at] +** mca_common_ompio_file_read/write[_at] ** ** routesin are used e.g. from the shared file pointer modules. ** The main difference is, that the first one takes an ompi_file_t @@ -67,94 +67,10 @@ int mca_io_ompio_file_write (ompi_file_t *fp, data = (mca_io_ompio_data_t *) fp->f_io_selected_data; fh = &data->ompio_fh; - ret = ompio_io_ompio_file_write(fh,buf,count,datatype,status); + ret = mca_common_ompio_file_write(fh,buf,count,datatype,status); return ret; } -int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status) -{ - int ret = OMPI_SUCCESS; - int index = 0; - int cycles = 0; - - uint32_t iov_count = 0; - struct iovec *decoded_iov = NULL; - size_t bytes_per_cycle=0; - size_t total_bytes_written = 0; - size_t max_data=0, real_bytes_written=0; - ssize_t ret_code=0; - int i = 0; /* index into the decoded iovec of the buffer */ - int j = 0; /* index into the file view iovec */ - - if ( 0 == count ) { - if ( MPI_STATUS_IGNORE != status ) { - status->_ucount = 0; - } - return ret; - } - - ompi_io_ompio_decode_datatype (fh, - datatype, - count, - buf, - &max_data, - &decoded_iov, - &iov_count); - - if ( -1 == mca_io_ompio_cycle_buffer_size ) { - bytes_per_cycle = max_data; - } - else { - bytes_per_cycle = mca_io_ompio_cycle_buffer_size; - } - cycles = ceil((float)max_data/bytes_per_cycle); - -#if 0 - printf ("Bytes per Cycle: %d Cycles: %d\n", bytes_per_cycle, cycles); -#endif - - j = fh->f_index_in_file_view; - for (index = 0; index < cycles; index++) { - mca_io_ompio_build_io_array ( fh, - index, - cycles, - bytes_per_cycle, - max_data, - iov_count, - decoded_iov, - &i, - &j, - &total_bytes_written); - - if (fh->f_num_of_io_entries) { - ret_code =fh->f_fbtl->fbtl_pwritev (fh); - if ( 0<= ret_code ) { - real_bytes_written+= (size_t)ret_code; - } - } - - fh->f_num_of_io_entries = 0; - if (NULL != fh->f_io_array) { - free (fh->f_io_array); - fh->f_io_array = NULL; - } - } - - if (NULL != decoded_iov) { - free (decoded_iov); - decoded_iov = NULL; - } - - if ( MPI_STATUS_IGNORE != status ) { - status->_ucount = real_bytes_written; - } - - return ret; -} int mca_io_ompio_file_write_at (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, @@ -167,35 +83,11 @@ int mca_io_ompio_file_write_at (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_write_at (&data->ompio_fh, offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at (&data->ompio_fh, offset,buf,count,datatype,status); return ret; } -int ompio_io_ompio_file_write_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status) -{ - 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); - ret = ompio_io_ompio_file_write (fh, - buf, - 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; -} - int mca_io_ompio_file_iwrite (ompi_file_t *fp, const void *buf, int count, @@ -206,98 +98,11 @@ int mca_io_ompio_file_iwrite (ompi_file_t *fp, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fp->f_io_selected_data; - ret = ompio_io_ompio_file_iwrite(&data->ompio_fh,buf,count,datatype,request); + ret = mca_common_ompio_file_iwrite(&data->ompio_fh,buf,count,datatype,request); return ret; } -int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - int ret = OMPI_SUCCESS; - mca_ompio_request_t *ompio_req=NULL; - - ompio_req = OBJ_NEW(mca_ompio_request_t); - ompio_req->req_type = MCA_OMPIO_REQUEST_WRITE; - ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE; - - if ( 0 == count ) { - ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; - ompio_req->req_ompi.req_status._ucount = 0; - ompi_request_complete (&ompio_req->req_ompi, false); - *request = (ompi_request_t *) ompio_req; - - return OMPI_SUCCESS; - } - - if ( NULL != fh->f_fbtl->fbtl_ipwritev ) { - /* This fbtl has support for non-blocking operations */ - - uint32_t iov_count = 0; - struct iovec *decoded_iov = NULL; - size_t max_data = 0; - size_t total_bytes_written =0; - int i = 0; /* index into the decoded iovec of the buffer */ - int j = 0; /* index into the file vie iovec */ - - ompi_io_ompio_decode_datatype (fh, - datatype, - count, - buf, - &max_data, - &decoded_iov, - &iov_count); - j = fh->f_index_in_file_view; - - /* Non blocking operations have to occur in a single cycle */ - mca_io_ompio_build_io_array ( fh, - 0, // index of current cycle iteration - 1, // number of cycles - max_data, // setting bytes_per_cycle to max_data - max_data, - iov_count, - decoded_iov, - &i, - &j, - &total_bytes_written); - - if (fh->f_num_of_io_entries) { - fh->f_fbtl->fbtl_ipwritev (fh, (ompi_request_t *) ompio_req); - } - - if ( false == mca_io_ompio_progress_is_registered ) { - // Lazy initialization of progress function to minimize impact - // on other ompi functionality in case its not used. - opal_progress_register (mca_io_ompio_component_progress); - mca_io_ompio_progress_is_registered=true; - } - - fh->f_num_of_io_entries = 0; - if (NULL != fh->f_io_array) { - free (fh->f_io_array); - fh->f_io_array = NULL; - } - if (NULL != decoded_iov) { - free (decoded_iov); - decoded_iov = NULL; - } - } - else { - // This fbtl does not support non-blocking write operations - ompi_status_public_t status; - ret = ompio_io_ompio_file_write(fh,buf,count,datatype, &status); - - ompio_req->req_ompi.req_status.MPI_ERROR = ret; - ompio_req->req_ompi.req_status._ucount = status._ucount; - ompi_request_complete (&ompio_req->req_ompi, false); - } - - *request = (ompi_request_t *) ompio_req; - return ret; -} int mca_io_ompio_file_iwrite_at (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, @@ -310,165 +115,11 @@ int mca_io_ompio_file_iwrite_at (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_iwrite_at(&data->ompio_fh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iwrite_at(&data->ompio_fh,offset,buf,count,datatype,request); return ret; } -int ompio_io_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - 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); - ret = ompio_io_ompio_file_iwrite (fh, - buf, - 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 have - ** already been constructed in the file_iwrite operation - */ - ompi_io_ompio_set_explicit_offset (fh, prev_offset); - - return ret; -} - -/* Helper function used by both read and write operations */ -/**************************************************************/ - -int mca_io_ompio_build_io_array ( mca_io_ompio_file_t *fh, int index, int cycles, - size_t bytes_per_cycle, int max_data, uint32_t iov_count, - struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw ) -{ - OPAL_PTRDIFF_TYPE disp; - int block = 1; - size_t total_bytes_written = *tbw; /* total bytes that have been written*/ - size_t bytes_to_write_in_cycle = 0; /* left to be written in a cycle*/ - size_t sum_previous_counts = 0; - size_t sum_previous_length = 0; - int k = 0; /* index into the io_array */ - int i = *ii; - int j = *jj; - - sum_previous_length = fh->f_position_in_file_view; - - if ((index == cycles-1) && (max_data % bytes_per_cycle)) { - bytes_to_write_in_cycle = max_data % bytes_per_cycle; - } - else { - bytes_to_write_in_cycle = bytes_per_cycle; - } - - fh->f_io_array = (mca_io_ompio_io_array_t *)malloc - (OMPIO_IOVEC_INITIAL_SIZE * sizeof (mca_io_ompio_io_array_t)); - if (NULL == fh->f_io_array) { - opal_output(1, "OUT OF MEMORY\n"); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - while (bytes_to_write_in_cycle) { - /* reallocate if needed */ - if (OMPIO_IOVEC_INITIAL_SIZE*block <= k) { - block ++; - fh->f_io_array = (mca_io_ompio_io_array_t *)realloc - (fh->f_io_array, OMPIO_IOVEC_INITIAL_SIZE * - block * sizeof (mca_io_ompio_io_array_t)); - if (NULL == fh->f_io_array) { - opal_output(1, "OUT OF MEMORY\n"); - return OMPI_ERR_OUT_OF_RESOURCE; - } - } - - if (decoded_iov[i].iov_len - - (total_bytes_written - sum_previous_counts) <= 0) { - sum_previous_counts += decoded_iov[i].iov_len; - i = i + 1; - } - - disp = (OPAL_PTRDIFF_TYPE)decoded_iov[i].iov_base + - (total_bytes_written - sum_previous_counts); - fh->f_io_array[k].memory_address = (IOVBASE_TYPE *)disp; - - if (decoded_iov[i].iov_len - - (total_bytes_written - sum_previous_counts) >= - bytes_to_write_in_cycle) { - fh->f_io_array[k].length = bytes_to_write_in_cycle; - } - else { - fh->f_io_array[k].length = decoded_iov[i].iov_len - - (total_bytes_written - sum_previous_counts); - } - - if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) { - if (fh->f_decoded_iov[j].iov_len - - (fh->f_total_bytes - sum_previous_length) <= 0) { - sum_previous_length += fh->f_decoded_iov[j].iov_len; - j = j + 1; - if (j == (int)fh->f_iov_count) { - j = 0; - sum_previous_length = 0; - fh->f_offset += fh->f_view_extent; - fh->f_position_in_file_view = sum_previous_length; - fh->f_index_in_file_view = j; - fh->f_total_bytes = 0; - } - } - } - - disp = (OPAL_PTRDIFF_TYPE)fh->f_decoded_iov[j].iov_base + - (fh->f_total_bytes - sum_previous_length); - fh->f_io_array[k].offset = (IOVBASE_TYPE *)(intptr_t)(disp + fh->f_offset); - - if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) { - if (fh->f_decoded_iov[j].iov_len - - (fh->f_total_bytes - sum_previous_length) - < fh->f_io_array[k].length) { - fh->f_io_array[k].length = fh->f_decoded_iov[j].iov_len - - (fh->f_total_bytes - sum_previous_length); - } - } - - total_bytes_written += fh->f_io_array[k].length; - fh->f_total_bytes += fh->f_io_array[k].length; - bytes_to_write_in_cycle -= fh->f_io_array[k].length; - k = k + 1; - } - fh->f_position_in_file_view = sum_previous_length; - fh->f_index_in_file_view = j; - fh->f_num_of_io_entries = k; - -#if 0 - if (fh->f_rank == 0) { - int d; - printf("*************************** %d\n", fh->f_num_of_io_entries); - - for (d=0 ; df_num_of_io_entries ; d++) { - printf(" ADDRESS: %p OFFSET: %p LENGTH: %d\n", - fh->f_io_array[d].memory_address, - fh->f_io_array[d].offset, - fh->f_io_array[d].length); - } - } -#endif - *ii = i; - *jj = j; - *tbw = total_bytes_written; - - return OMPI_SUCCESS; -} /* Collective operations */ /******************************************************************/ @@ -512,7 +163,7 @@ int mca_io_ompio_file_write_at_all (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_write_at_all(&data->ompio_fh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at_all(&data->ompio_fh,offset,buf,count,datatype,status); return ret; } @@ -541,33 +192,12 @@ int mca_io_ompio_file_iwrite_all (ompi_file_t *fh, /* this fcoll component does not support non-blocking collective I/O operations. WE fake it with individual non-blocking I/O operations. */ - ret = ompio_io_ompio_file_iwrite ( fp, buf, count, datatype, request ); + ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request ); } return ret; } -int ompio_io_ompio_file_write_at_all (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_status_public_t *status) -{ - 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); - ret = fh->f_fcoll->fcoll_file_write_all (fh, - buf, - count, - datatype, - status); - - ompi_io_ompio_set_explicit_offset (fh, prev_offset); - return ret; -} int mca_io_ompio_file_iwrite_at_all (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, @@ -580,46 +210,10 @@ int mca_io_ompio_file_iwrite_at_all (ompi_file_t *fh, mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_iwrite_at_all ( &data->ompio_fh, offset, buf, count, datatype, request ); + ret = mca_common_ompio_file_iwrite_at_all ( &data->ompio_fh, offset, buf, count, datatype, request ); return ret; } -int ompio_io_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fp, - OMPI_MPI_OFFSET_TYPE offset, - const void *buf, - int count, - struct ompi_datatype_t *datatype, - ompi_request_t **request) -{ - - int ret = OMPI_SUCCESS; - OMPI_MPI_OFFSET_TYPE prev_offset; - - ompio_io_ompio_file_get_position (fp, &prev_offset ); - - ompi_io_ompio_set_explicit_offset (fp, offset); - - if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) { - ret = fp->f_fcoll->fcoll_file_iwrite_all (fp, - buf, - count, - datatype, - request); - } - else { - /* this fcoll component does not support non-blocking - collective I/O operations. WE fake it with - individual non-blocking I/O operations. */ - ret = ompio_io_ompio_file_iwrite ( fp, buf, count, datatype, request ); - } - - ompi_io_ompio_set_explicit_offset (fp, prev_offset); - return ret; -} - - - - /* Infrastructure for shared file pointer operations */ /* (Individual and collective */ @@ -806,7 +400,7 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh, printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n"); return MPI_ERR_REQUEST; } - ret = ompio_io_ompio_file_iwrite_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req ); + ret = mca_common_ompio_file_iwrite_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req ); fp->f_split_coll_in_use = true; return ret; diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h index 52030231e0..e47afda7a8 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h @@ -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) 2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +23,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/sharedfp/sharedfp.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include BEGIN_C_DECLS diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c index 961733b661..38239d963d 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -66,7 +66,7 @@ int mca_sharedfp_addproc_iread(mca_io_ompio_file_t *fh, "mca_sharedfp_addproc_iread: Offset received is %lld\n",offset); } /* Read from the file */ - ret = ompio_io_ompio_file_iread_at ( sh->sharedfh, offset, buf, count, datatype, request); + ret = mca_common_ompio_file_iread_at ( sh->sharedfh, offset, buf, count, datatype, request); } return ret; @@ -180,7 +180,7 @@ int mca_sharedfp_addproc_read_ordered_begin(mca_io_ompio_file_t *fh, } /* read from the file */ - ret = ompio_io_ompio_file_iread_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req); + ret = mca_common_ompio_file_iread_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req); fh->f_split_coll_in_use = true; exit: diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c index 0157c079cb..2aec2ee16c 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,7 +64,7 @@ int mca_sharedfp_addproc_iwrite(mca_io_ompio_file_t *fh, "sharedfp_addproc_iwrite: Offset received is %lld\n",offset); } /* Write to the file */ - ret = ompio_io_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); } return ret; @@ -176,7 +176,7 @@ int mca_sharedfp_addproc_write_ordered_begin(mca_io_ompio_file_t *fh, } /* write to the file */ - ret = ompio_io_ompio_file_iwrite_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req); + ret = mca_common_ompio_file_iwrite_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req); fh->f_split_coll_in_use = true; exit: diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c index 37d78f01f8..37bfc31ded 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -62,7 +62,7 @@ int mca_sharedfp_addproc_read ( mca_io_ompio_file_t *fh, "mca_sharedfp_addproc_read: Offset received is %lld\n",offset); } /* Read from the file */ - ret = ompio_io_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); } return ret; @@ -172,7 +172,7 @@ int mca_sharedfp_addproc_read_ordered (mca_io_ompio_file_t *fh, } /* read from the file */ - ret = ompio_io_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c index e4fe7ff154..03d6db839e 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -65,7 +65,7 @@ int mca_sharedfp_addproc_write (mca_io_ompio_file_t *fh, "sharedfp_addproc_write: Offset received is %lld\n",offset); } /* Write to the file */ - ret = ompio_io_ompio_file_write_at(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at(sh->sharedfh,offset,buf,count,datatype,status); } return ret; @@ -173,7 +173,7 @@ int mca_sharedfp_addproc_write_ordered (mca_io_ompio_file_t *fh, } /* write to the file */ - ret = ompio_io_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { diff --git a/ompi/mca/sharedfp/base/sharedfp_base_file_select.c b/ompi/mca/sharedfp/base/sharedfp_base_file_select.c index 9bc9c275c4..e295af2db9 100644 --- a/ompi/mca/sharedfp/base/sharedfp_base_file_select.c +++ b/ompi/mca/sharedfp/base/sharedfp_base_file_select.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-2013 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * @@ -28,7 +28,7 @@ #include "opal/mca/base/base.h" #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" /* * This structure is needed so that we can close the modules diff --git a/ompi/mca/sharedfp/base/sharedfp_base_file_unselect.c b/ompi/mca/sharedfp/base/sharedfp_base_file_unselect.c index 8d799ccefa..3c341fe09d 100644 --- a/ompi/mca/sharedfp/base/sharedfp_base_file_unselect.c +++ b/ompi/mca/sharedfp/base/sharedfp_base_file_unselect.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-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,13 +24,14 @@ #include #include "mpi.h" -#include "ompi/mca/io/ompio/io_ompio.h" #include "opal/util/show_help.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" +#include "ompi/mca/common/ompio/common_ompio.h" + int mca_sharedfp_base_file_unselect(mca_io_ompio_file_t *file) { if (NULL != file->f_sharedfp && NULL != file->f_sharedfp->sharedfp_module_finalize) { diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual.h b/ompi/mca/sharedfp/individual/sharedfp_individual.h index 8c0516897a..b5f0d5e5be 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual.h +++ b/ompi/mca/sharedfp/individual/sharedfp_individual.h @@ -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) 2013 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/sharedfp/sharedfp.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c b/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c index 024a7edd0f..d91351272f 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,6 +25,7 @@ #include "ompi/constants.h" #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include "ompi/mca/io/ompio/io_ompio.h" #include @@ -175,7 +176,7 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh } /*Read from the local data file*/ - ompio_io_ompio_file_read_at ( headnode->datafilehandle, + mca_common_ompio_file_read_at ( headnode->datafilehandle, local_off[i], buff, ind_recordlength[i], MPI_BYTE, &status); @@ -188,7 +189,7 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh } /*Write into main data file*/ - ompio_io_ompio_file_write_at( sh->sharedfh, offsetbuff[idx], buff, + mca_common_ompio_file_write_at( sh->sharedfh, offsetbuff[idx], buff, ind_recordlength[i], MPI_BYTE, &status); } @@ -275,7 +276,7 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long ctr = 0; for (i = 0; i < headnode->numofrecordsonfile ; i++) { - ompio_io_ompio_file_read_at(headnode->metadatafilehandle,metaoffset, &rec, 32, MPI_BYTE,&status); + mca_common_ompio_file_read_at(headnode->metadatafilehandle,metaoffset, &rec, 32, MPI_BYTE,&status); *(*rec_length + ctr) = rec.recordlength; *(*buff + ctr) = rec.timestamp; diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_insert_metadata.c b/ompi/mca/sharedfp/individual/sharedfp_individual_insert_metadata.c index 191c4e1bf3..2012899dca 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_insert_metadata.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_insert_metadata.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -133,9 +133,9 @@ int mca_sharedfp_individual_write_metadata_file(struct mca_sharedfp_base_data_t /*Write to the metadata file*/ - ret = ompio_io_ompio_file_write_at ( (headnode)->metadatafilehandle, - (headnode)->metadatafile_offset, - &buff,32, MPI_BYTE, &status); + ret = mca_common_ompio_file_write_at ( (headnode)->metadatafilehandle, + (headnode)->metadatafile_offset, + &buff,32, MPI_BYTE, &status); if ( OMPI_SUCCESS != ret ) { goto exit; } diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.c b/ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.c index 223d6703d4..efb7d605b3 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -76,8 +76,8 @@ int mca_sharedfp_individual_iwrite(mca_io_ompio_file_t *fh, /*Write the data into individual file*/ - ret = ompio_io_ompio_file_iwrite_at ( headnode->datafilehandle, headnode->datafile_offset, - buf, count, datatype, request); + ret = mca_common_ompio_file_iwrite_at ( headnode->datafilehandle, headnode->datafile_offset, + buf, count, datatype, request); if ( OMPI_SUCCESS != ret ) { opal_output(0,"sharedfp_individual_iwrite: Error while iwriting the datafile \n"); return ret; @@ -189,7 +189,7 @@ int mca_sharedfp_individual_write_ordered_begin(mca_io_ompio_file_t *fh, } ret = sh->comm->c_coll.coll_bcast ( &global_offset, 1, OMPI_OFFSET_DATATYPE, - 0, sh->comm, sh->comm->c_coll.coll_bcast_module ); + 0, sh->comm, sh->comm->c_coll.coll_bcast_module ); if ( OMPI_SUCCESS != ret ) { opal_output(0,"sharedfp_individual_write_ordered_begin: Error while bcasting global offset \n"); goto exit; @@ -198,8 +198,8 @@ int mca_sharedfp_individual_write_ordered_begin(mca_io_ompio_file_t *fh, sh->global_offset = global_offset; /*use file_write_at_all to ensure the order*/ - ret = ompio_io_ompio_file_iwrite_at_all(sh->sharedfh,offset, buf,count,datatype, - &fh->f_split_coll_req); + ret = mca_common_ompio_file_iwrite_at_all(sh->sharedfh,offset, buf,count,datatype, + &fh->f_split_coll_req); fh->f_split_coll_in_use = true; if ( OMPI_SUCCESS != ret ) { opal_output(0,"sharedfp_individual_write_ordered_begin: Error while writing the datafile \n"); diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_write.c b/ompi/mca/sharedfp/individual/sharedfp_individual_write.c index 6f921f4656..f394fd8c7e 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_write.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_write.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) 2013 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -71,9 +71,9 @@ int mca_sharedfp_individual_write (mca_io_ompio_file_t *fh, mca_sharedfp_individual_insert_metadata(OMPI_FILE_WRITE_SHARED, totalbytes, sh); /*Write the data into individual file*/ - ret = ompio_io_ompio_file_write_at ( headnode->datafilehandle, - headnode->datafile_offset, - buf, count, datatype, status); + ret = mca_common_ompio_file_write_at ( headnode->datafilehandle, + headnode->datafile_offset, + buf, count, datatype, status); if ( OMPI_SUCCESS != ret ) { opal_output(0,"mca_sharedfp_individual_write: Error while writing the datafile \n"); return -1; @@ -191,7 +191,7 @@ int mca_sharedfp_individual_write_ordered (mca_io_ompio_file_t *fh, sh->global_offset = global_offset; /*use file_write_at_all to ensure the order*/ - ret = ompio_io_ompio_file_write_at_all(sh->sharedfh,offset, buf,count,datatype,status); + ret = mca_common_ompio_file_write_at_all(sh->sharedfh,offset, buf,count,datatype,status); if ( OMPI_SUCCESS != ret ) { opal_output(0,"sharedfp_individual_write_ordered: Error while writing the datafile \n"); } diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h index 2774ef5ee6..0e1faa3584 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h @@ -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) 2013 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/sharedfp/sharedfp.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" BEGIN_C_DECLS diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c index 70df7914f6..fa5dd25f9e 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -82,7 +82,7 @@ int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh, } /* Read the file */ - ret = ompio_io_ompio_file_iread_at(sh->sharedfh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iread_at(sh->sharedfh,offset,buf,count,datatype,request); } return ret; @@ -205,7 +205,7 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh, "sharedfp_lockedfile_read_ordered_begin: Offset returned is %lld\n",offset); } - ret = ompio_io_ompio_file_iread_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req ); + ret = mca_common_ompio_file_iread_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req ); fh->f_split_coll_in_use = true; exit: diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c index c12f60f6a6..82a464344f 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -82,7 +82,7 @@ int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh, } /* Write to the file */ - ret = ompio_io_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); } return ret; @@ -204,7 +204,7 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh, "sharedfp_lockedfile_write_ordered_begin: Offset returned is %lld\n",offset); } - ret = ompio_io_ompio_file_iwrite_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req ); + ret = mca_common_ompio_file_iwrite_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req ); fh->f_split_coll_in_use = true; exit: diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c index cd7df48e57..58f502cce1 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_read.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,7 +77,7 @@ int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh, } /* Read the file */ - ret = ompio_io_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); } return ret; @@ -192,7 +192,7 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh, } /* read to the file */ - ret = ompio_io_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c index eb44cefb9a..7a4beb6c28 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_write.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -80,7 +80,7 @@ int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh, "sharedfp_lockedfile_write: Offset received is %lld\n",offset); } /* Write to the file */ - ret = ompio_io_ompio_file_write_at ( sh->sharedfh, offset, buf, count, datatype, status); + ret = mca_common_ompio_file_write_at ( sh->sharedfh, offset, buf, count, datatype, status); } return ret; @@ -199,7 +199,7 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh, } /* write to the file */ - ret = ompio_io_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm.h b/ompi/mca/sharedfp/sm/sharedfp_sm.h index 4f62e2997b..b10bbcf141 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm.h +++ b/ompi/mca/sharedfp/sm/sharedfp_sm.h @@ -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-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -26,7 +26,7 @@ #include "ompi_config.h" #include "ompi/mca/mca.h" #include "ompi/mca/sharedfp/sharedfp.h" -#include "ompi/mca/io/ompio/io_ompio.h" +#include "ompi/mca/common/ompio/common_ompio.h" #include BEGIN_C_DECLS diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c b/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c index 17652cfa87..7ecc657768 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_iread.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_iread.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,7 +78,7 @@ int mca_sharedfp_sm_iread(mca_io_ompio_file_t *fh, "sharedfp_sm_iread: Offset received is %lld\n",offset); } /* Read the file */ - ret = ompio_io_ompio_file_iread_at(sh->sharedfh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iread_at(sh->sharedfh,offset,buf,count,datatype,request); } return ret; @@ -202,7 +202,7 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh, } /* read to the file */ - ret = ompio_io_ompio_file_iread_at_all(sh->sharedfh,offset,buf,count,datatype, + ret = mca_common_ompio_file_iread_at_all(sh->sharedfh,offset,buf,count,datatype, &fh->f_split_coll_req); fh->f_split_coll_in_use = true; diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c b/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c index 6527c888c7..6a5f8289ce 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.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) 2013 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -80,7 +80,7 @@ int mca_sharedfp_sm_iwrite(mca_io_ompio_file_t *fh, "sharedfp_sm_iwrite: Offset received is %lld\n",offset); } /* Write to the file */ - ret = ompio_io_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); + ret = mca_common_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request); } return ret; @@ -205,7 +205,7 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh, } /* read to the file */ - ret = ompio_io_ompio_file_iwrite_at_all(sh->sharedfh,offset,buf,count,datatype, + ret = mca_common_ompio_file_iwrite_at_all(sh->sharedfh,offset,buf,count,datatype, &fh->f_split_coll_req); fh->f_split_coll_in_use = true; diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_read.c b/ompi/mca/sharedfp/sm/sharedfp_sm_read.c index 8f2cd77426..4c14e1a542 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_read.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_read.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,7 +77,7 @@ int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh, } /* Read the file */ - ret = ompio_io_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status); } return ret; @@ -195,7 +195,7 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh, } /* read to the file */ - ret = ompio_io_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_write.c b/ompi/mca/sharedfp/sm/sharedfp_sm_write.c index fd0ffab678..ac5bd800cb 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_write.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_write.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -81,7 +81,7 @@ int mca_sharedfp_sm_write (mca_io_ompio_file_t *fh, } /* Write to the file*/ - ret = ompio_io_ompio_file_write_at(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at(sh->sharedfh,offset,buf,count,datatype,status); } return ret; @@ -202,7 +202,7 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh, "sharedfp_sm_write_ordered: Offset returned is %lld\n",offset); } /* write to the file */ - ret = ompio_io_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); + ret = mca_common_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status); exit: if ( NULL != buff ) { From b0fa1fd2a1748c4c4e582d8ff8f7937433c5641b Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 20 Jul 2016 17:27:14 -0500 Subject: [PATCH 6/6] move the internal file_open/close functions to common/ompio --- ompi/mca/common/ompio/Makefile.am | 1 + ompi/mca/common/ompio/common_ompio.h | 10 + .../mca/common/ompio/common_ompio_file_open.c | 380 +++++++++++++++ .../mca/common/ompio/common_ompio_file_read.c | 59 ++- .../common/ompio/common_ompio_file_write.c | 24 +- ompi/mca/io/ompio/io_ompio.c | 122 +---- ompi/mca/io/ompio/io_ompio.h | 28 -- ompi/mca/io/ompio/io_ompio_file_open.c | 439 ++---------------- .../addproc/sharedfp_addproc_file_open.c | 6 +- .../sharedfp_individual_file_open.c | 14 +- .../sharedfp_lockedfile_file_open.c | 6 +- .../lockedfile/sharedfp_lockedfile_seek.c | 4 +- ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 6 +- ompi/mca/sharedfp/sm/sharedfp_sm_seek.c | 4 +- 14 files changed, 513 insertions(+), 590 deletions(-) create mode 100644 ompi/mca/common/ompio/common_ompio_file_open.c diff --git a/ompi/mca/common/ompio/Makefile.am b/ompi/mca/common/ompio/Makefile.am index d6f255819f..5c3788d301 100644 --- a/ompi/mca/common/ompio/Makefile.am +++ b/ompi/mca/common/ompio/Makefile.am @@ -24,6 +24,7 @@ headers = \ sources = \ common_ompio_print_queue.c \ + common_ompio_file_open.c \ common_ompio_file_read.c \ common_ompio_file_write.c diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index fcc3702c64..f1651b075d 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -74,5 +74,15 @@ OMPI_DECLSPEC int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, O void *buf, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); +OMPI_DECLSPEC int mca_common_ompio_file_open (ompi_communicator_t *comm, const char *filename, + int amode, ompi_info_t *info, + mca_io_ompio_file_t *ompio_fh, bool use_sharedfp); + +OMPI_DECLSPEC int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh); +OMPI_DECLSPEC int mca_common_ompio_file_get_size (mca_io_ompio_file_t *ompio_fh, OMPI_MPI_OFFSET_TYPE *size); +OMPI_DECLSPEC int mca_common_ompio_file_get_position (mca_io_ompio_file_t *fh,OMPI_MPI_OFFSET_TYPE *offset); +OMPI_DECLSPEC int mca_common_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset); + + #endif /* MCA_COMMON_OMPIO_H */ diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c new file mode 100644 index 0000000000..3b770a6775 --- /dev/null +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/info/info.h" +#include "ompi/file/file.h" +#include "ompi/mca/io/base/base.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fcoll/fcoll.h" +#include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/fbtl/base/base.h" +#include "ompi/mca/sharedfp/sharedfp.h" +#include "ompi/mca/sharedfp/base/base.h" + +#include +#include +#include "common_ompio.h" +#include "ompi/mca/topo/topo.h" + +int mca_common_ompio_file_open (ompi_communicator_t *comm, + const char *filename, + int amode, + ompi_info_t *info, + mca_io_ompio_file_t *ompio_fh, bool use_sharedfp) +{ + int ret = OMPI_SUCCESS; + int remote_arch; + + + ompio_fh->f_iov_type = MPI_DATATYPE_NULL; + ompio_fh->f_comm = MPI_COMM_NULL; + + if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) + + ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) { + return MPI_ERR_AMODE; + } + + if ((amode & MPI_MODE_RDONLY) && + ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) { + return MPI_ERR_AMODE; + } + + if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) { + return MPI_ERR_AMODE; + } + + ompio_fh->f_rank = ompi_comm_rank (comm); + ompio_fh->f_size = ompi_comm_size (comm); + remote_arch = opal_local_arch; + ompio_fh->f_convertor = opal_convertor_create (remote_arch, 0); + + if ( true == use_sharedfp ) { + ret = ompi_comm_dup (comm, &ompio_fh->f_comm); + if ( OMPI_SUCCESS != ret ) { + goto fn_fail; + } + } + else { + /* No need to duplicate the communicator if the file_open is called + from the sharedfp component, since the comm used as an input + is already a dup of the user level comm. */ + ompio_fh->f_flags |= OMPIO_SHAREDFP_IS_SET; + ompio_fh->f_comm = comm; + } + + ompio_fh->f_fstype = NONE; + ompio_fh->f_amode = amode; + ompio_fh->f_info = info; + ompio_fh->f_atomicity = 0; + + ompi_io_ompio_set_file_defaults (ompio_fh); + ompio_fh->f_filename = filename; + + ompio_fh->f_split_coll_req = NULL; + ompio_fh->f_split_coll_in_use = false; + + /*Initialize the print_queues queues here!*/ + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_write_time); + mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_read_time); + + /* set some function pointers required for fcoll, fbtls and sharedfp modules*/ + ompio_fh->f_decode_datatype=ompi_io_ompio_decode_datatype; + ompio_fh->f_generate_current_file_view=ompi_io_ompio_generate_current_file_view; + + ompio_fh->f_sort=ompi_io_ompio_sort; + ompio_fh->f_sort_iovec=ompi_io_ompio_sort_iovec; + + ompio_fh->f_get_num_aggregators=mca_io_ompio_get_num_aggregators; + ompio_fh->f_get_bytes_per_agg=mca_io_ompio_get_bytes_per_agg; + ompio_fh->f_set_aggregator_props=ompi_io_ompio_set_aggregator_props; + + /* This fix is needed for data seiving to work with + two-phase collective I/O */ + if ((amode & MPI_MODE_WRONLY)){ + amode -= MPI_MODE_WRONLY; + amode += MPI_MODE_RDWR; + } + /*--------------------------------------------------*/ + + + if (OMPI_SUCCESS != (ret = mca_fs_base_file_select (ompio_fh, + NULL))) { + opal_output(1, "mca_fs_base_file_select() failed\n"); + goto fn_fail; + } + if (OMPI_SUCCESS != (ret = mca_fbtl_base_file_select (ompio_fh, + NULL))) { + opal_output(1, "mca_fbtl_base_file_select() failed\n"); + goto fn_fail; + } + + if (OMPI_SUCCESS != (ret = mca_fcoll_base_file_select (ompio_fh, + NULL))) { + opal_output(1, "mca_fcoll_base_file_select() failed\n"); + goto fn_fail; + } + + ompio_fh->f_sharedfp_component = NULL; /*component*/ + ompio_fh->f_sharedfp = NULL; /*module*/ + ompio_fh->f_sharedfp_data = NULL; /*data*/ + + if ( true == use_sharedfp ) { + if (OMPI_SUCCESS != (ret = mca_sharedfp_base_file_select (ompio_fh, NULL))) { + opal_output ( ompi_io_base_framework.framework_output, + "mca_sharedfp_base_file_select() failed\n"); + ompio_fh->f_sharedfp = NULL; /*module*/ + /* Its ok to not have a shared file pointer module as long as the shared file + ** pointer operations are not used. However, the first call to any file_read/write_shared + ** function will return an error code. + */ + } + + /* open the file once more for the shared file pointer if required. + ** Per default, the shared file pointer specific actions are however + ** only performed on first access of the shared file pointer, except + ** for the addproc sharedfp component. + ** + ** Lazy open does not work for the addproc sharedfp + ** component since it starts by spawning a process using MPI_Comm_spawn. + ** For this, the first operation has to be collective which we can + ** not guarantuee outside of the MPI_File_open operation. + */ + if ( NULL != ompio_fh->f_sharedfp && + true == use_sharedfp && + (!mca_io_ompio_sharedfp_lazy_open || + !strcmp (ompio_fh->f_sharedfp_component->mca_component_name, + "addproc") )) { + ret = ompio_fh->f_sharedfp->sharedfp_file_open(comm, + filename, + amode, + info, + ompio_fh); + + if ( OMPI_SUCCESS != ret ) { + goto fn_fail; + } + } + } + + /*Determine topology information if set*/ + if (ompio_fh->f_comm->c_flags & OMPI_COMM_CART){ + ret = mca_io_ompio_cart_based_grouping(ompio_fh); + if(OMPI_SUCCESS != ret ){ + ret = MPI_ERR_FILE; + } + } + + ret = ompio_fh->f_fs->fs_file_open (comm, + filename, + amode, + info, + ompio_fh); + + + + + if ( OMPI_SUCCESS != ret ) { + ret = MPI_ERR_FILE; + goto fn_fail; + } + + + /* If file has been opened in the append mode, move the internal + file pointer of OMPIO to the very end of the file. */ + if ( ompio_fh->f_amode & MPI_MODE_APPEND ) { + OMPI_MPI_OFFSET_TYPE current_size; + + ompio_fh->f_fs->fs_file_get_size( ompio_fh, + ¤t_size); + mca_common_ompio_set_explicit_offset (ompio_fh, current_size); + } + + + + return OMPI_SUCCESS; + + fn_fail: + /* no need to free resources here, since the destructor + * is calling mca_io_ompio_file_close, which actually gets + *rid of all allocated memory items */ + + return ret; +} + +int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh) +{ + int ret = OMPI_SUCCESS; + int delete_flag = 0; + char name[256]; + + if(mca_io_ompio_coll_timing_info){ + strcpy (name, "WRITE"); + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_write_time)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_write_time, + name, + ompio_fh); + if (OMPI_SUCCESS != ret){ + printf("Error in print_time_info "); + } + + } + strcpy (name, "READ"); + if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_read_time)){ + ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_read_time, + name, + ompio_fh); + if (OMPI_SUCCESS != ret){ + printf("Error in print_time_info "); + } + } + } + if ( ompio_fh->f_amode & MPI_MODE_DELETE_ON_CLOSE ) { + delete_flag = 1; + } + + /*close the sharedfp file*/ + if( NULL != ompio_fh->f_sharedfp ){ + ret = ompio_fh->f_sharedfp->sharedfp_file_close(ompio_fh); + } + if ( NULL != ompio_fh->f_fs ) { + /* The pointer might not be set if file_close() is + ** called from the file destructor in case of an error + ** during file_open() + */ + ret = ompio_fh->f_fs->fs_file_close (ompio_fh); + } + if ( delete_flag && 0 == ompio_fh->f_rank ) { + mca_io_ompio_file_delete ( ompio_fh->f_filename, MPI_INFO_NULL ); + } + + if ( NULL != ompio_fh->f_fs ) { + mca_fs_base_file_unselect (ompio_fh); + } + if ( NULL != ompio_fh->f_fbtl ) { + mca_fbtl_base_file_unselect (ompio_fh); + } + + if ( NULL != ompio_fh->f_fcoll ) { + mca_fcoll_base_file_unselect (ompio_fh); + } + if ( NULL != ompio_fh->f_sharedfp) { + mca_sharedfp_base_file_unselect (ompio_fh); + } + + if (NULL != ompio_fh->f_io_array) { + free (ompio_fh->f_io_array); + ompio_fh->f_io_array = NULL; + } + + if (NULL != ompio_fh->f_init_procs_in_group) { + free (ompio_fh->f_init_procs_in_group); + ompio_fh->f_init_procs_in_group = NULL; + } + if (NULL != ompio_fh->f_procs_in_group) { + free (ompio_fh->f_procs_in_group); + ompio_fh->f_procs_in_group = NULL; + } + + if (NULL != ompio_fh->f_decoded_iov) { + free (ompio_fh->f_decoded_iov); + ompio_fh->f_decoded_iov = NULL; + } + + if (NULL != ompio_fh->f_convertor) { + free (ompio_fh->f_convertor); + ompio_fh->f_convertor = NULL; + } + + if (NULL != ompio_fh->f_datarep) { + free (ompio_fh->f_datarep); + ompio_fh->f_datarep = NULL; + } + + + if ( NULL != ompio_fh->f_coll_write_time ) { + free ( ompio_fh->f_coll_write_time ); + ompio_fh->f_coll_write_time = NULL; + } + + if ( NULL != ompio_fh->f_coll_read_time ) { + free ( ompio_fh->f_coll_read_time ); + ompio_fh->f_coll_read_time = NULL; + } + + if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) { + ompi_datatype_destroy (&ompio_fh->f_iov_type); + } + + if ( MPI_DATATYPE_NULL != ompio_fh->f_etype ) { + ompi_datatype_destroy (&ompio_fh->f_etype); + } + if ( MPI_DATATYPE_NULL != ompio_fh->f_filetype ){ + ompi_datatype_destroy (&ompio_fh->f_filetype); + } + + if ( MPI_DATATYPE_NULL != ompio_fh->f_orig_filetype ){ + ompi_datatype_destroy (&ompio_fh->f_orig_filetype); + } + + + if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) { + ompi_comm_free (&ompio_fh->f_comm); + } + + return ret; +} + +int mca_common_ompio_file_get_size (mca_io_ompio_file_t *ompio_fh, + OMPI_MPI_OFFSET_TYPE *size) +{ + int ret = OMPI_SUCCESS; + + ret = ompio_fh->f_fs->fs_file_get_size (ompio_fh, size); + + return ret; +} + + +int mca_common_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; + + /* No. of elements per view */ + off *= (fh->f_view_size / fh->f_etype_size); + + /* No of elements used in the current copy of the view */ + off += fh->f_total_bytes / fh->f_etype_size; + + *offset = off; + return OMPI_SUCCESS; +} + + diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c index 6c6014c5a0..c8fb15e5a2 100644 --- a/ompi/mca/common/ompio/common_ompio_file_read.c +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -155,9 +155,9 @@ int mca_common_ompio_file_read_at (mca_io_ompio_file_t *fh, int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = mca_common_ompio_file_read (fh, buf, count, @@ -167,7 +167,7 @@ int mca_common_ompio_file_read_at (mca_io_ompio_file_t *fh, // 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); + mca_common_ompio_set_explicit_offset (fh, prev_offset); return ret; } @@ -274,9 +274,9 @@ int mca_common_ompio_file_iread_at (mca_io_ompio_file_t *fh, { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = mca_common_ompio_file_iread (fh, buf, count, @@ -291,7 +291,7 @@ int mca_common_ompio_file_iread_at (mca_io_ompio_file_t *fh, ** the entire array of have ** already been constructed in the file_iread operation */ - ompi_io_ompio_set_explicit_offset (fh, prev_offset); + mca_common_ompio_set_explicit_offset (fh, prev_offset); return ret; } @@ -307,16 +307,16 @@ int mca_common_ompio_file_read_at_all (mca_io_ompio_file_t *fh, { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = fh->f_fcoll->fcoll_file_read_all (fh, buf, count, datatype, status); - ompi_io_ompio_set_explicit_offset (fh, prev_offset); + mca_common_ompio_set_explicit_offset (fh, prev_offset); return ret; } @@ -330,8 +330,8 @@ int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fp, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fp, offset); + mca_common_ompio_file_get_position (fp, &prev_offset ); + mca_common_ompio_set_explicit_offset (fp, offset); if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) { ret = fp->f_fcoll->fcoll_file_iread_all (fp, @@ -348,6 +348,41 @@ int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, } - ompi_io_ompio_set_explicit_offset (fp, prev_offset); + mca_common_ompio_set_explicit_offset (fp, prev_offset); return ret; } + +int mca_common_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset) +{ + int i = 0; + int k = 0; + + if ( fh->f_view_size > 0 ) { + /* starting offset of the current copy of the filew view */ + fh->f_offset = (fh->f_view_extent * + ((offset*fh->f_etype_size) / fh->f_view_size)) + fh->f_disp; + + + /* number of bytes used within the current copy of the file view */ + fh->f_total_bytes = (offset*fh->f_etype_size) % fh->f_view_size; + i = fh->f_total_bytes; + + + /* Initialize the block id and the starting offset of the current block + within the current copy of the file view to zero */ + fh->f_index_in_file_view = 0; + fh->f_position_in_file_view = 0; + + /* determine block id that the offset is located in and + the starting offset of that block */ + k = fh->f_decoded_iov[fh->f_index_in_file_view].iov_len; + while (i >= k) { + fh->f_position_in_file_view = k; + fh->f_index_in_file_view++; + k += fh->f_decoded_iov[fh->f_index_in_file_view].iov_len; + } + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index c633a14de4..97fe28671f 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -129,9 +129,9 @@ int mca_common_ompio_file_write_at (mca_io_ompio_file_t *fh, { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = mca_common_ompio_file_write (fh, buf, count, @@ -140,7 +140,7 @@ int mca_common_ompio_file_write_at (mca_io_ompio_file_t *fh, // 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 ); + mca_common_ompio_set_explicit_offset (fh, prev_offset ); return ret; } @@ -241,9 +241,9 @@ int mca_common_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = mca_common_ompio_file_iwrite (fh, buf, count, @@ -258,7 +258,7 @@ int mca_common_ompio_file_iwrite_at (mca_io_ompio_file_t *fh, ** the entire array of have ** already been constructed in the file_iwrite operation */ - ompi_io_ompio_set_explicit_offset (fh, prev_offset); + mca_common_ompio_set_explicit_offset (fh, prev_offset); return ret; } @@ -275,16 +275,16 @@ int mca_common_ompio_file_write_at_all (mca_io_ompio_file_t *fh, { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fh, &prev_offset ); + mca_common_ompio_file_get_position (fh, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fh, offset); + mca_common_ompio_set_explicit_offset (fh, offset); ret = fh->f_fcoll->fcoll_file_write_all (fh, buf, count, datatype, status); - ompi_io_ompio_set_explicit_offset (fh, prev_offset); + mca_common_ompio_set_explicit_offset (fh, prev_offset); return ret; } @@ -299,9 +299,9 @@ int mca_common_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fp, int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (fp, &prev_offset ); + mca_common_ompio_file_get_position (fp, &prev_offset ); - ompi_io_ompio_set_explicit_offset (fp, offset); + mca_common_ompio_set_explicit_offset (fp, offset); if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) { ret = fp->f_fcoll->fcoll_file_iwrite_all (fp, @@ -317,7 +317,7 @@ int mca_common_ompio_file_iwrite_at_all (mca_io_ompio_file_t *fp, ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request ); } - ompi_io_ompio_set_explicit_offset (fp, prev_offset); + mca_common_ompio_set_explicit_offset (fp, prev_offset); return ret; } diff --git a/ompi/mca/io/ompio/io_ompio.c b/ompi/mca/io/ompio/io_ompio.c index dc1ea18f89..b7b6d13c59 100644 --- a/ompi/mca/io/ompio/io_ompio.c +++ b/ompi/mca/io/ompio/io_ompio.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 University of Houston. All rights reserved. + * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -547,40 +547,6 @@ int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, return OMPI_SUCCESS; } -int ompi_io_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset) -{ - int i = 0; - int k = 0; - - if ( fh->f_view_size > 0 ) { - /* starting offset of the current copy of the filew view */ - fh->f_offset = (fh->f_view_extent * - ((offset*fh->f_etype_size) / fh->f_view_size)) + fh->f_disp; - - - /* number of bytes used within the current copy of the file view */ - fh->f_total_bytes = (offset*fh->f_etype_size) % fh->f_view_size; - i = fh->f_total_bytes; - - - /* Initialize the block id and the starting offset of the current block - within the current copy of the file view to zero */ - fh->f_index_in_file_view = 0; - fh->f_position_in_file_view = 0; - - /* determine block id that the offset is located in and - the starting offset of that block */ - k = fh->f_decoded_iov[fh->f_index_in_file_view].iov_len; - while (i >= k) { - fh->f_position_in_file_view = k; - fh->f_index_in_file_view++; - k += fh->f_decoded_iov[fh->f_index_in_file_view].iov_len; - } - } - - return OMPI_SUCCESS; -} int ompi_io_ompio_decode_datatype (struct mca_io_ompio_file_t *fh, ompi_datatype_t *datatype, @@ -1078,92 +1044,6 @@ int ompi_io_ompio_set_aggregator_props (struct mca_io_ompio_file_t *fh, return OMPI_SUCCESS; } - - - -int ompi_io_ompio_break_file_view (mca_io_ompio_file_t *fh, - struct iovec *iov, - int count, - int stripe_count, - size_t stripe_size, - struct iovec **broken_iov, - int *broken_count) -{ - - - - struct iovec *temp_iov = NULL; - int i = 0; - int k = 0; - int block = 1; - int broken = 0; - size_t remaining = 0; - size_t temp = 0; - OPAL_PTRDIFF_TYPE current_offset = 0; - - - /* allocate an initial iovec, will grow if needed */ - temp_iov = (struct iovec *) malloc - (count * sizeof (struct iovec)); - if (NULL == temp_iov) { - opal_output(1, "OUT OF MEMORY\n"); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - while (i < count) { - if (count*block <= k) { - block ++; - temp_iov = (struct iovec *)realloc - (temp_iov, count * block *sizeof(struct iovec)); - if (NULL == temp_iov) { - opal_output(1, "OUT OF MEMORY\n"); - return OMPI_ERR_OUT_OF_RESOURCE; - } - } - if (0 == broken) { - temp = (OPAL_PTRDIFF_TYPE)(iov[i].iov_base)%stripe_size; - if ((stripe_size-temp) >= iov[i].iov_len) { - temp_iov[k].iov_base = iov[i].iov_base; - temp_iov[k].iov_len = iov[i].iov_len; - i++; - k++; - } - else { - temp_iov[k].iov_base = iov[i].iov_base; - temp_iov[k].iov_len = stripe_size-temp; - current_offset = (OPAL_PTRDIFF_TYPE)(temp_iov[k].iov_base) + - temp_iov[k].iov_len; - remaining = iov[i].iov_len - temp_iov[k].iov_len; - k++; - broken ++; - } - continue; - } - temp = current_offset%stripe_size; - if ((stripe_size-temp) >= remaining) { - temp_iov[k].iov_base = (IOVBASE_TYPE *)current_offset; - temp_iov[k].iov_len = remaining; - i++; - k++; - broken = 0; - current_offset = 0; - remaining = 0; - } - else { - temp_iov[k].iov_base = (IOVBASE_TYPE *)current_offset; - temp_iov[k].iov_len = stripe_size-temp; - current_offset += temp_iov[k].iov_len; - remaining -= temp_iov[k].iov_len; - k++; - broken ++; - } - } - *broken_iov = temp_iov; - *broken_count = k; - - return 1; -} - void mca_io_ompio_get_num_aggregators ( int *num_aggregators) { *num_aggregators = mca_io_ompio_num_aggregators; diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 60b2fea826..89d8ccb215 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -331,21 +331,6 @@ OMPI_DECLSPEC void mca_io_ompio_get_bytes_per_agg ( int *bytes_per_agg); OMPI_DECLSPEC int ompi_io_ompio_set_file_defaults (mca_io_ompio_file_t *fh); -OMPI_DECLSPEC int ompio_io_ompio_file_open (ompi_communicator_t *comm, - const char *filename, - int amode, - ompi_info_t *info, - mca_io_ompio_file_t *fh,bool use_sharedfp); - -OMPI_DECLSPEC int ompio_io_ompio_file_close (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_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 * into an iovec using the convertor_raw function @@ -375,10 +360,6 @@ OMPI_DECLSPEC int ompi_io_ompio_sort_offlen (mca_io_ompio_offlen_array_t *io_arr int *sorted); - -OMPI_DECLSPEC int ompi_io_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset); - OMPI_DECLSPEC int ompi_io_ompio_generate_current_file_view (struct mca_io_ompio_file_t *fh, size_t max_data, struct iovec **f_iov, @@ -410,15 +391,6 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh, contg *contg_groups); -OMPI_DECLSPEC int ompi_io_ompio_break_file_view (mca_io_ompio_file_t *fh, - struct iovec *iov, - int count, - int num_aggregators, - size_t stripe_size, - struct iovec **broken_iov, - int *broken_count); - - /* * ****************************************************************** * ********* functions which are implemented in this module ********* diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index 5c57257006..8a8fc910b8 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -40,12 +40,11 @@ #include "io_ompio.h" #include "ompi/mca/topo/topo.h" -int -mca_io_ompio_file_open (ompi_communicator_t *comm, - const char *filename, - int amode, - ompi_info_t *info, - ompi_file_t *fh) +int mca_io_ompio_file_open (ompi_communicator_t *comm, + const char *filename, + int amode, + ompi_info_t *info, + ompi_file_t *fh) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data=NULL; @@ -60,7 +59,7 @@ 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); + ret = mca_common_ompio_file_open(comm,filename,amode,info,&data->ompio_fh,use_sharedfp); if ( OMPI_SUCCESS == ret ) { fh->f_flags |= OMPIO_FILE_IS_OPEN; @@ -72,193 +71,8 @@ mca_io_ompio_file_open (ompi_communicator_t *comm, return ret; } -int -ompio_io_ompio_file_open (ompi_communicator_t *comm, - const char *filename, - int amode, - ompi_info_t *info, - mca_io_ompio_file_t *ompio_fh, bool use_sharedfp) -{ - int ret = OMPI_SUCCESS; - int remote_arch; - - ompio_fh->f_iov_type = MPI_DATATYPE_NULL; - ompio_fh->f_comm = MPI_COMM_NULL; - - if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) + - ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) { - return MPI_ERR_AMODE; - } - - if ((amode & MPI_MODE_RDONLY) && - ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) { - return MPI_ERR_AMODE; - } - - if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) { - return MPI_ERR_AMODE; - } - - ompio_fh->f_rank = ompi_comm_rank (comm); - ompio_fh->f_size = ompi_comm_size (comm); - remote_arch = opal_local_arch; - ompio_fh->f_convertor = opal_convertor_create (remote_arch, 0); - - if ( true == use_sharedfp ) { - ret = ompi_comm_dup (comm, &ompio_fh->f_comm); - if ( OMPI_SUCCESS != ret ) { - goto fn_fail; - } - } - else { - /* No need to duplicate the communicator if the file_open is called - from the sharedfp component, since the comm used as an input - is already a dup of the user level comm. */ - ompio_fh->f_flags |= OMPIO_SHAREDFP_IS_SET; - ompio_fh->f_comm = comm; - } - - ompio_fh->f_fstype = NONE; - ompio_fh->f_amode = amode; - ompio_fh->f_info = info; - ompio_fh->f_atomicity = 0; - - ompi_io_ompio_set_file_defaults (ompio_fh); - ompio_fh->f_filename = filename; - - ompio_fh->f_split_coll_req = NULL; - ompio_fh->f_split_coll_in_use = false; - - /*Initialize the print_queues queues here!*/ - mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_write_time); - mca_common_ompio_initialize_print_queue(&ompio_fh->f_coll_read_time); - - /* set some function pointers required for fcoll, fbtls and sharedfp modules*/ - ompio_fh->f_decode_datatype=ompi_io_ompio_decode_datatype; - ompio_fh->f_generate_current_file_view=ompi_io_ompio_generate_current_file_view; - - ompio_fh->f_sort=ompi_io_ompio_sort; - ompio_fh->f_sort_iovec=ompi_io_ompio_sort_iovec; - - ompio_fh->f_get_num_aggregators=mca_io_ompio_get_num_aggregators; - ompio_fh->f_get_bytes_per_agg=mca_io_ompio_get_bytes_per_agg; - ompio_fh->f_set_aggregator_props=ompi_io_ompio_set_aggregator_props; - - /* This fix is needed for data seiving to work with - two-phase collective I/O */ - if ((amode & MPI_MODE_WRONLY)){ - amode -= MPI_MODE_WRONLY; - amode += MPI_MODE_RDWR; - } - /*--------------------------------------------------*/ - - - if (OMPI_SUCCESS != (ret = mca_fs_base_file_select (ompio_fh, - NULL))) { - opal_output(1, "mca_fs_base_file_select() failed\n"); - goto fn_fail; - } - if (OMPI_SUCCESS != (ret = mca_fbtl_base_file_select (ompio_fh, - NULL))) { - opal_output(1, "mca_fbtl_base_file_select() failed\n"); - goto fn_fail; - } - - if (OMPI_SUCCESS != (ret = mca_fcoll_base_file_select (ompio_fh, - NULL))) { - opal_output(1, "mca_fcoll_base_file_select() failed\n"); - goto fn_fail; - } - - ompio_fh->f_sharedfp_component = NULL; /*component*/ - ompio_fh->f_sharedfp = NULL; /*module*/ - ompio_fh->f_sharedfp_data = NULL; /*data*/ - - if ( true == use_sharedfp ) { - if (OMPI_SUCCESS != (ret = mca_sharedfp_base_file_select (ompio_fh, NULL))) { - opal_output ( ompi_io_base_framework.framework_output, - "mca_sharedfp_base_file_select() failed\n"); - ompio_fh->f_sharedfp = NULL; /*module*/ - /* Its ok to not have a shared file pointer module as long as the shared file - ** pointer operations are not used. However, the first call to any file_read/write_shared - ** function will return an error code. - */ - } - - /* open the file once more for the shared file pointer if required. - ** Per default, the shared file pointer specific actions are however - ** only performed on first access of the shared file pointer, except - ** for the addproc sharedfp component. - ** - ** Lazy open does not work for the addproc sharedfp - ** component since it starts by spawning a process using MPI_Comm_spawn. - ** For this, the first operation has to be collective which we can - ** not guarantuee outside of the MPI_File_open operation. - */ - if ( NULL != ompio_fh->f_sharedfp && - true == use_sharedfp && - (!mca_io_ompio_sharedfp_lazy_open || - !strcmp (ompio_fh->f_sharedfp_component->mca_component_name, - "addproc") )) { - ret = ompio_fh->f_sharedfp->sharedfp_file_open(comm, - filename, - amode, - info, - ompio_fh); - - if ( OMPI_SUCCESS != ret ) { - goto fn_fail; - } - } - } - - /*Determine topology information if set*/ - if (ompio_fh->f_comm->c_flags & OMPI_COMM_CART){ - ret = mca_io_ompio_cart_based_grouping(ompio_fh); - if(OMPI_SUCCESS != ret ){ - ret = MPI_ERR_FILE; - } - } - - ret = ompio_fh->f_fs->fs_file_open (comm, - filename, - amode, - info, - ompio_fh); - - - - - if ( OMPI_SUCCESS != ret ) { - ret = MPI_ERR_FILE; - goto fn_fail; - } - - - /* If file has been opened in the append mode, move the internal - file pointer of OMPIO to the very end of the file. */ - if ( ompio_fh->f_amode & MPI_MODE_APPEND ) { - OMPI_MPI_OFFSET_TYPE current_size; - - ompio_fh->f_fs->fs_file_get_size( ompio_fh, - ¤t_size); - ompi_io_ompio_set_explicit_offset (ompio_fh, current_size); - } - - - - return OMPI_SUCCESS; - - fn_fail: - /* no need to free resources here, since the destructor - * is calling mca_io_ompio_file_close, which actually gets - *rid of all allocated memory items */ - - return ret; -} -int -mca_io_ompio_file_close (ompi_file_t *fh) +int mca_io_ompio_file_close (ompi_file_t *fh) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; @@ -268,7 +82,7 @@ mca_io_ompio_file_close (ompi_file_t *fh) /* structure has already been freed, this is an erroneous call to file_close */ return ret; } - ret = ompio_io_ompio_file_close(&data->ompio_fh); + ret = mca_common_ompio_file_close(&data->ompio_fh); if ( NULL != data ) { free ( data ); @@ -277,130 +91,6 @@ mca_io_ompio_file_close (ompi_file_t *fh) return ret; } -int -ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh) -{ - int ret = OMPI_SUCCESS; - int delete_flag = 0; - char name[256]; - - if(mca_io_ompio_coll_timing_info){ - strcpy (name, "WRITE"); - if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_write_time)){ - ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_write_time, - name, - ompio_fh); - if (OMPI_SUCCESS != ret){ - printf("Error in print_time_info "); - } - - } - strcpy (name, "READ"); - if (!mca_common_ompio_empty_print_queue(ompio_fh->f_coll_read_time)){ - ret = mca_common_ompio_print_time_info(ompio_fh->f_coll_read_time, - name, - ompio_fh); - if (OMPI_SUCCESS != ret){ - printf("Error in print_time_info "); - } - } - } - if ( ompio_fh->f_amode & MPI_MODE_DELETE_ON_CLOSE ) { - delete_flag = 1; - } - - /*close the sharedfp file*/ - if( NULL != ompio_fh->f_sharedfp ){ - ret = ompio_fh->f_sharedfp->sharedfp_file_close(ompio_fh); - } - if ( NULL != ompio_fh->f_fs ) { - /* The pointer might not be set if file_close() is - ** called from the file destructor in case of an error - ** during file_open() - */ - ret = ompio_fh->f_fs->fs_file_close (ompio_fh); - } - if ( delete_flag && 0 == ompio_fh->f_rank ) { - mca_io_ompio_file_delete ( ompio_fh->f_filename, MPI_INFO_NULL ); - } - - if ( NULL != ompio_fh->f_fs ) { - mca_fs_base_file_unselect (ompio_fh); - } - if ( NULL != ompio_fh->f_fbtl ) { - mca_fbtl_base_file_unselect (ompio_fh); - } - - if ( NULL != ompio_fh->f_fcoll ) { - mca_fcoll_base_file_unselect (ompio_fh); - } - if ( NULL != ompio_fh->f_sharedfp) { - mca_sharedfp_base_file_unselect (ompio_fh); - } - - if (NULL != ompio_fh->f_io_array) { - free (ompio_fh->f_io_array); - ompio_fh->f_io_array = NULL; - } - - if (NULL != ompio_fh->f_init_procs_in_group) { - free (ompio_fh->f_init_procs_in_group); - ompio_fh->f_init_procs_in_group = NULL; - } - if (NULL != ompio_fh->f_procs_in_group) { - free (ompio_fh->f_procs_in_group); - ompio_fh->f_procs_in_group = NULL; - } - - if (NULL != ompio_fh->f_decoded_iov) { - free (ompio_fh->f_decoded_iov); - ompio_fh->f_decoded_iov = NULL; - } - - if (NULL != ompio_fh->f_convertor) { - free (ompio_fh->f_convertor); - ompio_fh->f_convertor = NULL; - } - - if (NULL != ompio_fh->f_datarep) { - free (ompio_fh->f_datarep); - ompio_fh->f_datarep = NULL; - } - - - if ( NULL != ompio_fh->f_coll_write_time ) { - free ( ompio_fh->f_coll_write_time ); - ompio_fh->f_coll_write_time = NULL; - } - - if ( NULL != ompio_fh->f_coll_read_time ) { - free ( ompio_fh->f_coll_read_time ); - ompio_fh->f_coll_read_time = NULL; - } - - if (MPI_DATATYPE_NULL != ompio_fh->f_iov_type) { - ompi_datatype_destroy (&ompio_fh->f_iov_type); - } - - if ( MPI_DATATYPE_NULL != ompio_fh->f_etype ) { - ompi_datatype_destroy (&ompio_fh->f_etype); - } - if ( MPI_DATATYPE_NULL != ompio_fh->f_filetype ){ - ompi_datatype_destroy (&ompio_fh->f_filetype); - } - - if ( MPI_DATATYPE_NULL != ompio_fh->f_orig_filetype ){ - ompi_datatype_destroy (&ompio_fh->f_orig_filetype); - } - - - if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) { - ompi_comm_free (&ompio_fh->f_comm); - } - - return ret; -} - int mca_io_ompio_file_delete (const char *filename, struct ompi_info_t *info) { @@ -416,9 +106,8 @@ int mca_io_ompio_file_delete (const char *filename, return OMPI_SUCCESS; } -int -mca_io_ompio_file_preallocate (ompi_file_t *fh, - OMPI_MPI_OFFSET_TYPE diskspace) +int mca_io_ompio_file_preallocate (ompi_file_t *fh, + OMPI_MPI_OFFSET_TYPE diskspace) { int ret = OMPI_SUCCESS, cycles, i; OMPI_MPI_OFFSET_TYPE tmp, current_size, size, written, len; @@ -463,7 +152,7 @@ mca_io_ompio_file_preallocate (ompi_file_t *fh, */ if (OMPIO_ROOT == data->ompio_fh.f_rank) { OMPI_MPI_OFFSET_TYPE prev_offset; - ompio_io_ompio_file_get_position (&data->ompio_fh, &prev_offset ); + mca_common_ompio_file_get_position (&data->ompio_fh, &prev_offset ); size = diskspace; if (size > current_size) { @@ -515,7 +204,7 @@ mca_io_ompio_file_preallocate (ompi_file_t *fh, } // This operation should not affect file pointer position. - ompi_io_ompio_set_explicit_offset ( &data->ompio_fh, prev_offset); + mca_common_ompio_set_explicit_offset ( &data->ompio_fh, prev_offset); } exit: @@ -530,9 +219,8 @@ exit: return ret; } -int -mca_io_ompio_file_set_size (ompi_file_t *fh, - OMPI_MPI_OFFSET_TYPE size) +int mca_io_ompio_file_set_size (ompi_file_t *fh, + OMPI_MPI_OFFSET_TYPE size) { int ret = OMPI_SUCCESS; OMPI_MPI_OFFSET_TYPE tmp; @@ -558,39 +246,25 @@ mca_io_ompio_file_set_size (ompi_file_t *fh, return ret; } -int -mca_io_ompio_file_get_size (ompi_file_t *fh, +int mca_io_ompio_file_get_size (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *size) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - ret = ompio_io_ompio_file_get_size(&data->ompio_fh,size); - - return ret; -} - -int -ompio_io_ompio_file_get_size (mca_io_ompio_file_t *ompio_fh, - OMPI_MPI_OFFSET_TYPE *size) -{ - int ret = OMPI_SUCCESS; - - ret = ompio_fh->f_fs->fs_file_get_size (ompio_fh, size); + ret = mca_common_ompio_file_get_size(&data->ompio_fh,size); return ret; } -int -mca_io_ompio_file_get_amode (ompi_file_t *fh, - int *amode) +int mca_io_ompio_file_get_amode (ompi_file_t *fh, + int *amode) { mca_io_ompio_data_t *data; data = (mca_io_ompio_data_t *) fh->f_io_selected_data; - *amode = data->ompio_fh.f_amode; return OMPI_SUCCESS; @@ -633,19 +307,17 @@ int mca_io_ompio_file_get_info (ompi_file_t *fh, return ret; } -int -mca_io_ompio_file_get_type_extent (ompi_file_t *fh, - struct ompi_datatype_t *datatype, - MPI_Aint *extent) +int mca_io_ompio_file_get_type_extent (ompi_file_t *fh, + struct ompi_datatype_t *datatype, + MPI_Aint *extent) { opal_datatype_type_extent (&datatype->super, extent); return OMPI_SUCCESS; } -int -mca_io_ompio_file_set_atomicity (ompi_file_t *fh, - int flag) +int mca_io_ompio_file_set_atomicity (ompi_file_t *fh, + int flag) { int tmp; mca_io_ompio_data_t *data; @@ -674,9 +346,8 @@ mca_io_ompio_file_set_atomicity (ompi_file_t *fh, return OMPI_SUCCESS; } -int -mca_io_ompio_file_get_atomicity (ompi_file_t *fh, - int *flag) +int mca_io_ompio_file_get_atomicity (ompi_file_t *fh, + int *flag) { mca_io_ompio_data_t *data; @@ -687,8 +358,7 @@ mca_io_ompio_file_get_atomicity (ompi_file_t *fh, return OMPI_SUCCESS; } -int -mca_io_ompio_file_sync (ompi_file_t *fh) +int mca_io_ompio_file_sync (ompi_file_t *fh) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; @@ -701,10 +371,9 @@ mca_io_ompio_file_sync (ompi_file_t *fh) } -int -mca_io_ompio_file_seek (ompi_file_t *fh, - OMPI_MPI_OFFSET_TYPE off, - int whence) +int mca_io_ompio_file_seek (ompi_file_t *fh, + OMPI_MPI_OFFSET_TYPE off, + int whence) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; @@ -739,14 +408,13 @@ mca_io_ompio_file_seek (ompi_file_t *fh, return OMPI_ERROR; } - ret = ompi_io_ompio_set_explicit_offset (&data->ompio_fh, + ret = mca_common_ompio_set_explicit_offset (&data->ompio_fh, offset/data->ompio_fh.f_etype_size); return ret; } -int -mca_io_ompio_file_get_position (ompi_file_t *fd, - OMPI_MPI_OFFSET_TYPE *offset) +int mca_io_ompio_file_get_position (ompi_file_t *fd, + OMPI_MPI_OFFSET_TYPE *offset) { int ret=OMPI_SUCCESS; mca_io_ompio_data_t *data=NULL; @@ -755,35 +423,15 @@ mca_io_ompio_file_get_position (ompi_file_t *fd, data = (mca_io_ompio_data_t *) fd->f_io_selected_data; fh = &data->ompio_fh; - ret = ompio_io_ompio_file_get_position (fh, offset); + ret = mca_common_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; - - /* No. of elements per view */ - off *= (fh->f_view_size / fh->f_etype_size); - - /* No of elements used in the current copy of the view */ - off += fh->f_total_bytes / fh->f_etype_size; - - *offset = off; - return OMPI_SUCCESS; -} - - -int -mca_io_ompio_file_get_byte_offset (ompi_file_t *fh, - OMPI_MPI_OFFSET_TYPE offset, - OMPI_MPI_OFFSET_TYPE *disp) +int mca_io_ompio_file_get_byte_offset (ompi_file_t *fh, + OMPI_MPI_OFFSET_TYPE offset, + OMPI_MPI_OFFSET_TYPE *disp) { mca_io_ompio_data_t *data; int i, k, index; @@ -821,10 +469,9 @@ mca_io_ompio_file_get_byte_offset (ompi_file_t *fh, return OMPI_SUCCESS; } -int -mca_io_ompio_file_seek_shared (ompi_file_t *fp, - OMPI_MPI_OFFSET_TYPE offset, - int whence) +int mca_io_ompio_file_seek_shared (ompi_file_t *fp, + OMPI_MPI_OFFSET_TYPE offset, + int whence) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; @@ -846,9 +493,8 @@ mca_io_ompio_file_seek_shared (ompi_file_t *fp, } -int -mca_io_ompio_file_get_position_shared (ompi_file_t *fp, - OMPI_MPI_OFFSET_TYPE * offset) +int mca_io_ompio_file_get_position_shared (ompi_file_t *fp, + OMPI_MPI_OFFSET_TYPE * offset) { int ret = OMPI_SUCCESS; mca_io_ompio_data_t *data; @@ -870,8 +516,7 @@ mca_io_ompio_file_get_position_shared (ompi_file_t *fp, return ret; } -int -mca_io_ompio_cart_based_grouping(mca_io_ompio_file_t *ompio_fh) +int mca_io_ompio_cart_based_grouping(mca_io_ompio_file_t *ompio_fh) { int k = 0; int j = 0; diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c index 1b68c5167f..419fd45429 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +50,7 @@ int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, /*Open the same file again without shared file pointer*/ /*-------------------------------------------------*/ shfileHandle = (mca_io_ompio_file_t *)malloc(sizeof(mca_io_ompio_file_t)); - ret = ompio_io_ompio_file_open(comm,filename,amode,info,shfileHandle,false); + ret = mca_common_ompio_file_open(comm,filename,amode,info,shfileHandle,false); if ( OMPI_SUCCESS != ret) { opal_output(0, "mca_sharedfp_addproc_file_open: Error during file open\n"); return ret; @@ -167,7 +167,7 @@ int mca_sharedfp_addproc_file_close (mca_io_ompio_file_t *fh) } /* Close the main file opened by this component*/ - err = ompio_io_ompio_file_close(sh->sharedfh); + err = mca_common_ompio_file_close(sh->sharedfh); /*free shared file pointer data struct*/ free(sh); diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c index eb074117e9..f259e8750d 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -56,7 +56,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, return OMPI_ERR_OUT_OF_RESOURCE; } - err = ompio_io_ompio_file_open ( comm, filename, amode, info, shfileHandle, false); + err = mca_common_ompio_file_open ( comm, filename, amode, info, shfileHandle, false); if ( OMPI_SUCCESS != err ) { opal_output(0, "mca_sharedfp_individual_file_open: Error during file open\n"); return err; @@ -111,7 +111,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, free ( datafilename ); return OMPI_ERR_OUT_OF_RESOURCE; } - err = ompio_io_ompio_file_open(MPI_COMM_SELF, datafilename, + err = mca_common_ompio_file_open(MPI_COMM_SELF, datafilename, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, datafilehandle, false); if ( OMPI_SUCCESS != err) { @@ -154,7 +154,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_individual_file_open: Error during memory allocation\n"); return OMPI_ERR_OUT_OF_RESOURCE; } - err = ompio_io_ompio_file_open ( MPI_COMM_SELF,metadatafilename, + err = mca_common_ompio_file_open ( MPI_COMM_SELF,metadatafilename, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, metadatafilehandle, false); if ( OMPI_SUCCESS != err) { @@ -206,7 +206,7 @@ int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh) /*Close datafile*/ if (headnode->datafilehandle) { /*TODO: properly deal with returned error code*/ - err = ompio_io_ompio_file_close(headnode->datafilehandle); + err = mca_common_ompio_file_close(headnode->datafilehandle); /* NOTE: No neeed to manually delete the file, ** the amode should have been set to delete on close */ @@ -218,7 +218,7 @@ int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh) /*Close metadatafile*/ if (headnode->metadatafilehandle) { /*TODO: properly deal with returned error code*/ - err = ompio_io_ompio_file_close(headnode->metadatafilehandle); + err = mca_common_ompio_file_close(headnode->metadatafilehandle); /* NOTE: No neeed to manually delete the file, ** the amode should have been set to delete on close */ @@ -229,7 +229,7 @@ int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh) } /* Close the main file opened by this component*/ - err = ompio_io_ompio_file_close(sh->sharedfh); + err = mca_common_ompio_file_close(sh->sharedfh); /*free shared file pointer data struct*/ free(sh); diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index 5c08b6a94e..d3854b6d17 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -51,7 +51,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, /*Open the same file again without shared file pointer support*/ /*------------------------------------------------------------*/ shfileHandle = (mca_io_ompio_file_t *)malloc(sizeof(mca_io_ompio_file_t)); - err = ompio_io_ompio_file_open(comm,filename,amode,info,shfileHandle,false); + err = mca_common_ompio_file_open(comm,filename,amode,info,shfileHandle,false); if ( OMPI_SUCCESS != err) { opal_output(0, "mca_sharedfp_lockedfile_file_open: Error during file open\n"); return err; @@ -170,7 +170,7 @@ int mca_sharedfp_lockedfile_file_close (mca_io_ompio_file_t *fh) } /* Close the main file opened by this component*/ - err = ompio_io_ompio_file_close(sh->sharedfh); + err = mca_common_ompio_file_close(sh->sharedfh); /*free shared file pointer data struct*/ free(sh); diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c index 83279be719..d02bde9177 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_seek.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) 2013 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,7 +88,7 @@ mca_sharedfp_lockedfile_seek (mca_io_ompio_file_t *fh, } else if( MPI_SEEK_END == whence ){ OMPI_MPI_OFFSET_TYPE end_position=0; - ompio_io_ompio_file_get_size(sh->sharedfh,&end_position); + mca_common_ompio_file_get_size(sh->sharedfh,&end_position); offset = end_position + offset; opal_output(ompi_sharedfp_base_framework.framework_output, "MPI_SEEK_END: file_get_size=%lld\n",end_position); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index da4ff93dbc..398916165b 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2013 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -69,7 +69,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, opal_output(0, "mca_sharedfp_sm_file_open: Error during memory allocation\n"); return OMPI_ERR_OUT_OF_RESOURCE; } - err = ompio_io_ompio_file_open(comm,filename,amode,info,shfileHandle,false); + err = mca_common_ompio_file_open(comm,filename,amode,info,shfileHandle,false); if ( OMPI_SUCCESS != err) { opal_output(0, "mca_sharedfp_sm_file_open: Error during file open\n"); free (shfileHandle); @@ -275,7 +275,7 @@ int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh) } /* Close the main file opened by this component*/ - err = ompio_io_ompio_file_close(sh->sharedfh); + err = mca_common_ompio_file_close(sh->sharedfh); /*free shared file pointer data struct*/ free(sh); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c b/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c index 7284291f06..d1e7006b68 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_seek.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_seek.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) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -95,7 +95,7 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh, } else if( MPI_SEEK_END == whence){ end_position=0; - ompio_io_ompio_file_get_size(sh->sharedfh,&end_position); + mca_common_ompio_file_get_size(sh->sharedfh,&end_position); offset = end_position + offset; if ( mca_sharedfp_sm_verbose ) {