Merge pull request #4940 from edgargabriel/topic/ompi-cleanup-march-2018
Topic/ompio cleanup march 2018
Этот коммит содержится в:
Коммит
c23dff24bc
@ -1,56 +0,0 @@
|
||||
#
|
||||
# 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-2011 University of Houston. All rights reserved.
|
||||
# Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# 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_fbtl_plfs_DSO
|
||||
component_noinst =
|
||||
component_install = mca_fbtl_plfs.la
|
||||
else
|
||||
component_noinst = libmca_fbtl_plfs.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
# Source files
|
||||
|
||||
fbtl_plfs_sources = \
|
||||
fbtl_plfs.h \
|
||||
fbtl_plfs.c \
|
||||
fbtl_plfs_component.c \
|
||||
fbtl_plfs_preadv.c \
|
||||
fbtl_plfs_ipreadv.c \
|
||||
fbtl_plfs_pwritev.c \
|
||||
fbtl_plfs_ipwritev.c
|
||||
|
||||
AM_CPPFLAGS = $(fbtl_plfs_CPPFLAGS)
|
||||
|
||||
mcacomponentdir = $(pkglibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_fbtl_plfs_la_SOURCES = $(fbtl_plfs_sources)
|
||||
mca_fbtl_plfs_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
|
||||
$(fbtl_plfs_LIBS)
|
||||
mca_fbtl_plfs_la_LDFLAGS = -module -avoid-version $(fbtl_plfs_LDFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_fbtl_plfs_la_SOURCES = $(fbtl_plfs_sources)
|
||||
libmca_fbtl_plfs_la_LIBADD = $(fbtl_plfs_LIBS)
|
||||
libmca_fbtl_plfs_la_LDFLAGS = -module -avoid-version $(fbtl_plfs_LDFLAGS)
|
@ -1,42 +0,0 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# 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 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2008-2014 University of Houston. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# MCA_fbtl_plfs_CONFIG(action-if-can-compile,
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
AC_DEFUN([MCA_ompi_fbtl_plfs_CONFIG],[
|
||||
AC_CONFIG_FILES([ompi/mca/fbtl/plfs/Makefile])
|
||||
|
||||
OMPI_CHECK_PLFS([fbtl_plfs],
|
||||
[fbtl_plfs_happy="yes"],
|
||||
[fbtl_plfs_happy="no"])
|
||||
|
||||
AS_IF([test "$fbtl_plfs_happy" = "yes"],
|
||||
[$1],
|
||||
[$2])
|
||||
|
||||
|
||||
# substitute in the things needed to build plfs
|
||||
AC_SUBST([fbtl_plfs_CPPFLAGS])
|
||||
AC_SUBST([fbtl_plfs_LDFLAGS])
|
||||
AC_SUBST([fbtl_plfs_LIBS])
|
||||
])dnl
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object fules,
|
||||
* keeping these symbols as the only symbols in this file prevents
|
||||
* utility programs such as "ompi_info" from having to import entire
|
||||
* modules just to query their version and parameters
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
#include "ompi/mca/fbtl/plfs/fbtl_plfs.h"
|
||||
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************ actions structure ************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
static mca_fbtl_base_module_1_0_0_t plfs = {
|
||||
mca_fbtl_plfs_module_init, /* initalise after being selected */
|
||||
mca_fbtl_plfs_module_finalize, /* close a module on a communicator */
|
||||
mca_fbtl_plfs_preadv, /* blocking read */
|
||||
NULL, /* non-blocking read */
|
||||
mca_fbtl_plfs_pwritev, /* blocking write */
|
||||
NULL, /* non-blocking write */
|
||||
NULL, /* module specific progress */
|
||||
NULL /* free module specific data items on the request */
|
||||
};
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************* structure ends **************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
|
||||
int mca_fbtl_plfs_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads) {
|
||||
/* Nothing to do */
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
struct mca_fbtl_base_module_1_0_0_t *
|
||||
mca_fbtl_plfs_component_file_query (mca_io_ompio_file_t *fh, int *priority) {
|
||||
*priority = mca_fbtl_plfs_priority;
|
||||
|
||||
if (PLFS == fh->f_fstype) {
|
||||
if (*priority < 50) {
|
||||
*priority = 50;
|
||||
}
|
||||
}
|
||||
return &plfs;
|
||||
}
|
||||
|
||||
int mca_fbtl_plfs_component_file_unquery (mca_io_ompio_file_t *file) {
|
||||
/* This function might be needed for some purposes later. for now it
|
||||
* does not have anything to do since there are no steps which need
|
||||
* to be undone if this module is not selected */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int mca_fbtl_plfs_module_init (mca_io_ompio_file_t *file) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int mca_fbtl_plfs_module_finalize (mca_io_ompio_file_t *file) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_FBTL_PLFS_H
|
||||
#define MCA_FBTL_PLFS_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/mca/mca.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
#include "ompi/mca/common/ompio/common_ompio.h"
|
||||
#include <plfs.h>
|
||||
|
||||
extern int mca_fbtl_plfs_priority;
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
int mca_fbtl_plfs_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads);
|
||||
struct mca_fbtl_base_module_1_0_0_t *
|
||||
mca_fbtl_plfs_component_file_query (mca_io_ompio_file_t *file, int *priority);
|
||||
int mca_fbtl_plfs_component_file_unquery (mca_io_ompio_file_t *file);
|
||||
|
||||
int mca_fbtl_plfs_module_init (mca_io_ompio_file_t *file);
|
||||
int mca_fbtl_plfs_module_finalize (mca_io_ompio_file_t *file);
|
||||
|
||||
OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_plfs_component;
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ********* functions which are implemented in this module *********
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
ssize_t mca_fbtl_plfs_preadv (mca_io_ompio_file_t *file );
|
||||
ssize_t mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *file );
|
||||
ssize_t mca_fbtl_plfs_ipreadv (mca_io_ompio_file_t *file,
|
||||
ompi_request_t **request);
|
||||
ssize_t mca_fbtl_plfs_ipwritev (mca_io_ompio_file_t *file,
|
||||
ompi_request_t **request);
|
||||
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ************ functions implemented in this module end ************
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_FBTL_PLFS_H */
|
@ -1,65 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* 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-2014 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fbtl_plfs.h"
|
||||
#include "mpi.h"
|
||||
|
||||
/*
|
||||
* Public string showing the fbtl plfs component version number
|
||||
*/
|
||||
const char *mca_fbtl_plfs_component_version_string =
|
||||
"OMPI/MPI plfs FBTL MCA component version " OMPI_VERSION;
|
||||
|
||||
int mca_fbtl_plfs_priority = 10;
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
mca_fbtl_base_component_2_0_0_t mca_fbtl_plfs_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
.fbtlm_version = {
|
||||
MCA_FBTL_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.mca_component_name = "plfs",
|
||||
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION),
|
||||
},
|
||||
.fbtlm_data = {
|
||||
/* This component is checkpointable */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
.fbtlm_init_query = mca_fbtl_plfs_component_init_query, /* get thread level */
|
||||
.fbtlm_file_query = mca_fbtl_plfs_component_file_query, /* get priority and actions */
|
||||
.fbtlm_file_unquery = mca_fbtl_plfs_component_file_unquery, /* undo what was done by previous function */
|
||||
};
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fbtl_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
|
||||
ssize_t mca_fbtl_plfs_ipreadv (mca_io_ompio_file_t *file,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
printf ("PLFS IPREADV\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fbtl_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include <unistd.h>
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
|
||||
ssize_t mca_fbtl_plfs_ipwritev (mca_io_ompio_file_t *fh,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
printf ("PLFS IPWRITEV\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fbtl_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include <unistd.h>
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
|
||||
ssize_t mca_fbtl_plfs_preadv (mca_io_ompio_file_t *fh )
|
||||
{
|
||||
|
||||
Plfs_fd *pfd = fh->f_fs_ptr;
|
||||
plfs_error_t plfs_ret;
|
||||
ssize_t total_bytes_read=0;
|
||||
int i;
|
||||
ssize_t bytes_read;
|
||||
|
||||
if (NULL == fh->f_io_array) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
|
||||
plfs_ret = plfs_read( pfd, fh->f_io_array[i].memory_address, fh->f_io_array[i].length,
|
||||
(off_t )fh->f_io_array[i].offset, &bytes_read );
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fbtl_plfs_preadv: Error in plfs_read:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (bytes_read < 0)
|
||||
return OMPI_ERROR;
|
||||
total_bytes_read += bytes_read;
|
||||
}
|
||||
|
||||
return total_bytes_read;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fbtl_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include <unistd.h>
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fbtl/fbtl.h"
|
||||
|
||||
ssize_t mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *fh )
|
||||
{
|
||||
Plfs_fd *pfd = fh->f_fs_ptr;
|
||||
plfs_error_t plfs_ret;
|
||||
ssize_t total_bytes_written=0;
|
||||
ssize_t bytes_written;
|
||||
int i;
|
||||
|
||||
if (NULL == fh->f_io_array) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
|
||||
plfs_ret = plfs_write( pfd, fh->f_io_array[i].memory_address,
|
||||
fh->f_io_array[i].length,
|
||||
(off_t) fh->f_io_array[i].offset,
|
||||
fh->f_rank, &bytes_written );
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fbtl_plfs_pwritev: Error in plfs_write:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
total_bytes_written += bytes_written;
|
||||
}
|
||||
|
||||
return total_bytes_written;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: UH
|
||||
status: active
|
@ -1,58 +0,0 @@
|
||||
#
|
||||
# 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-2014 University of Houston. All rights reserved.
|
||||
# Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# 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_fs_plfs_DSO
|
||||
component_noinst =
|
||||
component_install = mca_fs_plfs.la
|
||||
else
|
||||
component_noinst = libmca_fs_plfs.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
# Source files
|
||||
|
||||
fs_plfs_sources = \
|
||||
fs_plfs.h \
|
||||
fs_plfs.c \
|
||||
fs_plfs_component.c \
|
||||
fs_plfs_file_open.c \
|
||||
fs_plfs_file_close.c \
|
||||
fs_plfs_file_delete.c \
|
||||
fs_plfs_file_sync.c \
|
||||
fs_plfs_file_set_size.c \
|
||||
fs_plfs_file_get_size.c
|
||||
|
||||
AM_CPPFLAGS = $(fs_plfs_CPPFLAGS)
|
||||
|
||||
mcacomponentdir = $(pkglibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_fs_plfs_la_SOURCES = $(fs_plfs_sources)
|
||||
mca_fs_plfs_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
|
||||
$(fs_plfs_LIBS)
|
||||
mca_fs_plfs_la_LDFLAGS = -module -avoid-version $(fs_plfs_LDFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_fs_plfs_la_SOURCES = $(fs_plfs_sources)
|
||||
libmca_fs_plfs_la_LIBADD = $(fs_plfs_LIBS)
|
||||
libmca_fs_plfs_la_LDFLAGS = -module -avoid-version $(fs_plfs_LDFLAGS)
|
@ -1,41 +0,0 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# 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 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2008-2014 University of Houston. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# MCA_fs_plfs_CONFIG(action-if-can-compile,
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
AC_DEFUN([MCA_ompi_fs_plfs_CONFIG],[
|
||||
AC_CONFIG_FILES([ompi/mca/fs/plfs/Makefile])
|
||||
|
||||
OMPI_CHECK_PLFS([fs_plfs],
|
||||
[fs_plfs_happy="yes"],
|
||||
[fs_plfs_happy="no"])
|
||||
|
||||
AS_IF([test "$fs_plfs_happy" = "yes"],
|
||||
[$1],
|
||||
[$2])
|
||||
|
||||
# substitute in the things needed to build plfs
|
||||
AC_SUBST([fs_plfs_CPPFLAGS])
|
||||
AC_SUBST([fs_plfs_LDFLAGS])
|
||||
AC_SUBST([fs_plfs_LIBS])
|
||||
])dnl
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object fules,
|
||||
* keeping these symbols as the only symbols in this file prevents
|
||||
* utility programs such as "ompi_info" from having to import entire
|
||||
* modules just to query their version and parameters
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
#include "ompi/mca/fs/base/base.h"
|
||||
#include "ompi/mca/fs/plfs/fs_plfs.h"
|
||||
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
#include <sys/statfs.h> /* or <sys/vfs.h> */
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <plfs.h>
|
||||
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************ actions structure ************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
static mca_fs_base_module_1_0_0_t plfs = {
|
||||
mca_fs_plfs_module_init, /* initalise after being selected */
|
||||
mca_fs_plfs_module_finalize, /* close a module on a communicator */
|
||||
mca_fs_plfs_file_open,
|
||||
mca_fs_plfs_file_close,
|
||||
mca_fs_plfs_file_delete,
|
||||
mca_fs_plfs_file_set_size,
|
||||
mca_fs_plfs_file_get_size,
|
||||
mca_fs_plfs_file_sync
|
||||
};
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************* structure ends **************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
|
||||
int mca_fs_plfs_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
{
|
||||
/* Nothing to do */
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
struct mca_fs_base_module_1_0_0_t *
|
||||
mca_fs_plfs_component_file_query (mca_io_ompio_file_t *fh, int *priority)
|
||||
{
|
||||
int err;
|
||||
char *dir;
|
||||
struct statfs fsbuf;
|
||||
char *tmp;
|
||||
char wpath[1024];
|
||||
|
||||
/* The code in this function is based on the ADIO FS selection in ROMIO
|
||||
* Copyright (C) 1997 University of Chicago.
|
||||
* See COPYRIGHT notice in top-level directory.
|
||||
*/
|
||||
|
||||
*priority = mca_fs_plfs_priority;
|
||||
|
||||
tmp = strchr (fh->f_filename, ':');
|
||||
if (!tmp) {
|
||||
if (OMPIO_ROOT == fh->f_rank) {
|
||||
do {
|
||||
err = statfs (fh->f_filename, &fsbuf);
|
||||
} while (err && (errno == ESTALE));
|
||||
|
||||
if (err && (ENOENT == errno)) {
|
||||
mca_fs_base_get_parent_dir (fh->f_filename, &dir);
|
||||
err = statfs (dir, &fsbuf);
|
||||
free (dir);
|
||||
}
|
||||
|
||||
getcwd( wpath, sizeof(wpath) );
|
||||
if(is_plfs_path(wpath) == 1) {
|
||||
fh->f_fstype = PLFS;
|
||||
}
|
||||
}
|
||||
fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype),
|
||||
1,
|
||||
MPI_INT,
|
||||
OMPIO_ROOT,
|
||||
fh->f_comm,
|
||||
fh->f_comm->c_coll->coll_bcast_module);
|
||||
}
|
||||
else {
|
||||
if (!strncmp(fh->f_filename, "plfs:", 7) ||
|
||||
!strncmp(fh->f_filename, "PLFS:", 7)) {
|
||||
fh->f_fstype = PLFS;
|
||||
}
|
||||
}
|
||||
|
||||
if (PLFS == fh->f_fstype) {
|
||||
if (*priority < 50) {
|
||||
*priority = 50;
|
||||
return &plfs;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int mca_fs_plfs_component_file_unquery (mca_io_ompio_file_t *file)
|
||||
{
|
||||
/* This function might be needed for some purposes later. for now it
|
||||
* does not have anything to do since there are no steps which need
|
||||
* to be undone if this module is not selected */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int mca_fs_plfs_module_init (mca_io_ompio_file_t *file)
|
||||
{
|
||||
/* Make sure the file type is not overwritten by the last queried
|
||||
* component */
|
||||
file->f_fstype = PLFS;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int mca_fs_plfs_module_finalize (mca_io_ompio_file_t *file)
|
||||
{
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_FS_PLFS_H
|
||||
#define MCA_FS_PLFS_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/mca/mca.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
#include "ompi/mca/common/ompio/common_ompio.h"
|
||||
|
||||
#include <plfs.h>
|
||||
|
||||
extern int mca_fs_plfs_priority;
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
int mca_fs_plfs_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads);
|
||||
struct mca_fs_base_module_1_0_0_t *
|
||||
mca_fs_plfs_component_file_query (mca_io_ompio_file_t *fh, int *priority);
|
||||
int mca_fs_plfs_component_file_unquery (mca_io_ompio_file_t *file);
|
||||
|
||||
int mca_fs_plfs_module_init (mca_io_ompio_file_t *file);
|
||||
int mca_fs_plfs_module_finalize (mca_io_ompio_file_t *file);
|
||||
|
||||
OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_plfs_component;
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ********* functions which are implemented in this module *********
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
int mca_fs_plfs_file_open (struct ompi_communicator_t *comm,
|
||||
const char *filename,
|
||||
int amode,
|
||||
struct opal_info_t *info,
|
||||
mca_io_ompio_file_t *fh);
|
||||
|
||||
int mca_fs_plfs_file_close (mca_io_ompio_file_t *fh);
|
||||
|
||||
int mca_fs_plfs_file_delete (char *filename,
|
||||
struct opal_info_t *info);
|
||||
|
||||
int mca_fs_plfs_file_set_size (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE size);
|
||||
|
||||
int mca_fs_plfs_file_get_size (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE *size);
|
||||
|
||||
int mca_fs_plfs_file_sync (mca_io_ompio_file_t *fh);
|
||||
|
||||
int mca_fs_plfs_file_seek (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE offset,
|
||||
int whence);
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ************ functions implemented in this module end ************
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_FS_PLFS_H */
|
@ -1,81 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* 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-2014 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
#include "mpi.h"
|
||||
|
||||
/*
|
||||
* Public string showing the fs plfs component version number
|
||||
*/
|
||||
const char *mca_fs_plfs_component_version_string =
|
||||
"OMPI/MPI plfs FS MCA component version " OMPI_VERSION;
|
||||
|
||||
static int plfs_register(void);
|
||||
|
||||
int mca_fs_plfs_priority = 20;
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
mca_fs_base_component_2_0_0_t mca_fs_plfs_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
.fsm_version = {
|
||||
MCA_FS_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.mca_component_name = "plfs",
|
||||
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION),
|
||||
.mca_register_component_params = plfs_register,
|
||||
},
|
||||
.fsm_data = {
|
||||
/* This component is checkpointable */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
.fsm_init_query = mca_fs_plfs_component_init_query, /* get thread level */
|
||||
.fsm_file_query = mca_fs_plfs_component_file_query, /* get priority and actions */
|
||||
.fsm_file_unquery = mca_fs_plfs_component_file_unquery, /* undo what was done by previous function */
|
||||
};
|
||||
|
||||
static int
|
||||
plfs_register(void)
|
||||
{
|
||||
mca_fs_plfs_priority = 20;
|
||||
(void) mca_base_component_var_register(&mca_fs_plfs_component.fsm_version,
|
||||
"priority", "Priority of the plfs fs component",
|
||||
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_plfs_priority);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
|
||||
|
||||
/*
|
||||
* file_close_plfs
|
||||
*
|
||||
* Function: - closes a new file
|
||||
* Accepts: - file handle
|
||||
* Returns: - Success if file closed
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_close (mca_io_ompio_file_t *fh)
|
||||
{
|
||||
int flags;
|
||||
plfs_error_t plfs_ret = PLFS_SUCCESS;
|
||||
int amode;
|
||||
char wpath[1024];
|
||||
|
||||
fh->f_comm->c_coll->coll_barrier (fh->f_comm,
|
||||
fh->f_comm->c_coll->coll_barrier_module);
|
||||
|
||||
getcwd( wpath, sizeof(wpath) );
|
||||
sprintf( wpath,"%s/%s",wpath,fh->f_filename );
|
||||
|
||||
plfs_ret = plfs_access(wpath, F_OK);
|
||||
if ( PLFS_SUCCESS != plfs_ret ) {
|
||||
opal_output(0, "fs_plfs_file_close: Error in plfs_access:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR; // file doesn't exist
|
||||
}
|
||||
|
||||
amode = 0;
|
||||
if (fh->f_amode & MPI_MODE_CREATE)
|
||||
amode = amode | O_CREAT;
|
||||
if (fh->f_amode & MPI_MODE_RDONLY)
|
||||
amode = amode | O_RDONLY;
|
||||
if (fh->f_amode & MPI_MODE_WRONLY)
|
||||
amode = amode | O_WRONLY;
|
||||
if (fh->f_amode & MPI_MODE_RDWR)
|
||||
amode = amode | O_RDWR;
|
||||
if (fh->f_amode & MPI_MODE_EXCL) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
plfs_ret = plfs_sync(fh->f_fs_ptr);
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_close: Error in plfs_sync:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
plfs_ret = plfs_close(fh->f_fs_ptr, fh->f_rank, 0, amode ,NULL, &flags);
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_close: Error in plfs_close:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
|
||||
/*
|
||||
* file_delete_plfs
|
||||
*
|
||||
* Function: - deletes a file
|
||||
* Accepts: - file name & info
|
||||
* Returns: - Success if file closed
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_delete (char* file_name,
|
||||
struct opal_info_t *info)
|
||||
{
|
||||
plfs_error_t plfs_ret;
|
||||
char wpath[1024];
|
||||
getcwd( wpath, sizeof(wpath) );
|
||||
sprintf( wpath,"%s/%s",wpath,file_name );
|
||||
plfs_ret = plfs_unlink( wpath );
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_delete: Error in plfs_unlink:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
|
||||
/*
|
||||
* file_get_size_plfs
|
||||
*
|
||||
* Function: - get_size of a file
|
||||
* Accepts: - same arguments as MPI_File_get_size()
|
||||
* Returns: - Success if size is get
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_get_size (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE *size)
|
||||
{
|
||||
Plfs_fd *pfd = NULL;
|
||||
plfs_error_t plfs_ret;
|
||||
struct stat st;
|
||||
char wpath[1024];
|
||||
int size_only = 1;
|
||||
|
||||
getcwd(wpath, sizeof(wpath));
|
||||
sprintf(wpath,"%s/%s",wpath,fh->f_filename);
|
||||
|
||||
plfs_ret = plfs_getattr(pfd, wpath, &st, size_only);
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_get_size: Error in plfs_getattr:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
*size = st.st_size;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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-2014 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 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 "fs_plfs.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/info/info.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/*
|
||||
* file_open_plfs
|
||||
*
|
||||
* Function: - opens a new file
|
||||
* Accepts: - same arguments as MPI_File_open()
|
||||
* Returns: - Success if new file handle
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_open (struct ompi_communicator_t *comm,
|
||||
const char* filename,
|
||||
int access_mode,
|
||||
struct opal_info_t *info,
|
||||
mca_io_ompio_file_t *fh)
|
||||
{
|
||||
int rank;
|
||||
int amode;
|
||||
int old_mask, perm;
|
||||
plfs_error_t plfs_ret;
|
||||
Plfs_fd *pfd = NULL;
|
||||
char wpath[1024];
|
||||
|
||||
rank = ompi_comm_rank ( comm );
|
||||
|
||||
getcwd( wpath, sizeof(wpath) );
|
||||
sprintf( wpath,"%s/%s",wpath,filename );
|
||||
|
||||
if (OMPIO_PERM_NULL == fh->f_perm) {
|
||||
old_mask = umask(022);
|
||||
umask(old_mask);
|
||||
perm = old_mask ^ 0666;
|
||||
}
|
||||
else {
|
||||
perm = fh->f_perm;
|
||||
}
|
||||
|
||||
amode = 0;
|
||||
|
||||
if (access_mode & MPI_MODE_RDONLY)
|
||||
amode = amode | O_RDONLY;
|
||||
if (access_mode & MPI_MODE_WRONLY)
|
||||
amode = amode | O_WRONLY;
|
||||
if (access_mode & MPI_MODE_RDWR)
|
||||
amode = amode | O_RDWR;
|
||||
if (access_mode & MPI_MODE_EXCL) {
|
||||
if( is_plfs_path(wpath) == 1 ) { //the file already exists
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == rank) {
|
||||
/* MODE_CREATE and MODE_EXCL can only be set by one process */
|
||||
if (access_mode & MPI_MODE_CREATE)
|
||||
amode = amode | O_CREAT;
|
||||
|
||||
plfs_ret = plfs_open( &pfd, wpath, amode, fh->f_rank, perm, NULL );
|
||||
fh->f_fs_ptr = pfd;
|
||||
}
|
||||
|
||||
comm->c_coll->coll_bcast ( &plfs_ret, 1, MPI_INT, 0, comm, comm->c_coll->coll_bcast_module);
|
||||
if ( PLFS_SUCCESS != plfs_ret ) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (0 != rank) {
|
||||
plfs_ret = plfs_open( &pfd, wpath, amode, fh->f_rank, perm, NULL );
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_open: Error in plfs_open:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
else {
|
||||
fh->f_fs_ptr = pfd;
|
||||
}
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
|
||||
/*
|
||||
* file_set_size_plfs
|
||||
*
|
||||
* Function: - set_size of a file
|
||||
* Accepts: - same arguments as MPI_File_set_size()
|
||||
* Returns: - Success if size is set
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_set_size (mca_io_ompio_file_t *file_handle,
|
||||
OMPI_MPI_OFFSET_TYPE size)
|
||||
{
|
||||
printf ("PLFS SET SIZE\n");
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2011 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-2014 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "fs_plfs.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/fs/fs.h"
|
||||
|
||||
/*
|
||||
* file_sync_plfs
|
||||
*
|
||||
* Function: - closes a new file
|
||||
* Accepts: - file handle
|
||||
* Returns: - Success if file closed
|
||||
*/
|
||||
int
|
||||
mca_fs_plfs_file_sync (mca_io_ompio_file_t *fh)
|
||||
{
|
||||
plfs_error_t plfs_ret;
|
||||
plfs_ret = plfs_sync( fh->f_fs_ptr );
|
||||
if (PLFS_SUCCESS != plfs_ret) {
|
||||
opal_output(0, "fs_plfs_file_sync: Error in plfs_sync:\n%s\n", strplfserr(plfs_ret));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: UH
|
||||
status: active
|
@ -72,7 +72,7 @@ OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
|
||||
|
||||
#define QUEUESIZE 2048
|
||||
#define MCA_IO_DEFAULT_FILE_VIEW_SIZE 4*1024*1024
|
||||
#define OMPIO_FCOLL_WANT_TIME_BREAKDOWN 1
|
||||
#define OMPIO_FCOLL_WANT_TIME_BREAKDOWN 0
|
||||
|
||||
#define OMPIO_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define OMPIO_MAX(a, b) (((a) < (b)) ? (b) : (a))
|
||||
|
@ -1,65 +0,0 @@
|
||||
#
|
||||
# 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) 2013 University of Houston. All rights reserved.
|
||||
# Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# 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_sharedfp_addproc_DSO
|
||||
component_noinst =
|
||||
component_install = mca_sharedfp_addproc.la
|
||||
else
|
||||
component_noinst = libmca_sharedfp_addproc.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(ompilibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_sharedfp_addproc_la_SOURCES = $(sources)
|
||||
mca_sharedfp_addproc_la_LDFLAGS = -module -avoid-version
|
||||
mca_sharedfp_addproc_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_sharedfp_addproc_la_SOURCES = $(sources)
|
||||
libmca_sharedfp_addproc_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
# Source files
|
||||
|
||||
#IMPORTANT: Update here when adding new source code files to the library
|
||||
sources = \
|
||||
sharedfp_addproc.h \
|
||||
sharedfp_addproc.c \
|
||||
sharedfp_addproc_component.c \
|
||||
sharedfp_addproc_seek.c \
|
||||
sharedfp_addproc_request_position.c \
|
||||
sharedfp_addproc_write.c \
|
||||
sharedfp_addproc_iwrite.c \
|
||||
sharedfp_addproc_read.c \
|
||||
sharedfp_addproc_iread.c \
|
||||
sharedfp_addproc_file_open.c
|
||||
|
||||
#The additional process is spawned by executing this executable
|
||||
bin_PROGRAMS = mca_sharedfp_addproc_control
|
||||
|
||||
mca_sharedfp_addproc_control_SOURCES = \
|
||||
sharedfp_addproc_control.h \
|
||||
sharedfp_addproc_control.c
|
||||
|
||||
mca_sharedfp_addproc_control_LDADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# owner/status file
|
||||
# owner: institution that is responsible for this package
|
||||
# status: e.g. active, maintenance, unmaintained
|
||||
#
|
||||
owner: UH
|
||||
status: maintenance
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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) 2013 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object fules,
|
||||
* keeping these symbols as the only symbols in this file prevents
|
||||
* utility programs such as "ompi_info" from having to import entire
|
||||
* modules just to query their version and parameters
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/addproc/sharedfp_addproc.h"
|
||||
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************ actions structure ************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
/* IMPORTANT: Update here when adding sharedfp component interface functions*/
|
||||
static mca_sharedfp_base_module_1_0_0_t addproc = {
|
||||
mca_sharedfp_addproc_module_init, /* initalise after being selected */
|
||||
mca_sharedfp_addproc_module_finalize, /* close a module on a communicator */
|
||||
mca_sharedfp_addproc_seek,
|
||||
mca_sharedfp_addproc_get_position,
|
||||
mca_sharedfp_addproc_read,
|
||||
mca_sharedfp_addproc_read_ordered,
|
||||
mca_sharedfp_addproc_read_ordered_begin,
|
||||
mca_sharedfp_addproc_read_ordered_end,
|
||||
mca_sharedfp_addproc_iread,
|
||||
mca_sharedfp_addproc_write,
|
||||
mca_sharedfp_addproc_write_ordered,
|
||||
mca_sharedfp_addproc_write_ordered_begin,
|
||||
mca_sharedfp_addproc_write_ordered_end,
|
||||
mca_sharedfp_addproc_iwrite,
|
||||
mca_sharedfp_addproc_file_open,
|
||||
mca_sharedfp_addproc_file_close
|
||||
};
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************* structure ends **************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
|
||||
int mca_sharedfp_addproc_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
{
|
||||
/* Nothing to do */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
struct mca_sharedfp_base_module_1_0_0_t *
|
||||
mca_sharedfp_addproc_component_file_query
|
||||
(mca_io_ompio_file_t *fh, int *priority) {
|
||||
*priority = mca_sharedfp_addproc_priority;
|
||||
|
||||
/*test, and update priority*/
|
||||
|
||||
return &addproc;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_component_file_unquery (mca_io_ompio_file_t *file)
|
||||
{
|
||||
/* This function might be needed for some purposes later. for now it
|
||||
* does not have anything to do since there are no steps which need
|
||||
* to be undone if this module is not selected */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_module_init (mca_io_ompio_file_t *file)
|
||||
{
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_module_finalize (mca_io_ompio_file_t *file)
|
||||
{
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_SHAREDFP_ADDPROC_H
|
||||
#define MCA_SHAREDFP_ADDPROC_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/mca/mca.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/common/ompio/common_ompio.h"
|
||||
#include <semaphore.h>
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
int mca_sharedfp_addproc_component_init_query(bool enable_progress_threads,
|
||||
bool enable_mpi_threads);
|
||||
struct mca_sharedfp_base_module_1_0_0_t *
|
||||
mca_sharedfp_addproc_component_file_query (mca_io_ompio_file_t *file, int *priority);
|
||||
int mca_sharedfp_addproc_component_file_unquery (mca_io_ompio_file_t *file);
|
||||
|
||||
int mca_sharedfp_addproc_module_init (mca_io_ompio_file_t *file);
|
||||
int mca_sharedfp_addproc_module_finalize (mca_io_ompio_file_t *file);
|
||||
|
||||
extern int mca_sharedfp_addproc_priority;
|
||||
extern int mca_sharedfp_addproc_verbose;
|
||||
#if 0
|
||||
extern char[MPI_MAX_HOSTNAME_LEN] mca_sharedfp_addproc_control_host;
|
||||
#endif
|
||||
|
||||
OMPI_MODULE_DECLSPEC extern mca_sharedfp_base_component_2_0_0_t mca_sharedfp_addproc_component;
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ********* functions which are implemented in this module *********
|
||||
* ******************************************************************
|
||||
*/
|
||||
/*IMPORANT: Update here when implementing functions from sharedfp API*/
|
||||
|
||||
int mca_sharedfp_addproc_seek (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE offset, int whence);
|
||||
int mca_sharedfp_addproc_get_position (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE * offset);
|
||||
int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm,
|
||||
const char* filename,
|
||||
int amode,
|
||||
struct opal_info_t *info,
|
||||
mca_io_ompio_file_t *fh);
|
||||
int mca_sharedfp_addproc_file_close (mca_io_ompio_file_t *fh);
|
||||
int mca_sharedfp_addproc_read (mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
|
||||
int mca_sharedfp_addproc_read_ordered (mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status
|
||||
);
|
||||
int mca_sharedfp_addproc_read_ordered_begin (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype);
|
||||
int mca_sharedfp_addproc_read_ordered_end (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
ompi_status_public_t *status);
|
||||
int mca_sharedfp_addproc_iread (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request);
|
||||
int mca_sharedfp_addproc_write (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status);
|
||||
int mca_sharedfp_addproc_write_ordered (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status);
|
||||
int mca_sharedfp_addproc_write_ordered_begin (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype);
|
||||
int mca_sharedfp_addproc_write_ordered_end (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
ompi_status_public_t *status);
|
||||
int mca_sharedfp_addproc_iwrite (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request);
|
||||
/****************************************************/
|
||||
/*The following are structures and definitions *
|
||||
* copied over directly from uhio codebase */
|
||||
/****************************************************/
|
||||
|
||||
/*This structure will hang off of the mca_sharedfp_base_data_t's
|
||||
*selected_module_data attribute
|
||||
*/
|
||||
struct mca_sharedfp_addproc_data
|
||||
{
|
||||
MPI_Comm intercom;
|
||||
};
|
||||
|
||||
typedef struct mca_sharedfp_addproc_data addproc_data;
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_request_position (struct mca_sharedfp_base_data_t * sh,
|
||||
int bytes_requested,
|
||||
OMPI_MPI_OFFSET_TYPE * offset);
|
||||
|
||||
#define DO_ACK 0 /* To be set by the Environment Variable*/
|
||||
#define REQUEST_TAG 99
|
||||
#define ACK_TAG 1
|
||||
#define OFFSET_TAG 98
|
||||
#define END_TAG 97
|
||||
|
||||
#define SEEK_END_TAG 91
|
||||
#define SEEK_SET_TAG 92
|
||||
#define SEEK_CUR_TAG 93
|
||||
#define GET_POSITION_TAG 94
|
||||
|
||||
#define NUM_OF_SPAWNS 1
|
||||
|
||||
struct list {
|
||||
|
||||
int procNo;
|
||||
long numBytesArrAddr;
|
||||
struct list *Next;
|
||||
};
|
||||
|
||||
struct Stat {
|
||||
int tag;
|
||||
int source;
|
||||
long* recvBuff;
|
||||
};
|
||||
|
||||
|
||||
double uhio_shared_gettime(void);
|
||||
|
||||
typedef struct list node;
|
||||
typedef struct Stat statusStruct;
|
||||
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ************ functions implemented in this module end ************
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_SHAREDFP_ADDPROC_H */
|
@ -1,104 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* 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) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
* These symbols are in a file by themselves to provide nice linker
|
||||
* semantics. Since linkers generally pull in symbols by object
|
||||
* files, keeping these symbols as the only symbols in this file
|
||||
* prevents utility programs such as "ompi_info" from having to import
|
||||
* entire components just to query their version and parameters.
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
#include "mpi.h"
|
||||
|
||||
/*
|
||||
* Public string showing the sharedfp addproc component version number
|
||||
*/
|
||||
const char *mca_sharedfp_addproc_component_version_string =
|
||||
"OMPI/MPI addproc SHAREDFP MCA component version " OMPI_VERSION;
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
int mca_sharedfp_addproc_priority=1;
|
||||
int mca_sharedfp_addproc_verbose=0;
|
||||
#if 0
|
||||
char[MPI_MAX_HOSTNAME_LEN] mca_sharedfp_addproc_control_host;
|
||||
#endif
|
||||
|
||||
static int addproc_register(void);
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
mca_sharedfp_base_component_2_0_0_t mca_sharedfp_addproc_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
.sharedfpm_version = {
|
||||
MCA_SHAREDFP_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.mca_component_name = "addproc",
|
||||
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION),
|
||||
.mca_register_component_params = addproc_register,
|
||||
},
|
||||
.sharedfpm_data = {
|
||||
/* This component is checkpointable */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
.sharedfpm_init_query = mca_sharedfp_addproc_component_init_query, /* get thread level */
|
||||
.sharedfpm_file_query = mca_sharedfp_addproc_component_file_query, /* get priority and actions */
|
||||
.sharedfpm_file_unquery = mca_sharedfp_addproc_component_file_unquery, /* undo what was done by previous function */
|
||||
};
|
||||
|
||||
|
||||
static int addproc_register(void)
|
||||
{
|
||||
mca_sharedfp_addproc_priority = 1;
|
||||
(void) mca_base_component_var_register(&mca_sharedfp_addproc_component.sharedfpm_version,
|
||||
"priority", "Priority of the addproc sharedfp component",
|
||||
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY, &mca_sharedfp_addproc_priority);
|
||||
mca_sharedfp_addproc_verbose = 0;
|
||||
(void) mca_base_component_var_register(&mca_sharedfp_addproc_component.sharedfpm_version,
|
||||
"verbose", "Verbosity of the addproc sharedfp component",
|
||||
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY, &mca_sharedfp_addproc_verbose);
|
||||
|
||||
|
||||
#if 0
|
||||
memset (mca_sharedfp_addproc_control_host, 0, MPI_MAX_HOSTNAME_LEN);
|
||||
(void) mca_base_component_var_register(&mca_sharedfp_addproc_component.sharedfpm_version,
|
||||
"control_host", "Name of the host where to spawn the control process(default:none)",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY, &mca_sharedfp_addproc_control_host);
|
||||
|
||||
#endif
|
||||
return OMPI_SUCCESS;
|
||||
}
|
@ -1,231 +0,0 @@
|
||||
/*
|
||||
* 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) 2013 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "sharedfp_addproc_control.h"
|
||||
|
||||
/* #define PRINT_TAG 1 */
|
||||
void nodeDelete(node **front, node **rear)
|
||||
{
|
||||
node *delNode;
|
||||
if ((*front) == NULL && (*rear)==NULL) {
|
||||
printf("The queue is empty\n");
|
||||
}
|
||||
else {
|
||||
delNode = *front;
|
||||
if (*front == *rear) {
|
||||
*rear = NULL;
|
||||
}
|
||||
(*front) = (*front)->Next;
|
||||
|
||||
free(delNode);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void nodeInsert(node **front, node **rear, int procNo, long numBytesArrAddr)
|
||||
{
|
||||
node *newNode;
|
||||
newNode = (node*)malloc(sizeof(node));
|
||||
|
||||
newNode->Next = NULL;
|
||||
newNode->procNo = procNo;
|
||||
newNode->numBytesArrAddr = numBytesArrAddr;
|
||||
|
||||
|
||||
if ((*front == NULL) && (*rear == NULL)) {
|
||||
*front = newNode;
|
||||
*rear = newNode;
|
||||
#if 0
|
||||
printf("Front and rear both NULL\n");
|
||||
#endif
|
||||
fflush(stdout);
|
||||
}
|
||||
else {
|
||||
(*rear)->Next = newNode;
|
||||
*rear=newNode;
|
||||
#if 0
|
||||
printf("Front and rear both not NULL\n");
|
||||
#endif
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int Check_Request_Offset(int tag_received)
|
||||
{
|
||||
#if 0
|
||||
printf("Tag received %d\n",tag_received);
|
||||
#endif
|
||||
|
||||
if (tag_received == REQUEST_TAG) {
|
||||
#if 0
|
||||
printf("Return from Check_Request_Offset\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Check_Acknowledgement(int tag_received)
|
||||
{
|
||||
if (tag_received == ACK_TAG)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int End_control_shared_request(int tag_received)
|
||||
{
|
||||
if (tag_received == END_TAG)
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
long recvBuff;
|
||||
long offsetValue;
|
||||
long endoffile;
|
||||
int size;
|
||||
int tag_received;
|
||||
int END_FLAG = 0;
|
||||
|
||||
int recvcount = 1;
|
||||
MPI_Status status;
|
||||
MPI_Comm parentComm;
|
||||
static MPI_Offset offset = 0;
|
||||
|
||||
/*statusStruct arr;*/
|
||||
|
||||
node *rear, *front;
|
||||
rear = front = NULL;
|
||||
|
||||
#if 0
|
||||
printf("addproc_control: MPI_INIT\n"); fflush(stdout);
|
||||
#endif
|
||||
MPI_Init(&argc,&argv);
|
||||
|
||||
#if 0
|
||||
printf("addproc_control: MPI_Comm_size\n"); fflush(stdout);
|
||||
#endif
|
||||
MPI_Comm_size(MPI_COMM_WORLD,&size);
|
||||
|
||||
|
||||
endoffile = 0;
|
||||
|
||||
#if 0
|
||||
printf("addproc_control: start listening\n"); fflush(stdout);
|
||||
#endif
|
||||
while(!END_FLAG) {
|
||||
|
||||
/* Receive request from other processes */
|
||||
MPI_Comm_get_parent(&parentComm);
|
||||
|
||||
MPI_Recv(&recvBuff,recvcount,OMPI_OFFSET_DATATYPE,MPI_ANY_SOURCE,MPI_ANY_TAG,parentComm,&status);
|
||||
tag_received = status.MPI_TAG;
|
||||
|
||||
switch (tag_received)
|
||||
{
|
||||
|
||||
case REQUEST_TAG:
|
||||
#if 0
|
||||
printf("addproc_control: Offset requested by the process %d\n",status.MPI_SOURCE); fflush(stdout);
|
||||
#endif
|
||||
/* Insert the node into the linked list */
|
||||
nodeInsert(&front,&rear,status.MPI_SOURCE,recvBuff);
|
||||
break;
|
||||
case END_TAG:
|
||||
#if 0
|
||||
printf("addproc_control: End Control tag received\n"); fflush(stdout);
|
||||
#endif
|
||||
END_FLAG = 1;
|
||||
break;
|
||||
case SEEK_SET_TAG:
|
||||
offset = recvBuff;
|
||||
MPI_Send(&offset,1,OMPI_OFFSET_DATATYPE,status.MPI_SOURCE,SEEK_SET_TAG,parentComm);
|
||||
#if 0
|
||||
printf("addproc_control: Seek set tag received\n"); fflush(stdout);
|
||||
#endif
|
||||
break;
|
||||
case SEEK_CUR_TAG:
|
||||
#if 0
|
||||
printf("addproc_control: Seek CUR Tag received\n"); fflush(stdout);
|
||||
#endif
|
||||
/*set the pointer to the offset*/
|
||||
offset += recvBuff;
|
||||
MPI_Send(&offset,1,OMPI_OFFSET_DATATYPE,status.MPI_SOURCE,SEEK_CUR_TAG,parentComm);
|
||||
break;
|
||||
case SEEK_END_TAG:
|
||||
#if 0
|
||||
printf("addproc_control: Seek END TAG received\n"); fflush(stdout);
|
||||
#endif
|
||||
offset = endoffile;
|
||||
offset += recvBuff;
|
||||
MPI_Send(&offset,1,OMPI_OFFSET_DATATYPE,status.MPI_SOURCE,SEEK_END_TAG,parentComm);
|
||||
break;
|
||||
case GET_POSITION_TAG:
|
||||
#if 0
|
||||
printf("\naddproc_control: Get Position tag received\n"); fflush(stdout);
|
||||
#endif
|
||||
/*Send the offset as requested*/
|
||||
MPI_Send(&offset,1,OMPI_OFFSET_DATATYPE,status.MPI_SOURCE,GET_POSITION_TAG,parentComm);
|
||||
break;
|
||||
default:
|
||||
printf("addproc_control: Unknown tag received\n"); fflush(stdout);
|
||||
break;
|
||||
}
|
||||
|
||||
while (front != NULL) {
|
||||
|
||||
offsetValue = offset;
|
||||
|
||||
offset += front->numBytesArrAddr;
|
||||
|
||||
/* Store the end of file */
|
||||
if (endoffile < offset)
|
||||
endoffile = offset;
|
||||
|
||||
|
||||
/* MPI_Send to the correct process */
|
||||
|
||||
MPI_Send(&offsetValue,1,OMPI_OFFSET_DATATYPE, front->procNo, OFFSET_TAG,
|
||||
parentComm);
|
||||
nodeDelete(&front,&rear);
|
||||
|
||||
}
|
||||
|
||||
} /* End of while(1) loop */
|
||||
|
||||
#if 0
|
||||
printf("addproc_control: finalizing mpi...\n"); fflush(stdout);
|
||||
#endif
|
||||
MPI_Finalize();
|
||||
|
||||
#if 0
|
||||
printf("addproc_control: Exiting...\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 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 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_SHAREDFP_addproc_control_H
|
||||
#define MCA_SHAREDFP_addproc_control_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "mpi.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
void nodeDelete(node **front, node **rear);
|
||||
void nodeInsert(node **front, node **rear, int procNo, long numBytesArrAddr);
|
||||
int Check_Request_Offset(int tag_received);
|
||||
int Check_Acknowledgement(int tag_received);
|
||||
int End_control_shared_request(int tag_received);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_SHAREDFP_addproc_control_H */
|
@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <sys/mman.h>
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm,
|
||||
const char* filename,
|
||||
int amode,
|
||||
struct opal_info_t *info,
|
||||
mca_io_ompio_file_t *fh)
|
||||
{
|
||||
int ret = OMPI_SUCCESS, err;
|
||||
int rank;
|
||||
struct mca_sharedfp_base_data_t* sh;
|
||||
mca_io_ompio_file_t * shfileHandle, *ompio_fh;
|
||||
MPI_Comm newInterComm;
|
||||
struct mca_sharedfp_addproc_data * addproc_data = NULL;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
|
||||
/*-------------------------------------------------*/
|
||||
/*Open the same file again without shared file pointer*/
|
||||
/*-------------------------------------------------*/
|
||||
shfileHandle = (mca_io_ompio_file_t *)malloc(sizeof(mca_io_ompio_file_t));
|
||||
ret = mca_common_ompio_file_open(comm,filename,amode,info,shfileHandle,false);
|
||||
if ( OMPI_SUCCESS != ret) {
|
||||
opal_output(0, "mca_sharedfp_addproc_file_open: Error during file open\n");
|
||||
return ret;
|
||||
}
|
||||
shfileHandle->f_fh = fh->f_fh;
|
||||
data = (mca_io_ompio_data_t *) fh->f_fh->f_io_selected_data;
|
||||
ompio_fh = &data->ompio_fh;
|
||||
|
||||
err = mca_common_ompio_set_view (shfileHandle,
|
||||
ompio_fh->f_disp,
|
||||
ompio_fh->f_etype,
|
||||
ompio_fh->f_orig_filetype,
|
||||
ompio_fh->f_datarep,
|
||||
MPI_INFO_NULL);
|
||||
|
||||
/*Memory is allocated here for the sh structure*/
|
||||
if ( mca_sharedfp_addproc_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_file_open: malloc f_sharedfp_ptr struct\n");
|
||||
}
|
||||
sh = (struct mca_sharedfp_base_data_t*)malloc(sizeof(struct mca_sharedfp_base_data_t));
|
||||
if ( NULL == sh ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_file_open: Error, unable to malloc f_sharedfp_ptr struct\n");
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/*Populate the sh file structure based on the implementation*/
|
||||
sh->sharedfh = shfileHandle; /* Shared file pointer*/
|
||||
sh->global_offset = 0; /* Global Offset*/
|
||||
sh->comm = comm; /* Communicator*/
|
||||
sh->selected_module_data = NULL;
|
||||
|
||||
rank = ompi_comm_rank ( sh->comm );
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_file_open: START spawn by rank=%d\n",rank);
|
||||
}
|
||||
|
||||
/*Spawn a new process which will maintain the offsets for this file open*/
|
||||
ret = MPI_Comm_spawn("mca_sharedfp_addproc_control", MPI_ARGV_NULL, 1, MPI_INFO_NULL,
|
||||
0, sh->comm, &newInterComm, &err);
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
opal_output(0, "mca_sharedfp_addproc_file_open: error spawning control process ret=%d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
/*If spawning successful*/
|
||||
if (newInterComm) {
|
||||
addproc_data = (struct mca_sharedfp_addproc_data*)malloc(sizeof(struct mca_sharedfp_addproc_data));
|
||||
if ( NULL == addproc_data ){
|
||||
opal_output (0,"mca_sharedfp_addproc_file_open: Error, unable to malloc addproc_data struct\n");
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/*Store the new Intercommunicator*/
|
||||
addproc_data->intercom = newInterComm;
|
||||
|
||||
/*save the addproc data*/
|
||||
sh->selected_module_data = addproc_data;
|
||||
/*remember the shared file handle*/
|
||||
fh->f_sharedfp_data = sh;
|
||||
}
|
||||
else{
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_file_open: DONE spawn by rank=%d, errcode[success=%d, err=%d]=%d\n",
|
||||
rank, MPI_SUCCESS, MPI_ERR_SPAWN, ret);
|
||||
ret = OMPI_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_file_close (mca_io_ompio_file_t *fh)
|
||||
{
|
||||
struct mca_sharedfp_base_data_t *sh=NULL;
|
||||
int err = OMPI_SUCCESS;
|
||||
long sendBuff = 0;
|
||||
int count = 1;
|
||||
int rank;
|
||||
struct mca_sharedfp_addproc_data * addproc_data = NULL;
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data){
|
||||
/* Can happen with lazy initialization of the sharedfp structures */
|
||||
if ( mca_sharedfp_addproc_verbose ) {
|
||||
opal_output(0, "sharedfp_addproc_file_close - shared file pointer structure not initialized\n");
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
rank = ompi_comm_rank ( sh->comm );
|
||||
|
||||
/* Make sure that all processes are ready to release the
|
||||
** shared file pointer resources
|
||||
*/
|
||||
sh->comm->c_coll->coll_barrier(sh->comm, sh->comm->c_coll->coll_barrier_module );
|
||||
|
||||
addproc_data = (struct mca_sharedfp_addproc_data*)(sh->selected_module_data);
|
||||
|
||||
if (addproc_data) {
|
||||
/*tell additional proc to stop listening*/
|
||||
if(0 == rank){
|
||||
MCA_PML_CALL(send( &sendBuff, count, OMPI_OFFSET_DATATYPE, 0, END_TAG,
|
||||
MCA_PML_BASE_SEND_STANDARD, addproc_data->intercom));
|
||||
}
|
||||
|
||||
/* Free intercommunicator */
|
||||
if(addproc_data->intercom){
|
||||
ompi_comm_free(&(addproc_data->intercom));
|
||||
}
|
||||
free(addproc_data);
|
||||
}
|
||||
|
||||
/* Close the main file opened by this component*/
|
||||
err = mca_common_ompio_file_close(sh->sharedfh);
|
||||
|
||||
/*free shared file pointer data struct*/
|
||||
free(sh);
|
||||
return err;
|
||||
}
|
@ -1,206 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_iread(mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
int count,
|
||||
ompi_datatype_t *datatype,
|
||||
MPI_Request * request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0;
|
||||
long bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_iread - shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Calculate the number of bytes to write */
|
||||
opal_datatype_type_size ( &datatype->super ,&numofBytes);
|
||||
bytesRequested = count * numofBytes;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_iread: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
/* Retrieve the shared file data struct */
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/*Request to the additional process for the offset*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset);
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if( OMPI_SUCCESS == ret ){
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_iread: Offset received is %lld\n",offset);
|
||||
}
|
||||
/* Read from the file */
|
||||
ret = mca_common_ompio_file_iread_at ( sh->sharedfh, offset, buf, count, datatype, request);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
int mca_sharedfp_addproc_read_ordered_begin(mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0, offsetReceived = 0;
|
||||
long sendBuff = 0;
|
||||
long *buff=NULL;
|
||||
long offsetBuff, bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
int rank, size, i;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_read_ordered_begin: shared file pointer "
|
||||
"structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if ( true == fh->f_split_coll_in_use ) {
|
||||
opal_output(0, "Only one split collective I/O operation allowed per "
|
||||
"file handle at any given point in time!\n");
|
||||
return MPI_ERR_REQUEST;
|
||||
}
|
||||
|
||||
/*Retrieve the new communicator*/
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/* Calculate the number of bytes to read*/
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
sendBuff = count * numofBytes;
|
||||
|
||||
/* Get the ranks in the communicator */
|
||||
rank = ompi_comm_rank ( sh->comm);
|
||||
size = ompi_comm_size ( sh->comm);
|
||||
|
||||
if ( 0 == rank ) {
|
||||
buff = (long*)malloc(sizeof(OMPI_MPI_OFFSET_TYPE) * size);
|
||||
if ( NULL == buff )
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
ret = sh->comm->c_coll->coll_gather( &sendBuff, 1, OMPI_OFFSET_DATATYPE,
|
||||
buff, 1, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_gather_module);
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* All the counts are present now in the recvBuff.
|
||||
The size of recvBuff is sizeof_newComm
|
||||
*/
|
||||
if ( 0 == rank ) {
|
||||
for (i = 0; i < size ; i ++) {
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered_begin: Buff is %ld\n",buff[i]);
|
||||
}
|
||||
bytesRequested += buff[i];
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered_begin: Bytes requested are %ld\n",
|
||||
bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
/* Request the offset to read bytesRequested bytes
|
||||
** only the root process needs to do the request,
|
||||
** since the root process will then tell the other
|
||||
** processes at what offset they should read their
|
||||
** share of the data.
|
||||
*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offsetReceived);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered_begin: Offset received is %lld\n",
|
||||
offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
|
||||
for (i = 1 ; i < size; i++) {
|
||||
buff[i] += buff[i-1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Scatter the results to the other processes*/
|
||||
ret = sh->comm->c_coll->coll_scatter ( buff, 1, OMPI_OFFSET_DATATYPE, &offsetBuff,
|
||||
1, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_scatter_module );
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*Each process now has its own individual offset in recvBUFF*/
|
||||
offset = offsetBuff - sendBuff;
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered_begin: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* read from the file */
|
||||
ret = mca_common_ompio_file_iread_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req);
|
||||
fh->f_split_coll_in_use = true;
|
||||
|
||||
exit:
|
||||
if ( NULL != buff ) {
|
||||
free ( buff );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_read_ordered_end(mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
ret = ompi_request_wait ( &fh->f_split_coll_req, status );
|
||||
|
||||
/* remove the flag again */
|
||||
fh->f_split_coll_in_use = false;
|
||||
return ret;
|
||||
}
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_addproc_iwrite(mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
ompi_datatype_t *datatype,
|
||||
MPI_Request * request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0;
|
||||
long bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_iwrite: shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Calculate the number of bytes to write */
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
bytesRequested = count * numofBytes;
|
||||
|
||||
/* Retrieve the shared file data struct */
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_iwrite: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
/* Request the offset to write bytesRequested bytes */
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset);
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if ( OMPI_SUCCESS == ret ) {
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_iwrite: Offset received is %lld\n",offset);
|
||||
}
|
||||
/* Write to the file */
|
||||
ret = mca_common_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_write_ordered_begin(mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0, offsetReceived = 0;
|
||||
long sendBuff = 0;
|
||||
long *buff=NULL;
|
||||
long offsetBuff;
|
||||
long bytesRequested = 0;
|
||||
int recvcnt = 1, sendcnt = 1;
|
||||
size_t numofBytes;
|
||||
int rank, size, i;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_write_ordered_begin:"
|
||||
" shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if ( true == fh->f_split_coll_in_use ) {
|
||||
opal_output(0, "Only one split collective I/O operation allowed per file handle "
|
||||
"at any given point in time!\n");
|
||||
return MPI_ERR_REQUEST;
|
||||
}
|
||||
|
||||
/*Retrieve the shared file pointer structure*/
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/* Calculate the number of bytes to write*/
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
sendBuff = count * numofBytes;
|
||||
|
||||
/* Get the ranks in the communicator */
|
||||
rank = ompi_comm_rank ( sh->comm );
|
||||
size = ompi_comm_size ( sh->comm );
|
||||
|
||||
if ( 0 == rank ) {
|
||||
buff = (long*)malloc(sizeof(OMPI_MPI_OFFSET_TYPE) * size);
|
||||
if ( NULL == buff )
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
ret = sh->comm->c_coll->coll_gather ( &sendBuff, sendcnt, OMPI_OFFSET_DATATYPE, buff,
|
||||
recvcnt, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_gather_module);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* All the counts are present now in the recvBuff.
|
||||
The size of recvBuff is sizeof_newComm
|
||||
*/
|
||||
if ( 0 == rank ) {
|
||||
for (i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered_begin: Bytes requested are %ld\n",
|
||||
bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
/* Request the offset to write bytesRequested bytes
|
||||
** only the root process needs to do the request,
|
||||
** since the root process will then tell the other
|
||||
** processes at what offset they should write their
|
||||
** share of the data.
|
||||
*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offsetReceived);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered_begin: Offset received is %lld\n",
|
||||
offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
for (i = 1 ; i < size; i++) {
|
||||
buff[i] += buff[i-1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Scatter the results to the other processes*/
|
||||
ret = sh->comm->c_coll->coll_scatter ( buff, sendcnt, OMPI_OFFSET_DATATYPE, &offsetBuff,
|
||||
recvcnt, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_scatter_module );
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*Each process now has its own individual offset in recvBUFF*/
|
||||
offset = offsetBuff - sendBuff;
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* write to the file */
|
||||
ret = mca_common_ompio_file_iwrite_at_all(sh->sharedfh,offset,buf,count,datatype,&fh->f_split_coll_req);
|
||||
fh->f_split_coll_in_use = true;
|
||||
|
||||
exit:
|
||||
if ( NULL != buff ) {
|
||||
free ( buff );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int mca_sharedfp_addproc_write_ordered_end(mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
ret = ompi_request_wait ( &fh->f_split_coll_req, status );
|
||||
|
||||
/* remove the flag again */
|
||||
fh->f_split_coll_in_use = false;
|
||||
return ret;
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_addproc_read ( mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0;
|
||||
long bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_read: shared file pointer "
|
||||
"structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Calculate the number of bytes to write */
|
||||
opal_datatype_type_size ( &datatype->super ,&numofBytes);
|
||||
bytesRequested = count * numofBytes;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_read: Bytes Requested is %ld\n", bytesRequested);
|
||||
}
|
||||
/* Retrieve the shared file data struct */
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/*Request to the additional process for the offset*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offset);
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if( OMPI_SUCCESS == ret ){
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_addproc_read: Offset received is %lld\n",offset);
|
||||
}
|
||||
/* Read from the file */
|
||||
ret = mca_common_ompio_file_read_at(sh->sharedfh,offset,buf,count,datatype,status);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_read_ordered (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0, offsetReceived = 0;
|
||||
long sendBuff = 0;
|
||||
long *buff=NULL;
|
||||
long offsetBuff, bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
int rank, size, i;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_read_ordered: shared file pointer "
|
||||
"structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/*Retrieve the new communicator*/
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/* Calculate the number of bytes to read*/
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
sendBuff = count * numofBytes;
|
||||
|
||||
/* Get the ranks in the communicator */
|
||||
rank = ompi_comm_rank ( sh->comm);
|
||||
size = ompi_comm_size ( sh->comm);
|
||||
|
||||
if ( 0 == rank ) {
|
||||
buff = (long*)malloc(sizeof(OMPI_MPI_OFFSET_TYPE) * size);
|
||||
if ( NULL == buff )
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
ret = sh->comm->c_coll->coll_gather( &sendBuff, 1, OMPI_OFFSET_DATATYPE,
|
||||
buff, 1, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_gather_module);
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* All the counts are present now in the recvBuff.
|
||||
The size of recvBuff is sizeof_newComm
|
||||
*/
|
||||
if ( 0 == rank ) {
|
||||
for (i = 0; i < size ; i ++) {
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered: Buff is %ld\n",buff[i]);
|
||||
}
|
||||
bytesRequested += buff[i];
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered: Bytes requested are %ld\n",
|
||||
bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
/* Request the offset to read bytesRequested bytes
|
||||
** only the root process needs to do the request,
|
||||
** since the root process will then tell the other
|
||||
** processes at what offset they should read their
|
||||
** share of the data.
|
||||
*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offsetReceived);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered: Offset received is %lld\n",
|
||||
offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
|
||||
for (i = 1 ; i < size; i++) {
|
||||
buff[i] += buff[i-1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Scatter the results to the other processes*/
|
||||
ret = sh->comm->c_coll->coll_scatter ( buff, 1, OMPI_OFFSET_DATATYPE, &offsetBuff,
|
||||
1, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_scatter_module );
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*Each process now has its own individual offset in recvBUFF*/
|
||||
offset = offsetBuff - sendBuff;
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_read_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* read from the file */
|
||||
ret = mca_common_ompio_file_read_at_all(sh->sharedfh,offset,buf,count,datatype,status);
|
||||
|
||||
exit:
|
||||
if ( NULL != buff ) {
|
||||
free ( buff );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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) 2013 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
|
||||
int mca_sharedfp_addproc_request_position(struct mca_sharedfp_base_data_t * sh,
|
||||
int bytes_requested,
|
||||
OMPI_MPI_OFFSET_TYPE *offset)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE position = 0;
|
||||
long sendBuff = bytes_requested ;
|
||||
int count = 1;
|
||||
|
||||
|
||||
struct mca_sharedfp_addproc_data * addproc_data = sh->selected_module_data;
|
||||
|
||||
*offset = 0;
|
||||
|
||||
ret = MCA_PML_CALL(send( &sendBuff, count, OMPI_OFFSET_DATATYPE, 0, REQUEST_TAG,
|
||||
MCA_PML_BASE_SEND_STANDARD, addproc_data->intercom));
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
return ret;
|
||||
}
|
||||
ret = MCA_PML_CALL(recv( &position, count, OMPI_OFFSET_DATATYPE, 0, OFFSET_TAG,
|
||||
addproc_data->intercom, MPI_STATUS_IGNORE));
|
||||
|
||||
*offset = position;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_get_position(mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE * offset)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_get_position - shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Retrieve the shared file data struct*/
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/* Requesting the offset to write 0 bytes,
|
||||
** returns the current offset w/o updating it
|
||||
*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh, 0, offset);
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
|
||||
int
|
||||
mca_sharedfp_addproc_seek (mca_io_ompio_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE offset, int whence)
|
||||
{
|
||||
int rank;
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE position = 0;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
struct mca_sharedfp_addproc_data * addproc_data = sh->selected_module_data;
|
||||
long buff = 0;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_write_ordered - shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
sh = fh->f_sharedfp_data;
|
||||
rank = ompi_comm_rank ( sh->comm );
|
||||
buff = offset;
|
||||
|
||||
|
||||
/* This is a collective call,
|
||||
* only one process needs to communicate with the */
|
||||
if(0 == rank){
|
||||
ret = MCA_PML_CALL(send ( &buff, 1, OMPI_OFFSET_DATATYPE, 0, whence,
|
||||
MCA_PML_BASE_SEND_STANDARD,
|
||||
addproc_data->intercom));
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
ret = MCA_PML_CALL(recv(&position, 1, OMPI_OFFSET_DATATYPE, 0, whence,
|
||||
addproc_data->intercom, MPI_STATUS_IGNORE));
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
ret = sh->comm->c_coll->coll_barrier(sh->comm, sh->comm->c_coll->coll_barrier_module);
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2017 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) 2013-2016 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "sharedfp_addproc.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_addproc_write (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0;
|
||||
long bytesRequested = 0;
|
||||
size_t numofBytes;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_write: shared file pointer structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Calculate the number of bytes to write*/
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
bytesRequested = count * numofBytes;
|
||||
|
||||
/*Retrieve the shared file data structure */
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write: sharedfp_addproc_write: Bytes Requested is %ld\n",
|
||||
bytesRequested);
|
||||
}
|
||||
|
||||
/*Request the offset to write bytesRequested bytes*/
|
||||
ret = mca_sharedfp_addproc_request_position( sh, bytesRequested, &offset);
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
if ( OMPI_SUCCESS == ret ) {
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write: Offset received is %lld\n",offset);
|
||||
}
|
||||
/* Write to the file */
|
||||
ret = mca_common_ompio_file_write_at(sh->sharedfh,offset,buf,count,datatype,status);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mca_sharedfp_addproc_write_ordered (mca_io_ompio_file_t *fh,
|
||||
const void *buf,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
OMPI_MPI_OFFSET_TYPE offset = 0, offsetReceived = 0;
|
||||
long sendBuff = 0;
|
||||
long *buff=NULL;
|
||||
long offsetBuff;
|
||||
long bytesRequested = 0;
|
||||
int recvcnt = 1, sendcnt = 1;
|
||||
size_t numofBytes;
|
||||
int rank, size, i;
|
||||
struct mca_sharedfp_base_data_t *sh = NULL;
|
||||
|
||||
if(NULL == fh->f_sharedfp_data){
|
||||
opal_output(0, "sharedfp_addproc_write_ordered: shared file pointer "
|
||||
"structure not initialized correctly\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/*Retrieve the shared file pointer structure*/
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
/* Calculate the number of bytes to write*/
|
||||
opal_datatype_type_size ( &datatype->super, &numofBytes);
|
||||
sendBuff = count * numofBytes;
|
||||
|
||||
/* Get the ranks in the communicator */
|
||||
rank = ompi_comm_rank ( sh->comm );
|
||||
size = ompi_comm_size ( sh->comm );
|
||||
|
||||
if ( 0 == rank ) {
|
||||
buff = (long*)malloc(sizeof(OMPI_MPI_OFFSET_TYPE) * size);
|
||||
if ( NULL == buff )
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
ret = sh->comm->c_coll->coll_gather ( &sendBuff, sendcnt, OMPI_OFFSET_DATATYPE, buff,
|
||||
recvcnt, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_gather_module);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* All the counts are present now in the recvBuff.
|
||||
The size of recvBuff is sizeof_newComm
|
||||
*/
|
||||
if ( 0 == rank ) {
|
||||
for (i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered: Bytes requested are %ld\n",
|
||||
bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
/* Request the offset to write bytesRequested bytes
|
||||
** only the root process needs to do the request,
|
||||
** since the root process will then tell the other
|
||||
** processes at what offset they should write their
|
||||
** share of the data.
|
||||
*/
|
||||
ret = mca_sharedfp_addproc_request_position(sh,bytesRequested,&offsetReceived);
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered: Offset received is %lld\n",
|
||||
offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
for (i = 1 ; i < size; i++) {
|
||||
buff[i] += buff[i-1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Scatter the results to the other processes*/
|
||||
ret = sh->comm->c_coll->coll_scatter ( buff, sendcnt, OMPI_OFFSET_DATATYPE, &offsetBuff,
|
||||
recvcnt, OMPI_OFFSET_DATATYPE, 0, sh->comm,
|
||||
sh->comm->c_coll->coll_scatter_module );
|
||||
if( OMPI_SUCCESS != ret ){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*Each process now has its own individual offset in recvBUFF*/
|
||||
offset = offsetBuff - sendBuff;
|
||||
offset /= sh->sharedfh->f_etype_size;
|
||||
|
||||
if ( mca_sharedfp_addproc_verbose ){
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_addproc_write_ordered: Offset returned is %lld\n",
|
||||
offset);
|
||||
}
|
||||
|
||||
/* write to the file */
|
||||
ret = mca_common_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status);
|
||||
|
||||
exit:
|
||||
if ( NULL != buff ) {
|
||||
free ( buff );
|
||||
}
|
||||
return ret;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user