This source file includes following definitions.
- orte_rmaps_rank_file_register
- orte_rmaps_rank_file_open
- orte_rmaps_rank_file_query
- orte_rmaps_rank_file_close
- rf_map_construct
- rf_map_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 #include "orte_config.h"
27 #include "orte/constants.h"
28
29 #include <string.h>
30
31 #include "opal/mca/base/base.h"
32 #include "opal/mca/hwloc/base/base.h"
33
34 #include "orte/util/show_help.h"
35
36 #include "orte/mca/rmaps/base/base.h"
37 #include "orte/mca/rmaps/base/rmaps_private.h"
38 #include "orte/mca/rmaps/rank_file/rmaps_rank_file.h"
39 #include "orte/mca/rmaps/rank_file/rmaps_rank_file_lex.h"
40
41
42
43
44
45 static int orte_rmaps_rank_file_register(void);
46 static int orte_rmaps_rank_file_open(void);
47 static int orte_rmaps_rank_file_close(void);
48 static int orte_rmaps_rank_file_query(mca_base_module_t **module, int *priority);
49
50 static int my_priority;
51
52 orte_rmaps_rf_component_t mca_rmaps_rank_file_component = {
53 {
54
55
56
57 .base_version = {
58 ORTE_RMAPS_BASE_VERSION_2_0_0,
59
60 .mca_component_name = "rank_file",
61 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
62 ORTE_RELEASE_VERSION),
63 .mca_open_component = orte_rmaps_rank_file_open,
64 .mca_close_component = orte_rmaps_rank_file_close,
65 .mca_query_component = orte_rmaps_rank_file_query,
66 .mca_register_component_params = orte_rmaps_rank_file_register,
67 },
68 .base_data = {
69
70 MCA_BASE_METADATA_PARAM_CHECKPOINT
71 },
72 }
73 };
74
75
76
77
78 static int orte_rmaps_rank_file_register(void)
79 {
80 mca_base_component_t *c = &mca_rmaps_rank_file_component.super.base_version;
81 int tmp;
82
83 my_priority = 0;
84 (void) mca_base_component_var_register(c, "priority", "Priority of the rank_file rmaps component",
85 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
86 OPAL_INFO_LVL_9,
87 MCA_BASE_VAR_SCOPE_READONLY, &my_priority);
88 orte_rankfile = NULL;
89 tmp = mca_base_component_var_register(c, "path",
90 "Name of the rankfile to be used for mapping processes (relative or absolute path)",
91 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
92 OPAL_INFO_LVL_5,
93 MCA_BASE_VAR_SCOPE_READONLY, &orte_rankfile);
94 (void) mca_base_var_register_synonym(tmp, "orte", "orte", NULL, "rankfile", 0);
95
96 mca_rmaps_rank_file_component.physical = false;
97 (void) mca_base_component_var_register(c, "physical", "Rankfile contains physical cpu designations",
98 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
99 OPAL_INFO_LVL_5,
100 MCA_BASE_VAR_SCOPE_READONLY,
101 &mca_rmaps_rank_file_component.physical);
102
103
104 return ORTE_SUCCESS;
105 }
106
107 static int orte_rmaps_rank_file_open(void)
108 {
109
110 if ((OPAL_BIND_TO_CPUSET == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy) &&
111 !OPAL_BIND_ORDERED_REQUESTED(opal_hwloc_binding_policy)) ||
112 NULL != orte_rankfile) {
113 if (ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
114
115
116
117 orte_show_help("help-orte-rmaps-base.txt", "redefining-policy", true, "mapping",
118 "RANK_FILE", orte_rmaps_base_print_mapping(orte_rmaps_base.mapping));
119 ORTE_SET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping, ORTE_MAPPING_CONFLICTED);
120 return ORTE_ERR_SILENT;
121 }
122 ORTE_SET_MAPPING_POLICY(orte_rmaps_base.mapping, ORTE_MAPPING_BYUSER);
123 ORTE_SET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping, ORTE_MAPPING_GIVEN);
124
125 OPAL_SET_BINDING_POLICY(opal_hwloc_binding_policy, OPAL_BIND_TO_CPUSET);
126
127 my_priority = 10000;
128 }
129
130 return ORTE_SUCCESS;
131 }
132
133 static int orte_rmaps_rank_file_query(mca_base_module_t **module, int *priority)
134 {
135 *priority = my_priority;
136 *module = (mca_base_module_t *)&orte_rmaps_rank_file_module;
137 return ORTE_SUCCESS;
138 }
139
140
141
142
143
144 static int orte_rmaps_rank_file_close(void)
145 {
146 int tmp = mca_base_var_find("orte", "orte", NULL, "rankfile");
147
148 if (0 <= tmp) {
149 mca_base_var_deregister(tmp);
150 }
151
152 return ORTE_SUCCESS;
153 }
154
155 static void rf_map_construct(orte_rmaps_rank_file_map_t *ptr)
156 {
157 ptr->node_name = NULL;
158 memset(ptr->slot_list, (char)0x00, 64);
159 }
160 static void rf_map_destruct(orte_rmaps_rank_file_map_t *ptr)
161 {
162 if (NULL != ptr->node_name) free(ptr->node_name);
163 }
164 OBJ_CLASS_INSTANCE(orte_rmaps_rank_file_map_t,
165 opal_object_t,
166 rf_map_construct,
167 rf_map_destruct);