This source file includes following definitions.
- orte_rmaps_resilient_register
- orte_rmaps_resilient_open
- orte_rmaps_resilient_query
- orte_rmaps_resilient_close
- ftgrp_res_construct
- ftgrp_res_destruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "orte_config.h"
23 #include "orte/constants.h"
24
25 #include "opal/mca/base/base.h"
26 #include "opal/class/opal_pointer_array.h"
27
28 #include "orte/util/proc_info.h"
29 #include "orte/util/show_help.h"
30
31 #include "orte/mca/rmaps/base/rmaps_private.h"
32 #include "rmaps_resilient.h"
33
34
35
36
37
38 static int orte_rmaps_resilient_register(void);
39 static int orte_rmaps_resilient_open(void);
40 static int orte_rmaps_resilient_close(void);
41 static int orte_rmaps_resilient_query(mca_base_module_t **module, int *priority);
42
43 static int my_priority;
44
45 orte_rmaps_res_component_t mca_rmaps_resilient_component = {
46 {
47 .base_version = {
48 ORTE_RMAPS_BASE_VERSION_2_0_0,
49
50 .mca_component_name = "resilient",
51 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
52 ORTE_RELEASE_VERSION),
53 .mca_open_component = orte_rmaps_resilient_open,
54 .mca_close_component = orte_rmaps_resilient_close,
55 .mca_query_component = orte_rmaps_resilient_query,
56 .mca_register_component_params = orte_rmaps_resilient_register,
57 },
58 .base_data = {
59
60 MCA_BASE_METADATA_PARAM_CHECKPOINT
61 },
62 }
63 };
64
65
66
67
68
69 static int orte_rmaps_resilient_register (void)
70 {
71 my_priority = 40;
72 (void) mca_base_component_var_register (&mca_rmaps_resilient_component.super.base_version,
73 "priority", "Priority of the resilient rmaps component",
74 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
75 OPAL_INFO_LVL_9,
76 MCA_BASE_VAR_SCOPE_READONLY, &my_priority);
77
78 mca_rmaps_resilient_component.fault_group_file = NULL;
79 (void) mca_base_component_var_register (&mca_rmaps_resilient_component.super.base_version,
80 "fault_grp_file",
81 "Filename that contains a description of fault groups for this system",
82 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
83 OPAL_INFO_LVL_9,
84 MCA_BASE_VAR_SCOPE_READONLY,
85 &mca_rmaps_resilient_component.fault_group_file);
86
87 return ORTE_SUCCESS;
88 }
89
90 static int orte_rmaps_resilient_open(void)
91 {
92
93 OBJ_CONSTRUCT(&mca_rmaps_resilient_component.fault_grps, opal_list_t);
94
95 return ORTE_SUCCESS;
96 }
97
98
99 static int orte_rmaps_resilient_query(mca_base_module_t **module, int *priority)
100 {
101 *priority = my_priority;
102 *module = (mca_base_module_t *)&orte_rmaps_resilient_module;
103
104
105 if (NULL != mca_rmaps_resilient_component.fault_group_file) {
106 *priority = 1000;
107 }
108
109 return ORTE_SUCCESS;
110 }
111
112
113
114
115
116 static int orte_rmaps_resilient_close(void)
117 {
118 opal_list_item_t *item;
119
120 while (NULL != (item = opal_list_remove_first(&mca_rmaps_resilient_component.fault_grps))) {
121 OBJ_RELEASE(item);
122 }
123 OBJ_DESTRUCT(&mca_rmaps_resilient_component.fault_grps);
124
125 if (NULL != mca_rmaps_resilient_component.fault_group_file) {
126 free(mca_rmaps_resilient_component.fault_group_file);
127 }
128
129 return ORTE_SUCCESS;
130 }
131
132 static void ftgrp_res_construct(orte_rmaps_res_ftgrp_t *ptr)
133 {
134 ptr->ftgrp = -1;
135 ptr->used = false;
136 ptr->included = false;
137 OBJ_CONSTRUCT(&ptr->nodes, opal_pointer_array_t);
138 opal_pointer_array_init(&ptr->nodes,
139 ORTE_GLOBAL_ARRAY_BLOCK_SIZE,
140 ORTE_GLOBAL_ARRAY_MAX_SIZE,
141 ORTE_GLOBAL_ARRAY_BLOCK_SIZE);
142 }
143 static void ftgrp_res_destruct(orte_rmaps_res_ftgrp_t *ptr)
144 {
145 int n;
146 orte_node_t *node;
147
148 for (n=0; n < ptr->nodes.size; n++) {
149 if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(&ptr->nodes, n))) {
150 continue;
151 }
152 OBJ_RELEASE(node);
153 }
154 OBJ_DESTRUCT(&ptr->nodes);
155 }
156 OBJ_CLASS_INSTANCE(orte_rmaps_res_ftgrp_t,
157 opal_list_item_t,
158 ftgrp_res_construct,
159 ftgrp_res_destruct);
160