This source file includes following definitions.
- mca_atomic_base_find_available
- init_query
1
2
3
4
5
6
7
8
9
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15 #include "oshmem_config.h"
16
17 #include "opal/class/opal_list.h"
18 #include "oshmem/mca/mca.h"
19 #include "opal/mca/base/base.h"
20 #include "opal/mca/base/mca_base_component_repository.h"
21
22 #include "oshmem/constants.h"
23 #include "oshmem/util/oshmem_util.h"
24 #include "oshmem/mca/atomic/atomic.h"
25 #include "oshmem/mca/atomic/base/base.h"
26
27
28
29
30 static int init_query(const mca_base_component_t * ls,
31 bool enable_progress_threads,
32 bool enable_threads);
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 int mca_atomic_base_find_available(bool enable_progress_threads,
48 bool enable_threads)
49 {
50 mca_base_component_list_item_t *cli, *next;
51 const mca_base_component_t *component;
52
53 OPAL_LIST_FOREACH_SAFE(cli, next, &oshmem_atomic_base_framework.framework_components, mca_base_component_list_item_t) {
54 component = cli->cli_component;
55
56
57
58
59 if (OSHMEM_SUCCESS != init_query(component, enable_progress_threads,
60 enable_threads)) {
61
62
63 opal_list_remove_item(&oshmem_atomic_base_framework.framework_components, &cli->super);
64 mca_base_component_close(component, oshmem_atomic_base_framework.framework_output);
65 OBJ_RELEASE(cli);
66 }
67 }
68
69
70
71
72 if (opal_list_get_size(&oshmem_atomic_base_framework.framework_components) == 0) {
73 ATOMIC_VERBOSE(10,
74 "atomic:find_available: no components available!");
75 return OSHMEM_ERROR;
76 }
77
78
79
80 return mca_atomic_base_select();
81 }
82
83
84
85
86
87 static int init_query(const mca_base_component_t * component,
88 bool enable_progress_threads,
89 bool enable_threads)
90 {
91 int ret;
92
93 ATOMIC_VERBOSE(10,
94 "atomic:find_available: querying atomic component %s",
95 component->mca_component_name);
96
97
98
99
100 if (1 == component->mca_type_major_version
101 && 0 == component->mca_type_minor_version
102 && 0 == component->mca_type_release_version) {
103
104 mca_atomic_base_component_t *atomic =
105 (mca_atomic_base_component_t *) component;
106
107 ret = atomic->atomic_startup(enable_progress_threads, enable_threads);
108 } else {
109
110
111 ATOMIC_VERBOSE(10,
112 "atomic:find_available: unrecognized atomic API version (%d.%d.%d, ignored)",
113 component->mca_type_major_version,
114 component->mca_type_minor_version,
115 component->mca_type_release_version);
116 return OSHMEM_ERROR;
117 }
118
119
120
121 if (OSHMEM_SUCCESS != ret) {
122 ATOMIC_VERBOSE(10,
123 "atomic:find_available: atomic component %s is not available",
124 component->mca_component_name);
125 if (NULL != component->mca_close_component) {
126 component->mca_close_component();
127 }
128 } else {
129 ATOMIC_VERBOSE(10,
130 "atomic:find_available: atomic component %s is available",
131 component->mca_component_name);
132 }
133
134
135
136 return ret;
137 }