This source file includes following definitions.
- ras_slurm_register
- ras_slurm_open
- ras_slurm_close
- orte_ras_slurm_component_query
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "orte_config.h"
24 #include "orte/constants.h"
25
26 #include "opal/mca/base/base.h"
27 #include "opal/util/net.h"
28 #include "opal/opal_socket_errno.h"
29
30 #include "orte/util/name_fns.h"
31 #include "orte/mca/errmgr/errmgr.h"
32 #include "orte/runtime/orte_globals.h"
33
34 #include "orte/mca/ras/base/ras_private.h"
35 #include "ras_slurm.h"
36
37
38
39
40
41 static int ras_slurm_register(void);
42 static int ras_slurm_open(void);
43 static int ras_slurm_close(void);
44 static int orte_ras_slurm_component_query(mca_base_module_t **module, int *priority);
45
46
47 orte_ras_slurm_component_t mca_ras_slurm_component = {
48 {
49
50
51
52 .base_version = {
53 ORTE_RAS_BASE_VERSION_2_0_0,
54
55
56 .mca_component_name = "slurm",
57 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
58 ORTE_RELEASE_VERSION),
59
60
61 .mca_open_component = ras_slurm_open,
62 .mca_close_component = ras_slurm_close,
63 .mca_query_component = orte_ras_slurm_component_query,
64 .mca_register_component_params = ras_slurm_register
65 },
66 .base_data = {
67
68 MCA_BASE_METADATA_PARAM_CHECKPOINT
69 },
70 }
71 };
72
73
74 static int ras_slurm_register(void)
75 {
76 mca_base_component_t *component = &mca_ras_slurm_component.super.base_version;
77
78 mca_ras_slurm_component.timeout = 30;
79 (void) mca_base_component_var_register (component, "dyn_allocate_timeout",
80 "Number of seconds to wait for Slurm dynamic allocation",
81 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
82 OPAL_INFO_LVL_9,
83 MCA_BASE_VAR_SCOPE_READONLY,
84 &mca_ras_slurm_component.timeout);
85
86 mca_ras_slurm_component.dyn_alloc_enabled = false;
87 (void) mca_base_component_var_register (component, "enable_dyn_alloc",
88 "Whether or not dynamic allocations are enabled",
89 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
90 OPAL_INFO_LVL_9,
91 MCA_BASE_VAR_SCOPE_READONLY,
92 &mca_ras_slurm_component.dyn_alloc_enabled);
93
94 mca_ras_slurm_component.config_file = NULL;
95 (void) mca_base_component_var_register (component, "config_file",
96 "Path to Slurm configuration file",
97 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
98 OPAL_INFO_LVL_9,
99 MCA_BASE_VAR_SCOPE_READONLY,
100 &mca_ras_slurm_component.config_file);
101
102 mca_ras_slurm_component.rolling_alloc = false;
103 (void) mca_base_component_var_register (component, "enable_rolling_alloc",
104 "Enable partial dynamic allocations",
105 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
106 OPAL_INFO_LVL_9,
107 MCA_BASE_VAR_SCOPE_READONLY,
108 &mca_ras_slurm_component.rolling_alloc);
109
110 mca_ras_slurm_component.use_all = false;
111 (void) mca_base_component_var_register (component, "use_entire_allocation",
112 "Use entire allocation (not just job step nodes) for this application",
113 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
114 OPAL_INFO_LVL_5,
115 MCA_BASE_VAR_SCOPE_READONLY,
116 &mca_ras_slurm_component.use_all);
117
118 return ORTE_SUCCESS;
119 }
120
121 static int ras_slurm_open(void)
122 {
123 return ORTE_SUCCESS;
124 }
125
126 static int ras_slurm_close(void)
127 {
128 return ORTE_SUCCESS;
129 }
130
131 static int orte_ras_slurm_component_query(mca_base_module_t **module, int *priority)
132 {
133
134
135
136
137 if (NULL == getenv("SLURM_JOBID") &&
138 !mca_ras_slurm_component.dyn_alloc_enabled) {
139
140 *priority = 0;
141 *module = NULL;
142 return ORTE_ERROR;
143 }
144
145 OPAL_OUTPUT_VERBOSE((2, orte_ras_base_framework.framework_output,
146 "%s ras:slurm: available for selection",
147 ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
148
149
150
151
152 *priority = 50;
153 *module = (mca_base_module_t *) &orte_ras_slurm_module;
154 return ORTE_SUCCESS;
155 }