OpenMPI  0.1.1
osc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University.
3  * All rights reserved.
4  * Copyright (c) 2004-2011 The Trustees of the University of Tennessee.
5  * All rights reserved.
6  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
7  * University of Stuttgart. All rights reserved.
8  * Copyright (c) 2004-2005 The Regents of the University of California.
9  * All rights reserved.
10  * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
11  * reserved.
12  * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 /**
20  * @file
21  *
22  * One-sided Communication interface
23  *
24  * Interface for implementing the one-sided communication chapter of
25  * the MPI-2 standard. Similar in scope to the PML for point-to-point
26  * communication from MPI-1.
27  */
28 
29 #ifndef OMPI_MCA_OSC_OSC_H
30 #define OMPI_MCA_OSC_OSC_H
31 
32 #include "opal_config.h"
33 
34 #ifdef HAVE_STDDEF_H
35 #include <stddef.h>
36 #endif
37 
38 #include "opal/mca/mca.h"
39 
40 BEGIN_C_DECLS
41 
42 
43 /* ******************************************************************** */
44 
45 
46 struct ompi_win_t;
47 struct ompi_info_t;
48 struct ompi_communicator_t;
49 struct ompi_group_t;
50 struct ompi_datatype_t;
51 struct ompi_op_t;
52 
53 
54 /* ******************************************************************** */
55 
56 
57 /**
58  * OSC component initialization
59  *
60  * Initialize the given one-sided component. This function should
61  * initialize any component-level data.
62 
63  * @note The component framework is not lazily opened, so attempts
64  * should be made to minimize the amount of memory allocated during
65  * this function.
66  *
67  * @param[in] enable_progress_threads True if the component needs to
68  * support progress threads
69  * @param[in] enable_mpi_threads True if the component needs to
70  * support MPI_THREAD_MULTIPLE
71  *
72  * @retval OMPI_SUCCESS Component successfully initialized
73  * @retval OMPI_ERROR An unspecified error occurred
74  */
75 typedef int (*ompi_osc_base_component_init_fn_t)(bool enable_progress_threads,
76  bool enable_mpi_threads);
77 
78 
79 /**
80  * OSC component finalization
81  *
82  * Finalize the given one-sided component. This function should clean
83  * up any component-level data allocated during component_init(). It
84  * should also clean up any data created during the lifetime of the
85  * component, including any modules that are outstanding.
86  *
87  * @retval OMPI_SUCCESS Component successfully finalized
88  * @retval OMPI_ERROR An unspecified error occurred
89  */
91 
92 
93 /**
94  * OSC component query
95  *
96  * Query whether, given the info and comm, the component can be used
97  * for one-sided support. The ability to use the component for the
98  * window does not mean that the component will be selected. The win
99  * argument should not be modified during this call and no memory
100  * should be allocated that is associated with this window.
101  *
102  * @return The selection priority of the component
103  *
104  * @param[in] win The window handle, already filled in by MPI_WIN_CREATE()
105  * @param[in] info An info structure with hints from the user
106  * regarding the usage of the component
107  * @param[in] comm The communicator specified by the user for the
108  * basis of the group membership for the Window.
109  *
110  * @retval -1 The component can not be used for this window
111  * @retval >= 0 The priority of the component for this window
112  */
114  struct ompi_info_t *info,
115  struct ompi_communicator_t *comm);
116 
117 
118 /**
119  * OSC component select
120  *
121  * This component has been selected to provide one-sided services for
122  * the given window. The win->w_osc_module field can be updated and
123  * memory can be associated with this window. The module should be
124  * ready for use immediately upon return of this function, and the
125  * module is responsible for providing any required collective
126  * synchronization before the end of the call.
127  *
128  * @note The comm is the communicator specified from the user, so
129  * normal internal usage rules apply. In other words, if you need
130  * communication for the life of the window, you should call
131  * comm_dup() during this function.
132  *
133  * @param[in/out] win The window handle, already filled in by MPI_WIN_CREATE()
134  * @param[in] info An info structure with hints from the user
135  * regarding the usage of the component
136  * @param[in] comm The communicator specified by the user for the
137  * basis of the group membership for the Window.
138  *
139  * @retval OMPI_SUCCESS Component successfully selected
140  * @retval OMPI_ERROR An unspecified error occurred
141  */
143  struct ompi_info_t *info,
144  struct ompi_communicator_t *comm);
145 
146 
147 /**
148  * OSC component interface
149  *
150  * Component interface for the OSC framework. A public instance of
151  * this structure, called mca_osc_[component_name]_component, must
152  * exist in any OSC component.
153  */
155  /** Base component description */
157  /** Base component data block */
159  /** Component initialization function */
161  /** Query whether component is useable for give comm/info */
163  /** Create module for the given window */
165  /* Finalize the component infrastructure */
167 };
170 
171 
172 /* ******************************************************************** */
173 
174 
175 /**
176  * Free resources associated with win
177  *
178  * Free all resources associated with \c win. The component must
179  * provide the barrier semantics required by MPI-2 6.2.1. The caller
180  * will guarantee that no new calls into the module are made after the
181  * start of this call. It is possible that the window is locked by
182  * remote processes. win->w_flags will have OMPI_WIN_FREED set before
183  * this function is called.
184  *
185  * @param[in] win Window to free
186  *
187  * @retval OMPI_SUCCESS Component successfully selected
188  * @retval OMPI_ERROR An unspecified error occurred
189  */
190 typedef int (*ompi_osc_base_module_free_fn_t)(struct ompi_win_t *win);
191 
192 
193 typedef int (*ompi_osc_base_module_put_fn_t)(void *origin_addr,
194  int origin_count,
195  struct ompi_datatype_t *origin_dt,
196  int target,
197  OPAL_PTRDIFF_TYPE target_disp,
198  int target_count,
199  struct ompi_datatype_t *target_dt,
200  struct ompi_win_t *win);
201 
202 
203 typedef int (*ompi_osc_base_module_get_fn_t)(void *origin_addr,
204  int origin_count,
205  struct ompi_datatype_t *origin_dt,
206  int target,
207  OPAL_PTRDIFF_TYPE target_disp,
208  int target_count,
209  struct ompi_datatype_t *target_dt,
210  struct ompi_win_t *win);
211 
212 
213 typedef int (*ompi_osc_base_module_accumulate_fn_t)(void *origin_addr,
214  int origin_count,
215  struct ompi_datatype_t *origin_dt,
216  int target,
217  OPAL_PTRDIFF_TYPE target_disp,
218  int target_count,
219  struct ompi_datatype_t *target_dt,
220  struct ompi_op_t *op,
221  struct ompi_win_t *win);
222 
223 
224 typedef int (*ompi_osc_base_module_fence_fn_t)(int assert, struct ompi_win_t *win);
225 
226 
227 typedef int (*ompi_osc_base_module_start_fn_t)(struct ompi_group_t *group,
228  int assert,
229  struct ompi_win_t *win);
230 
231 
232 typedef int (*ompi_osc_base_module_complete_fn_t)(struct ompi_win_t *win);
233 
234 
235 typedef int (*ompi_osc_base_module_post_fn_t)(struct ompi_group_t *group,
236  int assert,
237  struct ompi_win_t *win);
238 
239 
240 typedef int (*ompi_osc_base_module_wait_fn_t)(struct ompi_win_t *win);
241 
242 
243 typedef int (*ompi_osc_base_module_test_fn_t)(struct ompi_win_t *win,
244  int *flag);
245 
246 
247 typedef int (*ompi_osc_base_module_lock_fn_t)(int lock_type,
248  int target,
249  int assert,
250  struct ompi_win_t *win);
251 
252 
253 typedef int (*ompi_osc_base_module_unlock_fn_t)(int target,
254  struct ompi_win_t *win);
255 
256 
257 /* ******************************************************************** */
258 
259 
260 /**
261  * OSC module instance
262  *
263  * Module interface to the OSC system. An instance of this module is
264  * attached to each window. The window contains a pointer to the base
265  * module instead of a base module itself so that the component is
266  * free to create a structure that inherits this one for use as the
267  * module structure.
268  */
270  /** Free resources associated with the window */
272 
273  /** Implement MPI_PUT */
274  ompi_osc_base_module_put_fn_t osc_put;
275  /** Implement MPI_GET */
276  ompi_osc_base_module_get_fn_t osc_get;
277  /** Implement MPI_ACCUMULATE */
278  ompi_osc_base_module_accumulate_fn_t osc_accumulate;
279 
280  /** Implement MPI_WIN_FENCE */
281  ompi_osc_base_module_fence_fn_t osc_fence;
282 
283  /* Implement MPI_WIN_START */
284  ompi_osc_base_module_start_fn_t osc_start;
285  /* Implement MPI_WIN_COMPLETE */
286  ompi_osc_base_module_complete_fn_t osc_complete;
287  /* Implement MPI_WIN_POST */
288  ompi_osc_base_module_post_fn_t osc_post;
289  /* Implement MPI_WIN_WAIT */
290  ompi_osc_base_module_wait_fn_t osc_wait;
291  /* Implement MPI_WIN_TEST */
292  ompi_osc_base_module_test_fn_t osc_test;
293 
294  /* Implement MPI_WIN_LOCK */
295  ompi_osc_base_module_lock_fn_t osc_lock;
296  /* Implement MPI_WIN_UNLOCK */
297  ompi_osc_base_module_unlock_fn_t osc_unlock;
298 };
301 
302 
303 /* ******************************************************************** */
304 
305 
306 /** Macro for use in components that are of type osc */
307 #define OMPI_OSC_BASE_VERSION_2_0_0 \
308  MCA_BASE_VERSION_2_0_0, \
309  "osc", 2, 0, 0
310 
311 
312 /* ******************************************************************** */
313 
314 
315 END_C_DECLS
316 
317 
318 #endif /* OMPI_OSC_H */
OSC module instance.
Definition: osc.h:269
int(* ompi_osc_base_module_free_fn_t)(struct ompi_win_t *win)
Free resources associated with win.
Definition: osc.h:190
Definition: win.h:53
int(* ompi_osc_base_component_finalize_fn_t)(void)
OSC component finalization.
Definition: osc.h:90
Common type for all MCA components.
Definition: mca.h:250
ompi_osc_base_component_query_fn_t osc_query
Query whether component is useable for give comm/info.
Definition: osc.h:162
Definition: ompi_datatype.h:68
ompi_osc_base_module_fence_fn_t osc_fence
Implement MPI_WIN_FENCE.
Definition: osc.h:281
mca_base_component_data_t osc_data
Base component data block.
Definition: osc.h:158
Top-level interface for all MCA components.
Definition: info.h:38
ompi_osc_base_component_select_fn_t osc_select
Create module for the given window.
Definition: osc.h:164
ompi_osc_base_module_free_fn_t osc_free
Free resources associated with the window.
Definition: osc.h:271
ompi_osc_base_module_put_fn_t osc_put
Implement MPI_PUT.
Definition: osc.h:274
int(* ompi_osc_base_component_select_fn_t)(struct ompi_win_t *win, struct ompi_info_t *info, struct ompi_communicator_t *comm)
OSC component select.
Definition: osc.h:142
OSC component interface.
Definition: osc.h:154
int(* ompi_osc_base_component_init_fn_t)(bool enable_progress_threads, bool enable_mpi_threads)
OSC component initialization.
Definition: osc.h:75
Group structure Currently we have four formats for storing the process pointers that are members of t...
Definition: group.h:79
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
int(* ompi_osc_base_component_query_fn_t)(struct ompi_win_t *win, struct ompi_info_t *info, struct ompi_communicator_t *comm)
OSC component query.
Definition: osc.h:113
ompi_osc_base_module_accumulate_fn_t osc_accumulate
Implement MPI_ACCUMULATE.
Definition: osc.h:278
mca_base_component_t osc_version
Base component description.
Definition: osc.h:156
Definition: communicator.h:118
ompi_osc_base_component_init_fn_t osc_init
Component initialization function.
Definition: osc.h:160
Back-end type of MPI_Op.
Definition: op.h:100
ompi_osc_base_module_get_fn_t osc_get
Implement MPI_GET.
Definition: osc.h:276