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-2015 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$
19 *
20 * Additional copyrights may follow
21 *
22 * $HEADER$
23 */
24
25 #ifndef OMPI_MCA_FCOLL_H
26 #define OMPI_MCA_FCOLL_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
34 BEGIN_C_DECLS
35
36 struct ompio_file_t;
37 struct mca_fcoll_request_t;
38
39 /*
40 * Macro for use in components that are of type coll
41 */
42 #define MCA_FCOLL_BASE_VERSION_2_0_0 \
43 OMPI_MCA_BASE_VERSION_2_1_0("fcoll", 2, 0, 0)
44
45 /*
46 * This framework provides the abstraction for the collective file
47 * read and write operations of MPI I/O. The interfaces include
48 * blocking collective operations using the individual file pointer,
49 * blocking collective operations using explicit offsets and
50 * the split collective operations defined in MPI/O for the same.
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 fcoll_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 */
67
68 /*
69 * **************** component struct *******************************
70 * *********** These functions go in the component struct **********
71 * **************** component struct *******************************
72 */
73
74 typedef int (*mca_fcoll_base_component_init_query_1_0_0_fn_t)
75 (bool enable_progress_threads,
76 bool enable_mpi_threads);
77
78 typedef struct mca_fcoll_base_module_1_0_0_t *
79 (*mca_fcoll_base_component_file_query_1_0_0_fn_t) (struct ompio_file_t *file,
80 int *priority);
81
82 typedef int (*mca_fcoll_base_component_file_unquery_1_0_0_fn_t)
83 (struct ompio_file_t *file);
84
85 /*
86 * ****************** component struct ******************************
87 * Structure for fcoll v2.0.0 components.This is chained to MCA v2.0.0
88 * ****************** component struct ******************************
89 */
90 struct mca_fcoll_base_component_2_0_0_t {
91 mca_base_component_t fcollm_version;
92 mca_base_component_data_t fcollm_data;
93
94 mca_fcoll_base_component_init_query_1_0_0_fn_t fcollm_init_query;
95 mca_fcoll_base_component_file_query_1_0_0_fn_t fcollm_file_query;
96 mca_fcoll_base_component_file_unquery_1_0_0_fn_t fcollm_file_unquery;
97 };
98 typedef struct mca_fcoll_base_component_2_0_0_t mca_fcoll_base_component_2_0_0_t;
99 typedef struct mca_fcoll_base_component_2_0_0_t mca_fcoll_base_component_t;
100
101 /*
102 * ***********************************************************************
103 * ************************ Interface function definitions **************
104 * These are the typedefcoll for the function pointers to various fcoll
105 * backend functions which will be used by the various fcoll components
106 * ***********************************************************************
107 */
108
109 typedef int (*mca_fcoll_base_module_init_1_0_0_fn_t)
110 (struct ompio_file_t *file);
111
112 typedef int (*mca_fcoll_base_module_finalize_1_0_0_fn_t)
113 (struct ompio_file_t *file);
114
115 typedef int (*mca_fcoll_base_module_file_read_all_fn_t)
116 (struct ompio_file_t *fh,
117 void *buf,
118 int count,
119 struct ompi_datatype_t *datatype,
120 ompi_status_public_t *status);
121
122 typedef int (*mca_fcoll_base_module_file_iread_all_fn_t)
123 (struct ompio_file_t *fh,
124 void *buf,
125 int count,
126 struct ompi_datatype_t *datatype,
127 ompi_request_t **request);
128
129 typedef int (*mca_fcoll_base_module_file_write_all_fn_t)
130 (struct ompio_file_t *fh,
131 const void *buf,
132 int count,
133 struct ompi_datatype_t *datatype,
134 ompi_status_public_t *status);
135
136 typedef int (*mca_fcoll_base_module_file_iwrite_all_fn_t)
137 (struct ompio_file_t *fh,
138 const void *buf,
139 int count,
140 struct ompi_datatype_t *datatype,
141 ompi_request_t **request);
142
143 typedef bool (*mca_fcoll_base_module_progress_fn_t)
144 ( struct mca_fcoll_request_t *request);
145
146 typedef void (*mca_fcoll_base_module_request_free_fn_t)
147 ( struct mca_fcoll_request_t *request);
148
149 /*
150 * ***********************************************************************
151 * *************************** module structure *************************
152 * ***********************************************************************
153 */
154 struct mca_fcoll_base_module_1_0_0_t {
155 /*
156 * Per-file initialization function. This is called only
157 * on the module which is selected. The finalize corresponding to
158 * this function is present on the component struct above
159 */
160 mca_fcoll_base_module_init_1_0_0_fn_t fcoll_module_init;
161 mca_fcoll_base_module_finalize_1_0_0_fn_t fcoll_module_finalize;
162
163 /* FCOLL function pointers */
164 mca_fcoll_base_module_file_read_all_fn_t fcoll_file_read_all;
165 mca_fcoll_base_module_file_iread_all_fn_t fcoll_file_iread_all;
166 mca_fcoll_base_module_file_write_all_fn_t fcoll_file_write_all;
167 mca_fcoll_base_module_file_iwrite_all_fn_t fcoll_file_iwrite_all;
168 mca_fcoll_base_module_progress_fn_t fcoll_progress;
169 mca_fcoll_base_module_request_free_fn_t fcoll_request_free;
170
171 };
172 typedef struct mca_fcoll_base_module_1_0_0_t mca_fcoll_base_module_1_0_0_t;
173 typedef mca_fcoll_base_module_1_0_0_t mca_fcoll_base_module_t;
174
175 END_C_DECLS
176
177 #endif /* OMPI_MCA_FCOLL_H */