This source file includes following definitions.
- mca_topo_base_find_available
- init_query
- init_query_2_2_0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23
24 #include <stdio.h>
25 #include <stdlib.h>
26
27 #include "opal/class/opal_list.h"
28 #include "opal/util/output.h"
29 #include "ompi/mca/mca.h"
30 #include "opal/mca/base/base.h"
31 #include "opal/mca/base/mca_base_component_repository.h"
32 #include "ompi/mca/topo/topo.h"
33 #include "ompi/mca/topo/base/base.h"
34 #include "ompi/constants.h"
35
36 static int init_query(const mca_base_component_t *m,
37 mca_base_component_list_item_t *entry,
38 bool enable_progress_threads,
39 bool enable_mpi_threads);
40 static int init_query_2_2_0(const mca_base_component_t *component,
41 mca_base_component_list_item_t *entry,
42 bool enable_progress_threads,
43 bool enable_mpi_threads);
44
45 int mca_topo_base_find_available(bool enable_progress_threads,
46 bool enable_mpi_threads)
47 {
48 opal_list_item_t *item, *next;
49 mca_base_component_list_item_t *cli;
50
51
52
53
54
55 item = opal_list_get_first(&ompi_topo_base_framework.framework_components);
56 while (item != opal_list_get_end(&ompi_topo_base_framework.framework_components)) {
57 next = opal_list_get_next(item);
58 cli = (mca_base_component_list_item_t*)item;
59
60
61
62
63 if (OMPI_SUCCESS != init_query(cli->cli_component, cli,
64 enable_progress_threads,
65 enable_mpi_threads)) {
66
67
68
69 mca_base_component_repository_release(cli->cli_component);
70 opal_list_remove_item(&ompi_topo_base_framework.framework_components, item);
71 OBJ_RELEASE(item);
72 }
73 item = next;
74 }
75
76
77 if (0 == opal_list_get_size(&ompi_topo_base_framework.framework_components)) {
78 opal_output_verbose (10, ompi_topo_base_framework.framework_output,
79 "topo:find_available: no topo components available!");
80 return OMPI_ERROR;
81 }
82
83
84 return OMPI_SUCCESS;
85 }
86
87
88 static int init_query(const mca_base_component_t *m,
89 mca_base_component_list_item_t *entry,
90 bool enable_progress_threads,
91 bool enable_mpi_threads)
92 {
93 int ret;
94
95 opal_output_verbose(10, ompi_topo_base_framework.framework_output,
96 "topo:find_available: querying topo component %s",
97 m->mca_component_name);
98
99
100
101
102
103 if (2 == m->mca_type_major_version &&
104 2 == m->mca_type_minor_version &&
105 0 == m->mca_type_release_version) {
106 ret = init_query_2_2_0(m, entry, enable_progress_threads,
107 enable_mpi_threads);
108 } else {
109
110 opal_output_verbose(10, ompi_topo_base_framework.framework_output,
111 "topo:find_available:unrecognised topo API version (%d.%d.%d)",
112 m->mca_type_major_version,
113 m->mca_type_minor_version,
114 m->mca_type_release_version);
115 return OMPI_ERROR;
116 }
117
118
119 if (OMPI_SUCCESS != ret) {
120 opal_output_verbose(10, ompi_topo_base_framework.framework_output,
121 "topo:find_available topo component %s is not available",
122 m->mca_component_name);
123 if (NULL != m->mca_close_component) {
124 m->mca_close_component();
125 }
126 } else {
127 opal_output_verbose(10, ompi_topo_base_framework.framework_output,
128 "topo:find_avalable: topo component %s is available",
129 m->mca_component_name);
130
131 }
132
133
134 return ret;
135 }
136
137
138 static int init_query_2_2_0(const mca_base_component_t *component,
139 mca_base_component_list_item_t *entry,
140 bool enable_progress_threads,
141 bool enable_mpi_threads)
142 {
143 mca_topo_base_component_2_2_0_t *topo =
144 (mca_topo_base_component_2_2_0_t *) component;
145
146 return topo->topoc_init_query(enable_progress_threads,
147 enable_mpi_threads);
148 }