diff --git a/ompi/mca/io/romio314/.gitignore b/ompi/mca/io/romio314/.gitignore new file mode 100644 index 0000000000..beaeb9ba92 --- /dev/null +++ b/ompi/mca/io/romio314/.gitignore @@ -0,0 +1,16 @@ +/Makefile +/.deps +/*.bb +/*.bbg +/*.gcda +/*.gcno +/.libs +/.libstamp* +/*.lo +/.*-cache +.state-cache +romio/version.m4 +romio/confdb/._l* +romio/confdb/config.rpath +romio/adio/include/romioconf.h.in +!romio/mpi2-other/**/Makefile.in diff --git a/ompi/mca/io/romio314/Makefile.am b/ompi/mca/io/romio314/Makefile.am new file mode 100644 index 0000000000..d3067c0e53 --- /dev/null +++ b/ompi/mca/io/romio314/Makefile.am @@ -0,0 +1,60 @@ +# +# 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) 2010-2014 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +EXTRA_DIST = autogen.subdirs + +sources = +include src/Makefile.extra + +if MCA_io_romio_SHOULD_BUILD +# Need to set both SUBDIRS and DIST_SUBDIRS due to oddities with AM +SUBDIRS = romio +DIST_SUBDIRS = romio +endif + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_ompi_io_romio_DSO +lib = +lib_sources = +component = mca_io_romio.la +component_sources = $(sources) +else +lib = libmca_io_romio.la +lib_sources = $(sources) +component = +component_sources = +endif + +libs = romio/libromio_dist.la + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_io_romio_la_SOURCES = $(component_sources) +mca_io_romio_la_LIBADD = $(libs) +mca_io_romio_la_DEPENDENCIES = $(libs) +mca_io_romio_la_LDFLAGS = -module -avoid-version + +noinst_LTLIBRARIES = $(lib) +libmca_io_romio_la_SOURCES = $(lib_sources) +libmca_io_romio_la_LIBADD = $(libs) +libmca_io_romio_la_DEPENDENCIES = $(libs) +libmca_io_romio_la_LDFLAGS = -module -avoid-version diff --git a/ompi/mca/io/romio314/autogen.subdirs b/ompi/mca/io/romio314/autogen.subdirs new file mode 100644 index 0000000000..4366870c93 --- /dev/null +++ b/ompi/mca/io/romio314/autogen.subdirs @@ -0,0 +1 @@ +romio diff --git a/ompi/mca/io/romio314/configure.m4 b/ompi/mca/io/romio314/configure.m4 new file mode 100644 index 0000000000..1506addf52 --- /dev/null +++ b/ompi/mca/io/romio314/configure.m4 @@ -0,0 +1,108 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2006 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-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AC_DEFUN([MCA_ompi_io_romio_POST_CONFIG], [ + AM_CONDITIONAL([MCA_io_romio_SHOULD_BUILD], [test $1 -eq 1]) +]) + + +# MCA_io_romio_CONFIG([action-if-found], [action-if-not-found]) +# ----------------------------------------------------------- +AC_DEFUN([MCA_ompi_io_romio_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/io/romio/Makefile]) + + OPAL_VAR_SCOPE_PUSH([io_romio_flags io_romio_flags_define io_romio_happy io_romio_save_LIBS]) + AC_ARG_ENABLE([io-romio], + [AC_HELP_STRING([--disable-io-romio], + [Disable the ROMIO MPI-IO component])]) + AC_ARG_WITH([io-romio-flags], + [AC_HELP_STRING([--with-io-romio-flags=FLAGS], + [Pass FLAGS to the ROMIO distribution configuration script])]) + AC_DEFINE_UNQUOTED([MCA_io_romio_USER_CONFIGURE_FLAGS], ["$with_io_romio_flags"], [Set of user-defined configure flags given to ROMIOs configure script via --with-io-romio-flags]) + AC_MSG_CHECKING([if want ROMIO component]) + AS_IF([test "$enable_io_romio" = "no"], + [AC_MSG_RESULT([no]) + $2], + [AC_MSG_RESULT([yes]) + AC_MSG_CHECKING([if MPI profiling is enabled]) + AS_IF([test "$enable_mpi_profile" = "no"], + [AC_MSG_RESULT([no]) + AC_MSG_WARN([*** The ROMIO io component requires the MPI profiling layer]) + AS_IF([test "$enable_io_romio" = "yes"], + [AC_MSG_ERROR([*** ROMIO requested but not available. Aborting])]) + $2], + [AC_MSG_RESULT([yes]) + + AS_IF([test -n "$with_io_romio_flags" -a "$with_io_romio_flags" != "no"], + [io_romio_flags="$with_io_romio_flags $io_romio_flags"], + [io_romio_flags=]) + # If ROMIO is going to end up in a DSO, all we need is + # shared library-ized objects, as we're only building a + # DSO (which is always shared). Otherwise, build with + # same flags as OMPI, as we might need any combination of + # shared and static-ized objects... + AS_IF([test "$compile_mode" = "dso"], + [io_romio_shared=enable + io_romio_static=disable], + [AS_IF([test "$enable_shared" = "yes"], + [io_romio_shared=enable], + [io_romio_shared=disable]) + AS_IF([test "$enable_static" = "yes"], + [io_romio_static=enable], + [io_romio_static=disable])]) + AS_IF([test -n "$prefix" -a "$prefix" != "NONE"], + [io_romio_prefix_arg="--prefix=$prefix"], + [io_romio_prefix_arg=]) + + AS_IF([test "$cross_compiling" = "yes"], + [AS_IF([test ! -z $build], [io_romio_flags="$io_romio_flags --build=$build"]) + AS_IF([test ! -z $host], [io_romio_flags="$io_romio_flags --host=$host"]) + AS_IF([test ! -z $target], [io_romio_flags="$io_romio_flags --target=$target"])]) + io_romio_flags_define="$io_romio_flags FROM_OMPI=yes CC='$CC' CFLAGS='$CFLAGS -D__EXTENSIONS__' CPPFLAGS='$CPPFLAGS' FFLAGS='$FFLAGS' LDFLAGS='$LDFLAGS' --$io_romio_shared-shared --$io_romio_static-static $io_romio_flags $io_romio_prefix_arg --disable-aio --disable-weak-symbols --enable-strict" + AC_DEFINE_UNQUOTED([MCA_io_romio_COMPLETE_CONFIGURE_FLAGS], ["$io_romio_flags_define"], [Complete set of command line arguments given to ROMIOs configure script]) + + io_romio_flags="$io_romio_flags FROM_OMPI=yes CC="'"'"$CC"'"'" CFLAGS="'"'"$CFLAGS -D__EXTENSIONS__"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LDFLAGS"'"'" --$io_romio_shared-shared --$io_romio_static-static $io_romio_flags $io_romio_prefix_arg --disable-aio --disable-weak-symbols --enable-strict" + + opal_show_subtitle "Configuring ROMIO distribution" + OPAL_CONFIG_SUBDIR([ompi/mca/io/romio/romio], + [$io_romio_flags], + [io_romio_happy=1], [io_romio_happy=0]) + + AS_IF([test "$io_romio_happy" = "1"], + [ # grab the libraries list from ROMIO. We don't + # need this for building the component, as libtool + # will figure that part out. But we do need it for + # the wrapper settings + io_romio_save_LIBS="$LIBS" + LIBS= + . ompi/mca/io/romio/romio/localdefs + io_romio_LIBS="$LIBS" + LIBS="$io_romio_save_LIBS" + + echo "ROMIO distribution configured successfully" + $1], + [AS_IF([test "$enable_io_romio" = "yes"], + [AC_MSG_ERROR([ROMIO distribution did not configure successfully])], + [AC_MSG_WARN([ROMIO distribution did not configure successfully])]) + $2])])]) + OPAL_VAR_SCOPE_POP +]) diff --git a/ompi/mca/io/romio314/owner.txt b/ompi/mca/io/romio314/owner.txt new file mode 100644 index 0000000000..61226d07ef --- /dev/null +++ b/ompi/mca/io/romio314/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: LANL/RIST +status: active diff --git a/ompi/mca/io/romio314/src/Makefile.extra b/ompi/mca/io/romio314/src/Makefile.extra new file mode 100644 index 0000000000..acc03b4f57 --- /dev/null +++ b/ompi/mca/io/romio314/src/Makefile.extra @@ -0,0 +1,46 @@ +# -*- makefile -*- +# +# 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$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AM_CPPFLAGS = \ + -I$(OMPI_TOP_BUILDDIR)/include \ + -I$(OMPI_TOP_BUILDDIR)/opal \ + -I$(OMPI_TOP_BUILDDIR)/opal/include \ + -I$(OMPI_TOP_SRCDIR)/opal \ + -I$(OMPI_TOP_SRCDIR)/opal/include \ + -I$(OMPI_TOP_BUILDDIR)/orte \ + -I$(OMPI_TOP_BUILDDIR)/orte/include \ + -I$(OMPI_TOP_SRCDIR)/orte \ + -I$(OMPI_TOP_SRCDIR)/orte/include \ + -I$(OMPI_TOP_BUILDDIR)/ompi \ + -I$(OMPI_TOP_BUILDDIR)/ompi/include \ + -I$(OMPI_TOP_SRCDIR)/ompi \ + -I$(OMPI_TOP_SRCDIR)/ompi/include \ + -I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio \ + -I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio/romio/include \ + -I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio/romio/adio/include \ + -I$(top_builddir) + +sources += \ + src/io_romio.h \ + src/io_romio_component.c \ + src/io_romio_file_open.c \ + src/io_romio_file_read.c \ + src/io_romio_file_write.c \ + src/io_romio_module.c + diff --git a/ompi/mca/io/romio314/src/io_romio.h b/ompi/mca/io/romio314/src/io_romio.h new file mode 100644 index 0000000000..c6c668312d --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio.h @@ -0,0 +1,274 @@ +/* + * 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 Sun Microsystems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_IO_ROMIO_H +#define MCA_IO_ROMIO_H + +#include "ompi_config.h" +#include "opal/threads/mutex.h" +#include "ompi/request/request.h" +#include "ompi/file/file.h" +#include "ompi/mca/io/io.h" +#include "romio/adio/include/romioconf.h" +#include "romio/include/mpio.h" + + +BEGIN_C_DECLS + +OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio_component; + +/* + * global variables, instantiated in module.c + */ +extern opal_mutex_t mca_io_romio_mutex; +extern mca_io_base_module_2_0_0_t mca_io_romio_module; +OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio_component; + +/* + * Private data for ROMIO modules + */ +struct mca_io_romio_data_t { + ROMIO_PREFIX (MPI_File) romio_fh; +}; +typedef struct mca_io_romio_data_t mca_io_romio_data_t; + + +/* + * Module functions + */ + + +/* + * mca->ROMIO module routines: + * ROMIO_PREFIX(file_XXX) + * ROMIO operations names: + * ROMIO_PREFIX(MPI_File_XXX) + */ +/* Section 9.2 */ +int mca_io_romio_file_open (struct ompi_communicator_t *comm, + char *filename, + int amode, + struct ompi_info_t *info, + ompi_file_t *fh); +int mca_io_romio_file_close (struct ompi_file_t *fh); +int mca_io_romio_file_delete (char *filename, + struct ompi_info_t *info); +int mca_io_romio_file_set_size (struct ompi_file_t *fh, + MPI_Offset size); +int mca_io_romio_file_preallocate (struct ompi_file_t *fh, + MPI_Offset size); +int mca_io_romio_file_get_size (struct ompi_file_t *fh, + MPI_Offset * size); +int mca_io_romio_file_get_amode (struct ompi_file_t *fh, + int *amode); +int mca_io_romio_file_set_info (struct ompi_file_t *fh, + struct ompi_info_t *info); +int mca_io_romio_file_get_info (struct ompi_file_t *fh, + struct ompi_info_t ** info_used); + +/* Section 9.3 */ +int mca_io_romio_file_set_view (struct ompi_file_t *fh, + MPI_Offset disp, + struct ompi_datatype_t *etype, + struct ompi_datatype_t *filetype, + char *datarep, + struct ompi_info_t *info); +int mca_io_romio_file_get_view (struct ompi_file_t *fh, + MPI_Offset * disp, + struct ompi_datatype_t ** etype, + struct ompi_datatype_t ** filetype, + char *datarep); + +/* Section 9.4.2 */ +int mca_io_romio_file_read_at (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_read_at_all (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write_at (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write_at_all (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_iread_at (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); +int mca_io_romio_file_iwrite_at (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); + +/* Section 9.4.3 */ +int mca_io_romio_file_read (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_read_all (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write_all (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_iread (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); +int mca_io_romio_file_iwrite (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); +int mca_io_romio_file_seek (struct ompi_file_t *fh, + MPI_Offset offset, + int whence); +int mca_io_romio_file_get_position (struct ompi_file_t *fh, + MPI_Offset * offset); +int mca_io_romio_file_get_byte_offset (struct ompi_file_t *fh, + MPI_Offset offset, + MPI_Offset * disp); + +/* Section 9.4.4 */ +int mca_io_romio_file_read_shared (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write_shared (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_iread_shared (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); +int mca_io_romio_file_iwrite_shared (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request); +int mca_io_romio_file_read_ordered (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_write_ordered (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status); +int mca_io_romio_file_seek_shared (struct ompi_file_t *fh, + MPI_Offset offset, + int whence); +int mca_io_romio_file_get_position_shared (struct ompi_file_t *fh, + MPI_Offset * offset); + +/* Section 9.4.5 */ +int mca_io_romio_file_read_at_all_begin (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_read_at_all_end (struct ompi_file_t *fh, + void *buf, + ompi_status_public_t * status); +int mca_io_romio_file_write_at_all_begin (struct ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_write_at_all_end (struct ompi_file_t *fh, + void *buf, + ompi_status_public_t * status); +int mca_io_romio_file_read_all_begin (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_read_all_end (struct ompi_file_t *fh, + void *buf, + ompi_status_public_t * status); +int mca_io_romio_file_write_all_begin (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_write_all_end (struct ompi_file_t *fh, + void *buf, + ompi_status_public_t * status); +int mca_io_romio_file_read_ordered_begin (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_read_ordered_end (struct ompi_file_t *fh, + void *buf, + ompi_status_public_t * status); +int mca_io_romio_file_write_ordered_begin (struct ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype); +int mca_io_romio_file_write_ordered_end (struct ompi_file_t *fh, + void *buf, + struct ompi_status_public_t * status); + +/* Section 9.5.1 */ +int mca_io_romio_file_get_type_extent (struct ompi_file_t *fh, + struct ompi_datatype_t *datatype, + MPI_Aint * extent); + +/* Section 9.6.1 */ +int mca_io_romio_file_set_atomicity (struct ompi_file_t *fh, + int flag); +int mca_io_romio_file_get_atomicity (struct ompi_file_t *fh, + int *flag); +int mca_io_romio_file_sync (struct ompi_file_t *fh); + +/* End Prototypes */ + +END_C_DECLS +#endif /* MCA_IO_ROMIO_H */ diff --git a/ompi/mca/io/romio314/src/io_romio_component.c b/ompi/mca/io/romio314/src/io_romio_component.c new file mode 100644 index 0000000000..26079df9d8 --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio_component.c @@ -0,0 +1,263 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 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-2011 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "mpi.h" +#include "opal/class/opal_list.h" +#include "opal/threads/mutex.h" +#include "opal/mca/base/base.h" +#include "ompi/mca/io/io.h" +#include "io_romio.h" + +#define ROMIO_VERSION_STRING "from MPICH v3.0.4" + +/* + * Private functions + */ +static int register_component(void); +static int open_component(void); +static int close_component(void); +static int init_query(bool enable_progress_threads, + bool enable_mpi_threads); +static const struct mca_io_base_module_2_0_0_t * + file_query(struct ompi_file_t *file, + struct mca_io_base_file_t **private_data, + int *priority); +static int file_unquery(struct ompi_file_t *file, + struct mca_io_base_file_t *private_data); + +static int delete_query(char *filename, struct ompi_info_t *info, + struct mca_io_base_delete_t **private_data, + bool *usable, int *priorty); +static int delete_select(char *filename, struct ompi_info_t *info, + struct mca_io_base_delete_t *private_data); + +static int register_datarep(char *, + MPI_Datarep_conversion_function*, + MPI_Datarep_conversion_function*, + MPI_Datarep_extent_function*, + void*); + +/* + * Private variables + */ +static int priority_param = 20; +static int delete_priority_param = 20; + + +/* + * Global, component-wide ROMIO mutex because ROMIO is not thread safe + */ +opal_mutex_t mca_io_romio_mutex; + + +/* + * Public string showing this component's version number + */ +const char *mca_io_romio_component_version_string = +"OMPI/MPI ROMIO io MCA component version " OMPI_VERSION ", " ROMIO_VERSION_STRING; + + +mca_io_base_component_2_0_0_t mca_io_romio_component = { + /* First, the mca_base_component_t struct containing meta information + about the component itself */ + + .io_version = { + MCA_IO_BASE_VERSION_2_0_0, + .mca_component_name = "romio", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_open_component = open_component, + .mca_close_component = close_component, + .mca_register_component_params = register_component, + }, + .io_data = { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + + /* Initial configuration / Open a new file */ + + .io_init_query = init_query, + .io_file_query = file_query, + .io_file_unquery = file_unquery, + + /* Delete a file */ + + .io_delete_query = delete_query, + .io_delete_select = delete_select, + + .io_register_datarep = register_datarep, +}; + +static char *ompi_io_romio_version = ROMIO_VERSION_STRING; +static char *ompi_io_romio_user_configure_params = MCA_io_romio_USER_CONFIGURE_FLAGS; +static char *ompi_io_romio_complete_configure_params = MCA_io_romio_COMPLETE_CONFIGURE_FLAGS; + +static int register_component(void) +{ + /* Use a low priority, but allow other components to be lower */ + priority_param = 10; + (void) mca_base_component_var_register(&mca_io_romio_component.io_version, + "priority", "Priority of the io romio component", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &priority_param); + delete_priority_param = 10; + (void) mca_base_component_var_register(&mca_io_romio_component.io_version, + "delete_priority", "Delete priority of the io romio component", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &delete_priority_param); + (void) mca_base_component_var_register(&mca_io_romio_component.io_version, + "version", "Version of ROMIO", MCA_BASE_VAR_TYPE_STRING, + NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio_version); + (void) mca_base_component_var_register(&mca_io_romio_component.io_version, + "user_configure_params", + "User-specified command line parameters passed to ROMIO's configure script", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, + MCA_BASE_VAR_FLAG_DEFAULT_ONLY, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio_user_configure_params); + (void) mca_base_component_var_register(&mca_io_romio_component.io_version, + "complete_configure_params", + "Complete set of command line parameters passed to ROMIO's configure script", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, + MCA_BASE_VAR_FLAG_DEFAULT_ONLY, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio_complete_configure_params); + + return OMPI_SUCCESS; +} + +static int open_component(void) +{ + /* Create the mutex */ + OBJ_CONSTRUCT(&mca_io_romio_mutex, opal_mutex_t); + + return OMPI_SUCCESS; +} + + +static int close_component(void) +{ + OBJ_DESTRUCT(&mca_io_romio_mutex); + + return OMPI_SUCCESS; +} + + +static int init_query(bool enable_progress_threads, + bool enable_mpi_threads) +{ + /* Note that it's ok if mpi_enable_threads==true here because we + self-enforce only allowing one user thread into ROMIO at a time + -- this fact will be clearly documented for users (ROMIO itself + is not thread safe). */ + + return OMPI_SUCCESS; +} + + +static const struct mca_io_base_module_2_0_0_t * +file_query(struct ompi_file_t *file, + struct mca_io_base_file_t **private_data, + int *priority) +{ + mca_io_romio_data_t *data; + + *priority = priority_param; + + /* Allocate a space for this module to hang private data (e.g., + the ROMIO file handle) */ + + data = malloc(sizeof(mca_io_romio_data_t)); + if (NULL == data) { + return NULL; + } + data->romio_fh = NULL; + *private_data = (struct mca_io_base_file_t*) data; + + /* All done */ + + return &mca_io_romio_module; +} + + +static int file_unquery(struct ompi_file_t *file, + struct mca_io_base_file_t *private_data) +{ + /* Free the romio module-specific data that was allocated in + _file_query(), above */ + + if (NULL != private_data) { + free(private_data); + } + + return OMPI_SUCCESS; +} + + +static int delete_query(char *filename, struct ompi_info_t *info, + struct mca_io_base_delete_t **private_data, + bool *usable, int *priority) +{ + *priority = delete_priority_param; + *usable = true; + *private_data = NULL; + + return OMPI_SUCCESS; +} + + +static int delete_select(char *filename, struct ompi_info_t *info, + struct mca_io_base_delete_t *private_data) +{ + int ret; + + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_delete)(filename, info); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +static int +register_datarep(char * datarep, + MPI_Datarep_conversion_function* read_fn, + MPI_Datarep_conversion_function* write_fn, + MPI_Datarep_extent_function* extent_fn, + void* state) +{ + int ret; + + OPAL_THREAD_LOCK(&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_Register_datarep(datarep, read_fn, write_fn, + extent_fn, state)); + OPAL_THREAD_UNLOCK(&mca_io_romio_mutex); + + return ret; +} diff --git a/ompi/mca/io/romio314/src/io_romio_file_open.c b/ompi/mca/io/romio314/src/io_romio_file_open.c new file mode 100644 index 0000000000..b19dd8d4dc --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio_file_open.c @@ -0,0 +1,367 @@ +/* + * 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$ + * + * 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 "io_romio.h" + + +int +mca_io_romio_file_open (ompi_communicator_t *comm, + char *filename, + int amode, + ompi_info_t *info, + ompi_file_t *fh) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, info, + &data->romio_fh); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_close (ompi_file_t *fh) +{ + int ret; + mca_io_romio_data_t *data; + + /* If we've already started MPI_Finalize by this point, then just + give up (because ROMIO's file close routine calls MPI_Barrier, + which we obviously can't do if we've started to MPI_Finalize). + The user didn't close the file, so they should expect + unexpected behavior. */ + if (ompi_mpi_finalized) { + return OMPI_SUCCESS; + } + + /* Because ROMIO expects the MPI library to provide error handler + * management routines but it doesn't ever participate in + * MPI_File_close, we have to somehow inform the MPI library that + * we no longer hold a reference to any user defined error + * handler. We do this by setting the errhandler at this point to + * MPI_ERRORS_RETURN. */ + if (fh->error_handler != &ompi_mpi_errors_return.eh) { + OBJ_RELEASE(fh->error_handler); + fh->error_handler = &ompi_mpi_errors_return.eh; + OBJ_RETAIN(fh->error_handler); + } + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_close) (&data->romio_fh); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_set_size (ompi_file_t *fh, + MPI_Offset size) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_set_size) (data->romio_fh, size); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_preallocate (ompi_file_t *fh, + MPI_Offset size) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_preallocate) (data->romio_fh, size); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_size (ompi_file_t *fh, + MPI_Offset * size) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_size) (data->romio_fh, size); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_amode (ompi_file_t *fh, + int *amode) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_amode) (data->romio_fh, amode); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_set_info (ompi_file_t *fh, + ompi_info_t *info) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, info); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_info (ompi_file_t *fh, + ompi_info_t ** info_used) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, info_used); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_set_view (ompi_file_t *fh, + MPI_Offset disp, + struct ompi_datatype_t *etype, + struct ompi_datatype_t *filetype, + char *datarep, + ompi_info_t *info) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype, + datarep, info); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_view (ompi_file_t *fh, + MPI_Offset * disp, + struct ompi_datatype_t ** etype, + struct ompi_datatype_t ** filetype, + char *datarep) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_get_view) (data->romio_fh, disp, etype, filetype, + datarep); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; + +} + + +int +mca_io_romio_file_get_type_extent (ompi_file_t *fh, + struct ompi_datatype_t *datatype, + MPI_Aint * extent) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_get_type_extent) (data->romio_fh, datatype, extent); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_set_atomicity (ompi_file_t *fh, + int flag) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_set_atomicity) (data->romio_fh, flag); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_get_atomicity (ompi_file_t *fh, + int *flag) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_atomicity) (data->romio_fh, flag); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_sync (ompi_file_t *fh) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_sync) (data->romio_fh); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_seek_shared (ompi_file_t *fh, + MPI_Offset offset, + int whence) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_seek_shared) (data->romio_fh, offset, whence); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_position_shared (ompi_file_t *fh, + MPI_Offset * offset) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_position_shared) (data->romio_fh, offset); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_seek (ompi_file_t *fh, + MPI_Offset offset, + int whence) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_seek) (data->romio_fh, offset, whence); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_position (ompi_file_t *fh, + MPI_Offset * offset) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_position) (data->romio_fh, offset); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_get_byte_offset (ompi_file_t *fh, + MPI_Offset offset, + MPI_Offset * disp) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_get_byte_offset) (data->romio_fh, offset, disp); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} diff --git a/ompi/mca/io/romio314/src/io_romio_file_read.c b/ompi/mca/io/romio314/src/io_romio_file_read.c new file mode 100644 index 0000000000..6f2e92aba3 --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio_file_read.c @@ -0,0 +1,327 @@ +/* + * 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$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "mpi.h" +#include "ompi/file/file.h" +#include "io_romio.h" + + +int +mca_io_romio_file_read_at (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_at) (data->romio_fh, offset, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_at_all (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_at_all) (data->romio_fh, offset, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_iread_at (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iread_at) (data->romio_fh, offset, buf, count, + datatype, request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read) (data->romio_fh, buf, count, datatype, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_all (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_all) (data->romio_fh, buf, count, datatype, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_iread (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iread) (data->romio_fh, buf, count, datatype, + request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_shared (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_shared) (data->romio_fh, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_iread_shared (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iread_shared) (data->romio_fh, buf, count, + datatype, request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_ordered (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_ordered) (data->romio_fh, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_at_all_begin (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_at_all_begin) (data->romio_fh, offset, buf, + count, datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_at_all_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_read_at_all_end) (data->romio_fh, buf, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_all_begin (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_all_begin) (data->romio_fh, buf, count, + datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_all_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_read_all_end) (data->romio_fh, buf, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_ordered_begin (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_read_ordered_begin) (data->romio_fh, buf, count, + datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_read_ordered_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_read_ordered_end) (data->romio_fh, buf, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} diff --git a/ompi/mca/io/romio314/src/io_romio_file_write.c b/ompi/mca/io/romio314/src/io_romio_file_write.c new file mode 100644 index 0000000000..686485364e --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio_file_write.c @@ -0,0 +1,320 @@ +/* + * 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$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "mpi.h" +#include "ompi/file/file.h" +#include "io_romio.h" + + +int +mca_io_romio_file_write_at (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write_at) (data->romio_fh, offset, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + + +int +mca_io_romio_file_write_at_all (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write_at_all) (data->romio_fh, offset, buf, + count, datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + + +int +mca_io_romio_file_iwrite_at (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iwrite_at) (data->romio_fh, offset, buf, count, + datatype, request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + + + + +int +mca_io_romio_file_write (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write) (data->romio_fh, buf, count, datatype, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_all (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write_all) (data->romio_fh, buf, count, datatype, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_iwrite (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iwrite) (data->romio_fh, buf, count, datatype, + request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + + +int +mca_io_romio_file_write_shared (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write_shared) (data->romio_fh, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_iwrite_shared (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_request_t **request) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_iwrite_shared) (data->romio_fh, buf, count, + datatype, request); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_ordered (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = + ROMIO_PREFIX(MPI_File_write_ordered) (data->romio_fh, buf, count, + datatype, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_at_all_begin (ompi_file_t *fh, + MPI_Offset offset, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_at_all_begin) (data->romio_fh, offset, + buf, count, datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_at_all_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_at_all_end) (data->romio_fh, buf, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_all_begin (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_all_begin) (data->romio_fh, buf, count, + datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_all_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_all_end) (data->romio_fh, buf, status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_ordered_begin (ompi_file_t *fh, + void *buf, + int count, + struct ompi_datatype_t *datatype) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_ordered_begin) (data->romio_fh, buf, + count, datatype); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} + +int +mca_io_romio_file_write_ordered_end (ompi_file_t *fh, + void *buf, + ompi_status_public_t * status) +{ + int ret; + mca_io_romio_data_t *data; + + data = (mca_io_romio_data_t *) fh->f_io_selected_data; + OPAL_THREAD_LOCK (&mca_io_romio_mutex); + ret = ROMIO_PREFIX(MPI_File_write_ordered_end) (data->romio_fh, buf, + status); + OPAL_THREAD_UNLOCK (&mca_io_romio_mutex); + + return ret; +} diff --git a/ompi/mca/io/romio314/src/io_romio_module.c b/ompi/mca/io/romio314/src/io_romio_module.c new file mode 100644 index 0000000000..0408100a03 --- /dev/null +++ b/ompi/mca/io/romio314/src/io_romio_module.c @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2008 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 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "mpi.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/io/io.h" +#include "io_romio.h" + + +/* + * Global functions that do not need to be prototyped in a header + * because ROMIO just expects these functions to exist. + */ +int MPIR_Status_set_bytes(ompi_status_public_t *status, + struct ompi_datatype_t *datatype, int size); +void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); + + +/* + * The ROMIO module operations + */ +mca_io_base_module_2_0_0_t mca_io_romio_module = { + /* Back end to MPI API calls (pretty much a 1-to-1 mapping) */ + + mca_io_romio_file_open, + mca_io_romio_file_close, + + mca_io_romio_file_set_size, + mca_io_romio_file_preallocate, + mca_io_romio_file_get_size, + mca_io_romio_file_get_amode, + mca_io_romio_file_set_info, + mca_io_romio_file_get_info, + mca_io_romio_file_set_view, + mca_io_romio_file_get_view, + + /* Index IO operations */ + mca_io_romio_file_read_at, + mca_io_romio_file_read_at_all, + mca_io_romio_file_write_at, + mca_io_romio_file_write_at_all, + mca_io_romio_file_iread_at, + mca_io_romio_file_iwrite_at, + + /* non-indexed IO operations */ + mca_io_romio_file_read, + mca_io_romio_file_read_all, + mca_io_romio_file_write, + mca_io_romio_file_write_all, + mca_io_romio_file_iread, + mca_io_romio_file_iwrite, + + mca_io_romio_file_seek, + mca_io_romio_file_get_position, + mca_io_romio_file_get_byte_offset, + + mca_io_romio_file_read_shared, + mca_io_romio_file_write_shared, + mca_io_romio_file_iread_shared, + mca_io_romio_file_iwrite_shared, + mca_io_romio_file_read_ordered, + mca_io_romio_file_write_ordered, + mca_io_romio_file_seek_shared, + mca_io_romio_file_get_position_shared, + + /* Split IO operations */ + mca_io_romio_file_read_at_all_begin, + mca_io_romio_file_read_at_all_end, + mca_io_romio_file_write_at_all_begin, + mca_io_romio_file_write_at_all_end, + mca_io_romio_file_read_all_begin, + mca_io_romio_file_read_all_end, + mca_io_romio_file_write_all_begin, + mca_io_romio_file_write_all_end, + mca_io_romio_file_read_ordered_begin, + mca_io_romio_file_read_ordered_end, + mca_io_romio_file_write_ordered_begin, + mca_io_romio_file_write_ordered_end, + + mca_io_romio_file_get_type_extent, + + /* Sync/atomic IO operations */ + mca_io_romio_file_set_atomicity, + mca_io_romio_file_get_atomicity, + mca_io_romio_file_sync +}; + + +/* + * This function is required by ROMIO to set information on an Open + * MPI status. Conveniently, it maps directly to + * MPI_Status_set_elements (almost like they planned that... hmmm...). + */ +int MPIR_Status_set_bytes(ompi_status_public_t *status, + struct ompi_datatype_t *datatype, int nbytes) +{ + /* Note that ROMIO is going to give a number of *bytes* here, but + MPI_STATUS_SET_ELEMENTS requires a number of *elements*. So + rather than try to do a conversion up here, just set the number + of bytes with MPI_CHAR as the datatype. If someone does a + GET_STATUS later, they have to supply their own datatype, and + we do the right calculations there. This prevents roundoff + errors here, potentially "losing" bytes in the process. */ + + MPI_Status_set_elements(status, MPI_CHAR, nbytes); + return MPI_SUCCESS; +} + + +void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) +{ + /* + * Open MPI contiguous check return true for datatype with + * gaps in the beginning and at the end. We have to provide + * a count of 2 in order to get these gaps taken into acount. + * In addition, if the data is contiguous but true_lb differes + * from zero, ROMIO will ignore the displacement. Thus, lie! + */ + *flag = ompi_datatype_is_contiguous_memory_layout(datatype, 2); + if (*flag) { + MPI_Aint true_extent, true_lb; + + ompi_datatype_get_true_extent(datatype, &true_lb, &true_extent); + + if (true_lb > 0) + *flag = 0; + } +}