From 9d35f6e1b5f0a52e1a81a0f397d3a1d0077ef767 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Wed, 31 May 2017 09:27:03 -0500 Subject: [PATCH] sharedfp: remove the addproc component from the 3.0.x branch Signed-off-by: Edgar Gabriel --- ompi/mca/sharedfp/addproc/.opal_ignore | 0 ompi/mca/sharedfp/addproc/.opal_unignore | 0 ompi/mca/sharedfp/addproc/Makefile.am | 64 ----- ompi/mca/sharedfp/addproc/owner.txt | 7 - ompi/mca/sharedfp/addproc/sharedfp_addproc.c | 97 -------- ompi/mca/sharedfp/addproc/sharedfp_addproc.h | 164 ------------- .../addproc/sharedfp_addproc_component.c | 104 -------- .../addproc/sharedfp_addproc_control.c | 231 ------------------ .../addproc/sharedfp_addproc_control.h | 37 --- .../addproc/sharedfp_addproc_file_open.c | 175 ------------- .../sharedfp/addproc/sharedfp_addproc_iread.c | 206 ---------------- .../addproc/sharedfp_addproc_iwrite.c | 200 --------------- .../sharedfp/addproc/sharedfp_addproc_read.c | 183 -------------- .../sharedfp_addproc_request_position.c | 75 ------ .../sharedfp/addproc/sharedfp_addproc_seek.c | 69 ------ .../sharedfp/addproc/sharedfp_addproc_write.c | 183 -------------- 16 files changed, 1795 deletions(-) delete mode 100644 ompi/mca/sharedfp/addproc/.opal_ignore delete mode 100644 ompi/mca/sharedfp/addproc/.opal_unignore delete mode 100644 ompi/mca/sharedfp/addproc/Makefile.am delete mode 100644 ompi/mca/sharedfp/addproc/owner.txt delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc.h delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_component.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_control.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_control.h delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_request_position.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_seek.c delete mode 100644 ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c diff --git a/ompi/mca/sharedfp/addproc/.opal_ignore b/ompi/mca/sharedfp/addproc/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ompi/mca/sharedfp/addproc/.opal_unignore b/ompi/mca/sharedfp/addproc/.opal_unignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ompi/mca/sharedfp/addproc/Makefile.am b/ompi/mca/sharedfp/addproc/Makefile.am deleted file mode 100644 index f8e9a5739b2..00000000000 --- a/ompi/mca/sharedfp/addproc/Makefile.am +++ /dev/null @@ -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-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 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_ompi_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 - -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 diff --git a/ompi/mca/sharedfp/addproc/owner.txt b/ompi/mca/sharedfp/addproc/owner.txt deleted file mode 100644 index f886026a69e..00000000000 --- a/ompi/mca/sharedfp/addproc/owner.txt +++ /dev/null @@ -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 diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc.c deleted file mode 100644 index 4e44715aee9..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h deleted file mode 100644 index e47afda7a82..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h +++ /dev/null @@ -1,164 +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$ - * - * 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 - -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 ompi_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 */ diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_component.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_component.c deleted file mode 100644 index 66bf463e0b9..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_component.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.c deleted file mode 100644 index 5287547573c..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.h b/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.h deleted file mode 100644 index 40072e57f40..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_control.h +++ /dev/null @@ -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 -#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 */ diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c deleted file mode 100644 index 5bea7fec6b3..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c +++ /dev/null @@ -1,175 +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/pml/pml.h" - -#include -#include -#include "ompi/mca/sharedfp/base/base.h" - - -int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, - const char* filename, - int amode, - struct ompi_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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c deleted file mode 100644 index bb765305933..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iread.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c deleted file mode 100644 index 011c494d28d..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_iwrite.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c deleted file mode 100644 index 02bb7a7817d..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_read.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_request_position.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_request_position.c deleted file mode 100644 index c9b84eac39e..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_request_position.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_seek.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_seek.c deleted file mode 100644 index daab8f81dc0..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_seek.c +++ /dev/null @@ -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; -} diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c deleted file mode 100644 index 2c555124a37..00000000000 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_write.c +++ /dev/null @@ -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; -}