root/ompi/mca/sharedfp/sharedfp.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2008-2018 University of Houston. All rights reserved.
  14  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * Copyright (c) 2015-2018 Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 
  26 #ifndef OMPI_MCA_SHAREDFP_H
  27 #define OMPI_MCA_SHAREDFP_H
  28 
  29 #include "ompi_config.h"
  30 #include "mpi.h"
  31 #include "ompi/mca/mca.h"
  32 #include "opal/mca/base/base.h"
  33 #include "ompi/request/request.h"
  34 #include "ompi/info/info.h"
  35 
  36 
  37 BEGIN_C_DECLS
  38 
  39 struct ompio_file_t;
  40 struct ompi_file_t;
  41 /*
  42  * Macro for use in components that are of type coll
  43  */
  44 #define MCA_SHAREDFP_BASE_VERSION_2_0_0 \
  45     OMPI_MCA_BASE_VERSION_2_1_0("sharedfp", 2, 0, 0)
  46 
  47 /*
  48  * This framework abstracts out operations of the shared filepointer
  49  * in MPI I/O. It is initialized by the OMPIO module whenever a file is
  50  * opened.
  51  *
  52  * These are the component function prototypes. These function pointers
  53  * go into the component structure. These functions (query() and finalize()
  54  * are called during sharedfp_base_select(). Each component is query() ied
  55  * and subsequently, all the unselected components are finalize() 'ed
  56  * so that any *stuff* they did during query() can be undone. By
  57  * similar logic, finalize() is also called on the component which
  58  * was selected when the communicator is being destroyed.
  59  *
  60  * So, to sum it up, every component carries 4 functions:
  61  * 1. open() - called during MPI_INIT
  62  * 2. close() - called during MPI_FINALIZE
  63  * 3. query() - called to select a particular component
  64  * 4. finalize() - called when actions taken during query have
  65  *                 to be undone
  66  * In addition, two functions, namely updating the value of a shared
  67  * file pointer and moving the shared file pointer (seek) have to be provided
  68  * by every module.
  69  */
  70 
  71 /*
  72  * **************** component struct *******************************
  73  * *********** These functions go in the component struct **********
  74  * **************** component struct *******************************
  75  */
  76 
  77 typedef int (*mca_sharedfp_base_component_init_query_1_0_0_fn_t)
  78 (bool enable_progress_threads,
  79  bool enable_mpi_threads);
  80 
  81 typedef struct mca_sharedfp_base_module_1_0_0_t *
  82         (*mca_sharedfp_base_component_file_query_1_0_0_fn_t)
  83         (struct ompio_file_t *file, int *priority);
  84 
  85 typedef int (*mca_sharedfp_base_component_file_unquery_1_0_0_fn_t)
  86         (struct ompio_file_t *file);
  87 
  88 /*
  89  * ****************** component struct ******************************
  90  * Structure for sharedfp v2.0.0 components.This is chained to MCA v2.0.0
  91  * ****************** component struct ******************************
  92  */
  93 
  94 struct mca_sharedfp_base_component_2_0_0_t {
  95     mca_base_component_t sharedfpm_version;
  96     mca_base_component_data_t sharedfpm_data;
  97 
  98     mca_sharedfp_base_component_init_query_1_0_0_fn_t sharedfpm_init_query;
  99     mca_sharedfp_base_component_file_query_1_0_0_fn_t sharedfpm_file_query;
 100     mca_sharedfp_base_component_file_unquery_1_0_0_fn_t sharedfpm_file_unquery;
 101 };
 102 typedef struct mca_sharedfp_base_component_2_0_0_t mca_sharedfp_base_component_2_0_0_t;
 103 typedef struct mca_sharedfp_base_component_2_0_0_t mca_sharedfp_base_component_t;
 104 
 105 /*
 106  * ***********************************************************************
 107  * ************************  Interface function definitions **************
 108  * These are the typedesharedfp for the function pointers to various sharedfp
 109  * backend functions which will be used by the various sharedfp components
 110  * ***********************************************************************
 111  */
 112 
 113 typedef int (*mca_sharedfp_base_module_init_1_0_0_fn_t)
 114 (struct ompio_file_t *file);
 115 
 116 typedef int (*mca_sharedfp_base_module_finalize_1_0_0_fn_t)
 117 (struct ompio_file_t *file);
 118 
 119 /* SHAREDFP function definitions */
 120 /* IMPORTANT: Update here when adding sharedfp component interface functions*/
 121 typedef int (*mca_sharedfp_base_module_seek_fn_t)(
 122         struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset, int whence);
 123 typedef int (*mca_sharedfp_base_module_get_position_fn_t)(
 124         struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE * offset);
 125 typedef int (*mca_sharedfp_base_module_write_fn_t)(
 126         struct ompio_file_t *fh,
 127         const void *buf,
 128         int count,
 129         struct ompi_datatype_t *datatype,
 130         ompi_status_public_t *status);
 131 typedef int (*mca_sharedfp_base_module_write_ordered_fn_t)(
 132         struct ompio_file_t *fh,
 133         const void *buf,
 134         int count,
 135         struct ompi_datatype_t *datatype,
 136         ompi_status_public_t *status);
 137 typedef int (*mca_sharedfp_base_module_write_ordered_begin_fn_t)(
 138         struct ompio_file_t *fh,
 139         const void *buf,
 140         int count,
 141         struct ompi_datatype_t *datatype);
 142 typedef int (*mca_sharedfp_base_module_write_ordered_end_fn_t)(
 143         struct ompio_file_t *fh,
 144         const void *buf,
 145         ompi_status_public_t *status);
 146 typedef int (*mca_sharedfp_base_module_iwrite_fn_t)(
 147         struct ompio_file_t *fh,
 148         const void *buf,
 149         int count,
 150         struct ompi_datatype_t *datatype,
 151         ompi_request_t ** request);
 152 typedef int (*mca_sharedfp_base_module_read_fn_t)(
 153         struct ompio_file_t *fh,
 154         void *buf,
 155         int count,
 156         struct ompi_datatype_t *datatype,
 157         ompi_status_public_t *status);
 158 typedef int (*mca_sharedfp_base_module_read_ordered_fn_t)(
 159         struct ompio_file_t *fh,
 160         void *buf,
 161         int count,
 162         struct ompi_datatype_t *datatype,
 163         ompi_status_public_t *status);
 164 typedef int (*mca_sharedfp_base_module_iread_fn_t)(
 165         struct ompio_file_t *fh,
 166         void *buf,
 167         int count,
 168         struct ompi_datatype_t *datatype,
 169         ompi_request_t ** request);
 170 typedef int (*mca_sharedfp_base_module_read_ordered_begin_fn_t)(
 171         struct ompio_file_t *fh,
 172         void *buf,
 173         int count,
 174         struct ompi_datatype_t *datatype);
 175 typedef int (*mca_sharedfp_base_module_read_ordered_end_fn_t)(
 176         struct ompio_file_t *fh,
 177         void *buf,
 178         ompi_status_public_t *status);
 179 typedef int (*mca_sharedfp_base_module_file_open_fn_t)(
 180         struct ompi_communicator_t *comm, const char *filename, int amode,
 181         struct opal_info_t *info, struct ompio_file_t *fh);
 182 typedef int (*mca_sharedfp_base_module_file_close_fn_t)(struct ompio_file_t *fh);
 183 
 184 
 185 /*
 186  * ***********************************************************************
 187  * ***************************  module structure *************************
 188  * ***********************************************************************
 189  */
 190 struct mca_sharedfp_base_module_1_0_0_t {
 191     /*
 192      * Per-file initialization function. This is called only
 193      * on the module which is selected. The finalize corresponding to
 194      * this function is present on the component struct above
 195      */
 196     mca_sharedfp_base_module_init_1_0_0_fn_t sharedfp_module_init;
 197     mca_sharedfp_base_module_finalize_1_0_0_fn_t sharedfp_module_finalize;
 198 
 199     /* SHAREDFP function pointers */
 200     /* IMPORTANT: Update here when adding sharedfp component interface functions*/
 201     mca_sharedfp_base_module_seek_fn_t        sharedfp_seek;
 202     mca_sharedfp_base_module_get_position_fn_t sharedfp_get_position;
 203     mca_sharedfp_base_module_read_fn_t        sharedfp_read;
 204     mca_sharedfp_base_module_read_ordered_fn_t        sharedfp_read_ordered;
 205     mca_sharedfp_base_module_read_ordered_begin_fn_t       sharedfp_read_ordered_begin;
 206     mca_sharedfp_base_module_read_ordered_end_fn_t       sharedfp_read_ordered_end;
 207     mca_sharedfp_base_module_iread_fn_t       sharedfp_iread;
 208     mca_sharedfp_base_module_write_fn_t       sharedfp_write;
 209     mca_sharedfp_base_module_write_ordered_fn_t       sharedfp_write_ordered;
 210     mca_sharedfp_base_module_write_ordered_begin_fn_t       sharedfp_write_ordered_begin;
 211     mca_sharedfp_base_module_write_ordered_end_fn_t       sharedfp_write_ordered_end;
 212     mca_sharedfp_base_module_iwrite_fn_t       sharedfp_iwrite;
 213     mca_sharedfp_base_module_file_open_fn_t   sharedfp_file_open;
 214     mca_sharedfp_base_module_file_close_fn_t  sharedfp_file_close;
 215 };
 216 typedef struct mca_sharedfp_base_module_1_0_0_t mca_sharedfp_base_module_1_0_0_t;
 217 typedef mca_sharedfp_base_module_1_0_0_t mca_sharedfp_base_module_t;
 218 
 219 
 220 /* This structure keeps all of the data needed by a sharedfp module.
 221  * This structure is assigned to the ompio file handle's
 222  * 'f_sharedfp_data' attribute during the call to the file_open function.
 223  */
 224 struct mca_sharedfp_base_data_t{
 225     /* attributes that will be used by all of the sharedfp components */
 226     OMPI_MPI_OFFSET_TYPE global_offset;
 227 
 228     /* attributes that are specific to a component are
 229      * combined into a structure that is assigned to this attribute */
 230     void   *selected_module_data;
 231 };
 232 
 233 /**************************************/
 234 
 235 END_C_DECLS
 236 
 237 #endif /* OMPI_MCA_SHAREDFP_H */

/* [<][>][^][v][top][bottom][index][help] */