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-2014 University of Houston. All rights reserved. 14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights 15 * reserved. 16 * Copyright (c) 2018 Research Organization for Information Science 17 * and Technology (RIST). All rights reserved. 18 * $COPYRIGHT$ 19 * 20 * Additional copyrights may follow 21 * 22 * $HEADER$ 23 */ 24 25 #ifndef OMPI_MCA_FBTL_H 26 #define OMPI_MCA_FBTL_H 27 28 #include "ompi_config.h" 29 #include "mpi.h" 30 #include "ompi/mca/mca.h" 31 #include "opal/mca/base/base.h" 32 #include "ompi/request/request.h" 33 #ifdef HAVE_SYS_UIO_H 34 #include <sys/uio.h> 35 #endif 36 37 BEGIN_C_DECLS 38 39 struct ompio_file_t; 40 struct mca_ompio_request_t; 41 42 /* 43 * Macro for use in components that are of type coll 44 */ 45 #define MCA_FBTL_BASE_VERSION_2_0_0 \ 46 OMPI_MCA_BASE_VERSION_2_1_0("fbtl", 2, 0, 0) 47 48 /* 49 * The file byte transfer layer (fbtl) framework provides the abstraction 50 * for individual blocking and non-blocking read and write operations. 51 * The functionality provided by the interfaces in this module 52 * can be used to implement the corresponding operations in MPI I/O. 53 * Note however, that the interfaces are not a one-to-one mapping 54 * of the MPI individual read and write operations, since the fbtl framework 55 * avoids using derived MPI datatypes. The step mapping/unrolling the MPI 56 * derived data types into a vector of (offset into file, memory address, length) 57 * is done in the OMPIO module of the IO framework. 58 * 59 * These are the component function prototypes. These function pointers 60 * go into the component structure. These functions (query() and finalize() 61 * are called during fbtl_base_select(). Each component is query() ied 62 * and subsequently, all the unselected components are finalize() 'ed 63 * so that any *stuff* they did during query() can be undone. By 64 * similar logic, finalize() is also called on the component which 65 * was selected when the communicator is being destroyed. 66 * 67 * So, to sum it up, every component carries 4 functions: 68 * 1. open() - called during MPI_INIT 69 * 2. close() - called during MPI_FINALIZE 70 * 3. query() - called to select a particular component 71 * 4. finalize() - called when actions taken during query have 72 * to be undone 73 */ 74 75 /* 76 * **************** component struct ******************************* 77 * *********** These functions go in the component struct ********** 78 * **************** component struct ******************************* 79 */ 80 81 typedef int (*mca_fbtl_base_component_init_query_1_0_0_fn_t) 82 (bool enable_progress_threads, 83 bool enable_mpi_threads); 84 85 typedef struct mca_fbtl_base_module_1_0_0_t * 86 (*mca_fbtl_base_component_file_query_1_0_0_fn_t) (struct ompio_file_t *file, 87 int *priority); 88 89 typedef int (*mca_fbtl_base_component_file_unquery_1_0_0_fn_t) 90 (struct ompio_file_t *file); 91 92 /* 93 * ****************** component struct ****************************** 94 * Structure for fbtl v2.0.0 components.This is chained to MCA v2.0.0 95 * ****************** component struct ****************************** 96 */ 97 struct mca_fbtl_base_component_2_0_0_t { 98 mca_base_component_t fbtlm_version; 99 mca_base_component_data_t fbtlm_data; 100 101 mca_fbtl_base_component_init_query_1_0_0_fn_t fbtlm_init_query; 102 mca_fbtl_base_component_file_query_1_0_0_fn_t fbtlm_file_query; 103 mca_fbtl_base_component_file_unquery_1_0_0_fn_t fbtlm_file_unquery; 104 }; 105 typedef struct mca_fbtl_base_component_2_0_0_t mca_fbtl_base_component_2_0_0_t; 106 typedef struct mca_fbtl_base_component_2_0_0_t mca_fbtl_base_component_t; 107 108 /* 109 * *********************************************************************** 110 * ************************ Interface function definitions ************** 111 * These are the typedefbtl for the function pointers to various fbtl 112 * backend functions which will be used by the various fbtl components 113 * *********************************************************************** 114 */ 115 116 typedef int (*mca_fbtl_base_module_init_1_0_0_fn_t) 117 (struct ompio_file_t *file); 118 119 typedef int (*mca_fbtl_base_module_finalize_1_0_0_fn_t) 120 (struct ompio_file_t *file); 121 122 123 typedef ssize_t (*mca_fbtl_base_module_preadv_fn_t) 124 (struct ompio_file_t *file ); 125 typedef ssize_t (*mca_fbtl_base_module_pwritev_fn_t) 126 (struct ompio_file_t *file ); 127 typedef ssize_t (*mca_fbtl_base_module_ipreadv_fn_t) 128 (struct ompio_file_t *file, 129 ompi_request_t *request); 130 typedef ssize_t (*mca_fbtl_base_module_ipwritev_fn_t) 131 (struct ompio_file_t *file, 132 ompi_request_t *request); 133 typedef bool (*mca_fbtl_base_module_progress_fn_t) 134 ( struct mca_ompio_request_t *request); 135 136 typedef void (*mca_fbtl_base_module_request_free_fn_t) 137 ( struct mca_ompio_request_t *request); 138 /* 139 * *********************************************************************** 140 * *************************** module structure ************************* 141 * *********************************************************************** 142 */ 143 struct mca_fbtl_base_module_1_0_0_t { 144 /* 145 * Per-file initialization function. This is called only 146 * on the module which is selected. The finalize corresponding to 147 * this function is present on the component struct above 148 */ 149 mca_fbtl_base_module_init_1_0_0_fn_t fbtl_module_init; 150 mca_fbtl_base_module_finalize_1_0_0_fn_t fbtl_module_finalize; 151 152 /* FBTL function pointers */ 153 mca_fbtl_base_module_preadv_fn_t fbtl_preadv; 154 mca_fbtl_base_module_ipreadv_fn_t fbtl_ipreadv; 155 mca_fbtl_base_module_pwritev_fn_t fbtl_pwritev; 156 mca_fbtl_base_module_ipwritev_fn_t fbtl_ipwritev; 157 mca_fbtl_base_module_progress_fn_t fbtl_progress; 158 mca_fbtl_base_module_request_free_fn_t fbtl_request_free; 159 }; 160 typedef struct mca_fbtl_base_module_1_0_0_t mca_fbtl_base_module_1_0_0_t; 161 typedef mca_fbtl_base_module_1_0_0_t mca_fbtl_base_module_t; 162 163 END_C_DECLS 164 165 #endif /* OMPI_MCA_FBTL_H */