1
1

ROMIO 3.2.1 refresh: prepare new romio directory ompi/mca/io/romio321

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2015-03-30 16:04:08 +09:00 коммит произвёл Gilles Gouaillardet
родитель 6a504a1544
Коммит 4272b57089
12 изменённых файлов: 2138 добавлений и 0 удалений

16
ompi/mca/io/romio321/.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

63
ompi/mca/io/romio321/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,63 @@
#
# 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-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
EXTRA_DIST = autogen.subdirs
sources =
include src/Makefile.extra
if MCA_io_romio321_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_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_ompi_io_romio321_DSO
lib =
lib_sources =
component = mca_io_romio321.la
component_sources = $(sources)
else
lib = libmca_io_romio321.la
lib_sources = $(sources)
component =
component_sources =
endif
libs = romio/libromio_dist.la
mcacomponentdir = $(ompilibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_io_romio321_la_SOURCES = $(component_sources)
mca_io_romio321_la_LIBADD = $(libs)
mca_io_romio321_la_DEPENDENCIES = $(libs)
mca_io_romio321_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(lib)
libmca_io_romio321_la_SOURCES = $(lib_sources)
libmca_io_romio321_la_LIBADD = $(libs)
libmca_io_romio321_la_DEPENDENCIES = $(libs)
libmca_io_romio321_la_LDFLAGS = -module -avoid-version

1
ompi/mca/io/romio321/autogen.subdirs Обычный файл
Просмотреть файл

@ -0,0 +1 @@
romio

108
ompi/mca/io/romio321/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-2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([MCA_ompi_io_romio321_POST_CONFIG], [
AM_CONDITIONAL([MCA_io_romio321_SHOULD_BUILD], [test $1 -eq 1])
])
# MCA_io_romio321_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_ompi_io_romio321_CONFIG],[
AC_CONFIG_FILES([ompi/mca/io/romio321/Makefile])
OPAL_VAR_SCOPE_PUSH([io_romio321_flags io_romio321_flags_define io_romio321_happy io_romio321_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_romio321_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" && test "$with_io_romio_flags" != "no"],
[io_romio321_flags="$with_io_romio_flags $io_romio321_flags"],
[io_romio321_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_romio321_shared=enable
io_romio321_static=disable],
[AS_IF([test "$enable_shared" = "yes"],
[io_romio321_shared=enable],
[io_romio321_shared=disable])
AS_IF([test "$enable_static" = "yes"],
[io_romio321_static=enable],
[io_romio321_static=disable])])
AS_IF([test -n "$prefix" && test "$prefix" != "NONE"],
[io_romio321_prefix_arg="--prefix=$prefix"],
[io_romio321_prefix_arg=])
AS_IF([test "$cross_compiling" = "yes"],
[AS_IF([test ! -z $build], [io_romio321_flags="$io_romio321_flags --build=$build"])
AS_IF([test ! -z $host], [io_romio321_flags="$io_romio321_flags --host=$host"])
AS_IF([test ! -z $target], [io_romio321_flags="$io_romio321_flags --target=$target"])])
io_romio321_flags_define="$io_romio321_flags FROM_OMPI=yes CC='$CC' CFLAGS='$CFLAGS -D__EXTENSIONS__' CPPFLAGS='$CPPFLAGS' FFLAGS='$FFLAGS' LDFLAGS='$LDFLAGS' --$io_romio321_shared-shared --$io_romio321_static-static $io_romio321_flags $io_romio321_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90"
AC_DEFINE_UNQUOTED([MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS], ["$io_romio321_flags_define"], [Complete set of command line arguments given to ROMIOs configure script])
io_romio321_flags="$io_romio321_flags FROM_OMPI=yes CC="'"'"$CC"'"'" CFLAGS="'"'"$CFLAGS -D__EXTENSIONS__"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LDFLAGS"'"'" --$io_romio321_shared-shared --$io_romio321_static-static $io_romio321_flags $io_romio321_prefix_arg --disable-aio --disable-weak-symbols --enable-strict --disable-f77 --disable-f90"
opal_show_subtitle "Configuring ROMIO distribution"
OPAL_CONFIG_SUBDIR([ompi/mca/io/romio321/romio],
[$io_romio321_flags],
[io_romio321_happy=1], [io_romio321_happy=0])
AS_IF([test "$io_romio321_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_romio321_save_LIBS="$LIBS"
LIBS=
. ompi/mca/io/romio321/romio/localdefs
io_romio321_LIBS="$LIBS"
LIBS="$io_romio321_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
])

7
ompi/mca/io/romio321/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

49
ompi/mca/io/romio321/src/Makefile.extra Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
# -*- 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 (c) 2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). 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/romio321 \
-I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio321/romio/include \
-I$(OMPI_TOP_SRCDIR)/ompi/mca/io/romio321/romio/adio/include \
-I$(top_builddir)
sources += \
src/io_romio321.h \
src/io_romio321_component.c \
src/io_romio321_file_open.c \
src/io_romio321_file_read.c \
src/io_romio321_file_write.c \
src/io_romio321_module.c

299
ompi/mca/io/romio321/src/io_romio321.h Обычный файл
Просмотреть файл

@ -0,0 +1,299 @@
/*
* 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 (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_IO_ROMIO321_H
#define MCA_IO_ROMIO321_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_romio321_component;
/*
* global variables, instantiated in module.c
*/
extern opal_mutex_t mca_io_romio321_mutex;
extern mca_io_base_module_2_0_0_t mca_io_romio321_module;
OMPI_DECLSPEC extern mca_io_base_component_2_0_0_t mca_io_romio321_component;
/*
* Private data for ROMIO modules
*/
struct mca_io_romio321_data_t {
ROMIO_PREFIX (MPI_File) romio_fh;
};
typedef struct mca_io_romio321_data_t mca_io_romio321_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_romio321_file_open (struct ompi_communicator_t *comm,
const char *filename,
int amode,
struct opal_info_t *info,
ompi_file_t *fh);
int mca_io_romio321_file_close (struct ompi_file_t *fh);
int mca_io_romio321_file_delete (const char *filename,
struct opal_info_t *info);
int mca_io_romio321_file_set_size (struct ompi_file_t *fh,
MPI_Offset size);
int mca_io_romio321_file_preallocate (struct ompi_file_t *fh,
MPI_Offset size);
int mca_io_romio321_file_get_size (struct ompi_file_t *fh,
MPI_Offset * size);
int mca_io_romio321_file_get_amode (struct ompi_file_t *fh,
int *amode);
int mca_io_romio321_file_set_info (struct ompi_file_t *fh,
struct opal_info_t *info);
int mca_io_romio321_file_get_info (struct ompi_file_t *fh,
struct opal_info_t ** info_used);
/* Section 9.3 */
int mca_io_romio321_file_set_view (struct ompi_file_t *fh,
MPI_Offset disp,
struct ompi_datatype_t *etype,
struct ompi_datatype_t *filetype,
const char *datarep,
struct opal_info_t *info);
int mca_io_romio321_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_romio321_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_romio321_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_romio321_file_write_at (struct ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_file_write_at_all (struct ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_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_romio321_file_iread_at_all (struct ompi_file_t *fh,
MPI_Offset offset,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iwrite_at (struct ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iwrite_at_all (struct ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
/* Section 9.4.3 */
int mca_io_romio321_file_read (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_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_romio321_file_write (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_file_write_all (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_file_iread (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iread_all (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iwrite (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iwrite_all (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_seek (struct ompi_file_t *fh,
MPI_Offset offset,
int whence);
int mca_io_romio321_file_get_position (struct ompi_file_t *fh,
MPI_Offset * offset);
int mca_io_romio321_file_get_byte_offset (struct ompi_file_t *fh,
MPI_Offset offset,
MPI_Offset * disp);
/* Section 9.4.4 */
int mca_io_romio321_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_romio321_file_write_shared (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_file_iread_shared (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_file_iwrite_shared (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request);
int mca_io_romio321_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_romio321_file_write_ordered (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status);
int mca_io_romio321_file_seek_shared (struct ompi_file_t *fh,
MPI_Offset offset,
int whence);
int mca_io_romio321_file_get_position_shared (struct ompi_file_t *fh,
MPI_Offset * offset);
/* Section 9.4.5 */
int mca_io_romio321_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_romio321_file_read_at_all_end (struct ompi_file_t *fh,
void *buf,
ompi_status_public_t * status);
int mca_io_romio321_file_write_at_all_begin (struct ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype);
int mca_io_romio321_file_write_at_all_end (struct ompi_file_t *fh,
const void *buf,
ompi_status_public_t * status);
int mca_io_romio321_file_read_all_begin (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype);
int mca_io_romio321_file_read_all_end (struct ompi_file_t *fh,
void *buf,
ompi_status_public_t * status);
int mca_io_romio321_file_write_all_begin (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype);
int mca_io_romio321_file_write_all_end (struct ompi_file_t *fh,
const void *buf,
ompi_status_public_t * status);
int mca_io_romio321_file_read_ordered_begin (struct ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype);
int mca_io_romio321_file_read_ordered_end (struct ompi_file_t *fh,
void *buf,
ompi_status_public_t * status);
int mca_io_romio321_file_write_ordered_begin (struct ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype);
int mca_io_romio321_file_write_ordered_end (struct ompi_file_t *fh,
const void *buf,
struct ompi_status_public_t * status);
/* Section 9.5.1 */
int mca_io_romio321_file_get_type_extent (struct ompi_file_t *fh,
struct ompi_datatype_t *datatype,
MPI_Aint * extent);
/* Section 9.6.1 */
int mca_io_romio321_file_set_atomicity (struct ompi_file_t *fh,
int flag);
int mca_io_romio321_file_get_atomicity (struct ompi_file_t *fh,
int *flag);
int mca_io_romio321_file_sync (struct ompi_file_t *fh);
/* End Prototypes */
END_C_DECLS
#endif /* MCA_IO_ROMIO321_H */

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

@ -0,0 +1,276 @@
/* -*- 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-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. 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_romio321.h"
#define ROMIO_VERSION_STRING "from MPICH v3.1.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(const char *filename, struct opal_info_t *info,
struct mca_io_base_delete_t **private_data,
bool *usable, int *priorty);
static int delete_select(const char *filename, struct opal_info_t *info,
struct mca_io_base_delete_t *private_data);
static int register_datarep(const 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_romio321_mutex = {{0}};
/*
* Public string showing this component's version number
*/
const char *mca_io_romio321_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_romio321_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 = "romio321",
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_romio321_version = ROMIO_VERSION_STRING;
static char *ompi_io_romio321_user_configure_params = MCA_io_romio321_USER_CONFIGURE_FLAGS;
static char *ompi_io_romio321_complete_configure_params = MCA_io_romio321_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_romio321_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_romio321_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_romio321_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_romio321_version);
(void) mca_base_component_var_register(&mca_io_romio321_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_romio321_user_configure_params);
(void) mca_base_component_var_register(&mca_io_romio321_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_romio321_complete_configure_params);
return OMPI_SUCCESS;
}
static int open_component(void)
{
/* Create the mutex */
OBJ_CONSTRUCT(&mca_io_romio321_mutex, opal_mutex_t);
return OMPI_SUCCESS;
}
static int close_component(void)
{
OBJ_DESTRUCT(&mca_io_romio321_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_romio321_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_romio321_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_romio321_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(const char *filename, struct opal_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(const char *filename, struct opal_info_t *info,
struct mca_io_base_delete_t *private_data)
{
int ret;
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
opal_info_dup (info, &opal_info);
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_delete)(filename, ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
ompi_info_free(&ompi_info);
return ret;
}
static int
register_datarep(const 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_romio321_mutex);
ret = ROMIO_PREFIX(MPI_Register_datarep(datarep, read_fn, write_fn,
extent_fn, state));
OPAL_THREAD_UNLOCK(&mca_io_romio321_mutex);
return ret;
}

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

@ -0,0 +1,411 @@
/*
* 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) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. 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_romio321.h"
int
mca_io_romio321_file_open (ompi_communicator_t *comm,
const char *filename,
int amode,
opal_info_t *info,
ompi_file_t *fh)
{
int ret;
mca_io_romio321_data_t *data;
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
opal_info_dup (info, &opal_info);
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
// OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info,
&data->romio_fh);
// OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
ompi_info_free(&ompi_info);
return ret;
}
int
mca_io_romio321_file_close (ompi_file_t *fh)
{
int ret;
mca_io_romio321_data_t *data;
int finalized;
/* 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. */
PMPI_Finalized(&finalized);
if (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_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_close) (&data->romio_fh);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_set_size (ompi_file_t *fh,
MPI_Offset size)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_set_size) (data->romio_fh, size);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_preallocate (ompi_file_t *fh,
MPI_Offset size)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_preallocate) (data->romio_fh, size);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_size (ompi_file_t *fh,
MPI_Offset * size)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_size) (data->romio_fh, size);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_amode (ompi_file_t *fh,
int *amode)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_amode) (data->romio_fh, amode);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_set_info (ompi_file_t *fh,
opal_info_t *info)
{
int ret;
mca_io_romio321_data_t *data;
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
opal_info_dup (info, &opal_info);
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
ompi_info_free(&ompi_info);
return ret;
}
int
mca_io_romio321_file_get_info (ompi_file_t *fh,
opal_info_t ** info_used)
{
int ret;
mca_io_romio321_data_t *data;
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, &ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
opal_info_dup (&(ompi_info->super), info_used);
ompi_info_free(&ompi_info);
return ret;
}
int
mca_io_romio321_file_set_view (ompi_file_t *fh,
MPI_Offset disp,
struct ompi_datatype_t *etype,
struct ompi_datatype_t *filetype,
const char *datarep,
opal_info_t *info)
{
int ret;
mca_io_romio321_data_t *data;
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
ompi_info_t *ompi_info;
ompi_info = OBJ_NEW(ompi_info_t);
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
opal_info_t *opal_info = &(ompi_info->super);
opal_info_dup (info, &opal_info);
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype,
datarep, ompi_info);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
ompi_info_free(&ompi_info);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_get_view) (data->romio_fh, disp, etype, filetype,
datarep);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_type_extent (ompi_file_t *fh,
struct ompi_datatype_t *datatype,
MPI_Aint * extent)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_get_type_extent) (data->romio_fh, datatype, extent);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_set_atomicity (ompi_file_t *fh,
int flag)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_set_atomicity) (data->romio_fh, flag);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_atomicity (ompi_file_t *fh,
int *flag)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_atomicity) (data->romio_fh, flag);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_sync (ompi_file_t *fh)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_sync) (data->romio_fh);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_seek_shared (ompi_file_t *fh,
MPI_Offset offset,
int whence)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_seek_shared) (data->romio_fh, offset, whence);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_position_shared (ompi_file_t *fh,
MPI_Offset * offset)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_position_shared) (data->romio_fh, offset);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_seek (ompi_file_t *fh,
MPI_Offset offset,
int whence)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_seek) (data->romio_fh, offset, whence);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_position (ompi_file_t *fh,
MPI_Offset * offset)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_position) (data->romio_fh, offset);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_get_byte_offset (ompi_file_t *fh,
MPI_Offset offset,
MPI_Offset * disp)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_get_byte_offset) (data->romio_fh, offset, disp);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}

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

@ -0,0 +1,382 @@
/*
* 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) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mpi.h"
#include "ompi/file/file.h"
#include "io_romio321.h"
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_at) (data->romio_fh, offset, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_at_all) (data->romio_fh, offset, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iread_at) (data->romio_fh, offset, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iread_at_all (ompi_file_t *fh,
MPI_Offset offset,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
// ----------------------------------------------------
// NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call.
// ----------------------------------------------------
// No support for non-blocking collective I/O operations.
// Fake it with individual non-blocking I/O operations.
// Similar to OMPIO
ret =
ROMIO_PREFIX(MPI_File_iread_at_all) (data->romio_fh, offset, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read) (data->romio_fh, buf, count, datatype,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_all) (data->romio_fh, buf, count, datatype,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iread (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iread) (data->romio_fh, buf, count, datatype,
request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iread_all (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
// ----------------------------------------------------
// NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call.
// ----------------------------------------------------
// No support for non-blocking collective I/O operations.
// Fake it with individual non-blocking I/O operations.
// Similar to OMPIO
ret =
ROMIO_PREFIX(MPI_File_iread_all) (data->romio_fh, buf, count, datatype,
request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_shared) (data->romio_fh, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iread_shared (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iread_shared) (data->romio_fh, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_ordered) (data->romio_fh, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_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_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_at_all_begin) (data->romio_fh, offset, buf,
count, datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read_at_all_end (ompi_file_t *fh,
void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_read_at_all_end) (data->romio_fh, buf, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read_all_begin (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_all_begin) (data->romio_fh, buf, count,
datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read_all_end (ompi_file_t *fh,
void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_read_all_end) (data->romio_fh, buf, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read_ordered_begin (ompi_file_t *fh,
void *buf,
int count,
struct ompi_datatype_t *datatype)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_read_ordered_begin) (data->romio_fh, buf, count,
datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_read_ordered_end (ompi_file_t *fh,
void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_read_ordered_end) (data->romio_fh, buf,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}

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

@ -0,0 +1,375 @@
/*
* 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) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mpi.h"
#include "ompi/file/file.h"
#include "io_romio321.h"
int
mca_io_romio321_file_write_at (ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write_at) (data->romio_fh, offset, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_at_all (ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write_at_all) (data->romio_fh, offset, buf,
count, datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iwrite_at (ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iwrite_at) (data->romio_fh, offset, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
// ----------------------------------------------------
// NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call.
// ----------------------------------------------------
// No support for non-blocking collective I/O operations.
// Fake it with individual non-blocking I/O operations.
// Similar to OMPIO
ret =
ROMIO_PREFIX(MPI_File_iwrite_at_all) (data->romio_fh, offset, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write) (data->romio_fh, buf, count, datatype,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_all (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write_all) (data->romio_fh, buf, count, datatype,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iwrite (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iwrite) (data->romio_fh, buf, count, datatype,
request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iwrite_all (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
// ----------------------------------------------------
// NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call.
// ----------------------------------------------------
// No support for non-blocking collective I/O operations.
// Fake it with individual non-blocking I/O operations.
// Similar to OMPIO
ret =
ROMIO_PREFIX(MPI_File_iwrite_all) (data->romio_fh, buf, count, datatype,
request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_shared (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write_shared) (data->romio_fh, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_iwrite_shared (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_request_t **request)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_iwrite_shared) (data->romio_fh, buf, count,
datatype, request);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_ordered (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret =
ROMIO_PREFIX(MPI_File_write_ordered) (data->romio_fh, buf, count,
datatype, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_at_all_begin (ompi_file_t *fh,
MPI_Offset offset,
const void *buf,
int count,
struct ompi_datatype_t *datatype)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_at_all_begin) (data->romio_fh, offset,
buf, count, datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_at_all_end (ompi_file_t *fh,
const void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_at_all_end) (data->romio_fh, buf,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_all_begin (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_all_begin) (data->romio_fh, buf, count,
datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_all_end (ompi_file_t *fh,
const void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_all_end) (data->romio_fh, buf, status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_ordered_begin (ompi_file_t *fh,
const void *buf,
int count,
struct ompi_datatype_t *datatype)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_ordered_begin) (data->romio_fh, buf,
count, datatype);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}
int
mca_io_romio321_file_write_ordered_end (ompi_file_t *fh,
const void *buf,
ompi_status_public_t * status)
{
int ret;
mca_io_romio321_data_t *data;
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
ret = ROMIO_PREFIX(MPI_File_write_ordered_end) (data->romio_fh, buf,
status);
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
return ret;
}

151
ompi/mca/io/romio321/src/io_romio321_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,151 @@
/*
* 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 (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). 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_romio321.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_romio321_module = {
/* Back end to MPI API calls (pretty much a 1-to-1 mapping) */
mca_io_romio321_file_open,
mca_io_romio321_file_close,
mca_io_romio321_file_set_size,
mca_io_romio321_file_preallocate,
mca_io_romio321_file_get_size,
mca_io_romio321_file_get_amode,
mca_io_romio321_file_set_view,
mca_io_romio321_file_get_view,
/* Index IO operations */
mca_io_romio321_file_read_at,
mca_io_romio321_file_read_at_all,
mca_io_romio321_file_write_at,
mca_io_romio321_file_write_at_all,
mca_io_romio321_file_iread_at,
mca_io_romio321_file_iwrite_at,
mca_io_romio321_file_iread_at_all,
mca_io_romio321_file_iwrite_at_all,
/* non-indexed IO operations */
mca_io_romio321_file_read,
mca_io_romio321_file_read_all,
mca_io_romio321_file_write,
mca_io_romio321_file_write_all,
mca_io_romio321_file_iread,
mca_io_romio321_file_iwrite,
mca_io_romio321_file_iread_all,
mca_io_romio321_file_iwrite_all,
mca_io_romio321_file_seek,
mca_io_romio321_file_get_position,
mca_io_romio321_file_get_byte_offset,
mca_io_romio321_file_read_shared,
mca_io_romio321_file_write_shared,
mca_io_romio321_file_iread_shared,
mca_io_romio321_file_iwrite_shared,
mca_io_romio321_file_read_ordered,
mca_io_romio321_file_write_ordered,
mca_io_romio321_file_seek_shared,
mca_io_romio321_file_get_position_shared,
/* Split IO operations */
mca_io_romio321_file_read_at_all_begin,
mca_io_romio321_file_read_at_all_end,
mca_io_romio321_file_write_at_all_begin,
mca_io_romio321_file_write_at_all_end,
mca_io_romio321_file_read_all_begin,
mca_io_romio321_file_read_all_end,
mca_io_romio321_file_write_all_begin,
mca_io_romio321_file_write_all_end,
mca_io_romio321_file_read_ordered_begin,
mca_io_romio321_file_read_ordered_end,
mca_io_romio321_file_write_ordered_begin,
mca_io_romio321_file_write_ordered_end,
mca_io_romio321_file_get_type_extent,
/* Sync/atomic IO operations */
mca_io_romio321_file_set_atomicity,
mca_io_romio321_file_get_atomicity,
mca_io_romio321_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;
}
}