1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
13 * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20 /**
21 * @file
22 *
23 * This framework is for the selection and assignment of "op" modules
24 * to intrinsic MPI_Op objects. This framework is not used for
25 * user-defined MPI_Op objects.
26 *
27 * The main idea is to let intrinsic MPI_Ops be able to utilize
28 * functions from multiple op modules, based on the (datatype,
29 * operation) tuple. Hence, it is possible for specialized hardware
30 * to be utilized for datatypes and operations that are supported.
31 */
32
33 #ifndef MCA_OP_BASE_H
34 #define MCA_OP_BASE_H
35
36 #include "ompi_config.h"
37 #include "opal/mca/base/base.h"
38 #include "ompi/mca/op/op.h"
39
40 BEGIN_C_DECLS
41
42 typedef struct ompi_op_base_selected_module_t {
43 opal_list_item_t super;
44 ompi_op_base_component_t *op_component;
45 ompi_op_base_module_t *op_module;
46 } ompi_op_base_selected_module_t;
47
48
49 /**
50 * Find all available op components.
51 */
52 OMPI_DECLSPEC int ompi_op_base_find_available(bool enable_progress_threads,
53 bool enable_mpi_threads);
54
55 /**
56 * Select an available component for a new intrinsice MPI_Op (this
57 * function is *not* used for user-defined MPI_Ops!).
58 *
59 * @param op MPI_Op that the component will be selected for.
60 *
61 * @return OMPI_SUCCESS Upon success.
62 * @return OMPI_ERROR Upon failure.
63 *
64 * Note that the types of the parameters have "struct" in them (e.g.,
65 * ompi_op_t" vs. a plain "ompi_op_t") to avoid an include file loop.
66 * All similar types (e.g., "struct ompi_op_t *", "ompi_op_t *", and
67 * "MPI_Op") are all typedef'ed to be the same, so the fact that we
68 * use struct here in the prototype is ok.
69 *
70 * This function is invoked when a new MPI_Op is created and
71 * op components need to be selected for it.
72 */
73 int ompi_op_base_op_select(struct ompi_op_t *op);
74
75 /**
76 * Finalize all op modules on a specific (intrinsic) MPI_Op.
77 *
78 * @param op The op that is being destroyed.
79 *
80 * @retval OMPI_SUCCESS Always.
81 *
82 * Note that the type of the parameter is only a "struct ompi_op_t"
83 * (vs. a plain "ompi_op_t") to avoid an include file loop. The types
84 * "struct ompi_op_t *", "ompi_op_t *", and "MPI_Op" are all
85 * typedef'ed to be the same, so the fact that we use struct here in
86 * the prototype is ok.
87 *
88 * This function is invoked near the beginning of the destruction of
89 * an op. It finalizes the op modules associated with the MPI_Op
90 * (e.g., allowing the component to clean up and free any resources
91 * allocated for that MPI_Op) by calling the destructor on each
92 * object.
93 */
94 OMPI_DECLSPEC int ompi_op_base_op_unselect(struct ompi_op_t *op);
95
96 OMPI_DECLSPEC extern mca_base_framework_t ompi_op_base_framework;
97
98 END_C_DECLS
99 #endif /* MCA_OP_BASE_H */