This source file includes following definitions.
- demo_register
- mca_coll_demo_module_construct
- mca_coll_demo_module_destruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include "ompi_config.h"
30
31 #include "mpi.h"
32 #include "ompi/mca/coll/coll.h"
33 #include "coll_demo.h"
34
35
36
37
38 const char *mca_coll_demo_component_version_string =
39 "OMPI/MPI demo collective MCA component version " OMPI_VERSION;
40
41
42
43
44 int mca_coll_demo_priority = -1;
45 int mca_coll_demo_verbose = 0;
46
47
48
49
50 static int demo_register(void);
51
52
53
54
55
56
57
58 const mca_coll_base_component_2_0_0_t mca_coll_demo_component = {
59
60
61
62
63 .collm_version = {
64 MCA_COLL_BASE_VERSION_2_0_0,
65
66
67 .mca_component_name = "demo",
68 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
69 OMPI_RELEASE_VERSION),
70
71
72 .mca_register_component_params = demo_register,
73 },
74 .collm_data = {
75
76 MCA_BASE_METADATA_PARAM_CHECKPOINT
77 },
78
79
80
81 .collm_init_query = mca_coll_demo_init_query,
82 .collm_comm_query = mca_coll_demo_comm_query,
83 };
84
85
86 static int demo_register(void)
87 {
88 mca_coll_demo_priority = 20;
89 (void) mca_base_component_var_register(&mca_coll_demo_component.collm_version, "priority",
90 NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
91 OPAL_INFO_LVL_9,
92 MCA_BASE_VAR_SCOPE_READONLY,
93 &mca_coll_demo_priority);
94 mca_coll_demo_verbose = 0;
95 (void) mca_base_component_var_register(&mca_coll_demo_component.collm_version, "verbose",
96 NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
97 OPAL_INFO_LVL_9,
98 MCA_BASE_VAR_SCOPE_READONLY,
99 &mca_coll_demo_verbose);
100
101 return OMPI_SUCCESS;
102 }
103
104
105 static void
106 mca_coll_demo_module_construct(mca_coll_demo_module_t *module)
107 {
108 memset(&module->underlying, 0, sizeof(mca_coll_base_comm_coll_t));
109 }
110
111 #define RELEASE(module, func) \
112 do { \
113 if (NULL != module->underlying.coll_ ## func ## _module) { \
114 OBJ_RELEASE(module->underlying.coll_ ## func ## _module); \
115 } \
116 } while (0)
117
118 static void
119 mca_coll_demo_module_destruct(mca_coll_demo_module_t *module)
120 {
121 RELEASE(module, allgather);
122 RELEASE(module, allgatherv);
123 RELEASE(module, allreduce);
124 RELEASE(module, alltoall);
125 RELEASE(module, alltoallv);
126 RELEASE(module, alltoallw);
127 RELEASE(module, barrier);
128 RELEASE(module, bcast);
129 RELEASE(module, exscan);
130 RELEASE(module, gather);
131 RELEASE(module, gatherv);
132 RELEASE(module, reduce);
133 RELEASE(module, reduce_scatter);
134 RELEASE(module, scan);
135 RELEASE(module, scatter);
136 RELEASE(module, scatterv);
137 }
138
139
140 OBJ_CLASS_INSTANCE(mca_coll_demo_module_t,
141 mca_coll_base_module_t,
142 mca_coll_demo_module_construct,
143 mca_coll_demo_module_destruct);