1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2014 Intel, Inc. All rights reserved
4 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
5 * reserved.
6 * $COPYRIGHT$
7 *
8 * Additional copyrights may follow
9 *
10 * $HEADER$
11 */
12 /** @file:
13 *
14 * The Open RTE Run-Time Control Framework (RTC)
15 *
16 */
17
18 #ifndef ORTE_MCA_RTC_H
19 #define ORTE_MCA_RTC_H
20
21 #include "orte_config.h"
22 #include "orte/types.h"
23
24 #include "orte/mca/mca.h"
25 #include "opal/class/opal_list.h"
26
27 #include "orte/runtime/orte_globals.h"
28
29 BEGIN_C_DECLS
30
31 typedef struct {
32 opal_list_item_t super;
33 char *component;
34 char *category;
35 opal_value_t control;
36 } orte_rtc_resource_t;
37 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_rtc_resource_t);
38
39 /* Assign run-time controls for a given job. This provides each component with
40 * an opportunity to insert attributes into the orte_job_t and/or its
41 * associated proc structures that will be passed to backend daemons for
42 * controlling the job. For example, if the user specified a frequency
43 * setting for the job, then the freq component will have an opportunity
44 * to add an attribute to the job so the freq component on the remote daemons
45 * can "catch" it and perform the desired action
46 */
47 typedef void (*orte_rtc_base_module_assign_fn_t)(orte_job_t *jdata);
48
49 /* Set run-time controls for a given job and/or process. This can include
50 * controls for power, binding, memory, and any other resource on the node.
51 * Each active plugin will be given a chance to operate on the request, setting
52 * whatever controls that lie within its purview.
53 *
54 * Each module is responsible for reporting errors via the state machine. Thus,
55 * no error code is returned. However, warnings and error messages for the user
56 * can be output via the provided error_fd */
57 typedef void (*orte_rtc_base_module_set_fn_t)(orte_job_t *jdata,
58 orte_proc_t *proc,
59 char ***env,
60 int error_fd);
61
62 /* Return a list of valid controls values for this component.
63 * Each module is responsible for adding its control values
64 * to a list of opal_value_t objects.
65 */
66 typedef void (*orte_rtc_base_module_get_avail_vals_fn_t)(opal_list_t *vals);
67
68 /* provide a way for the module to init during selection */
69 typedef int (*orte_rtc_base_module_init_fn_t)(void);
70
71 /* provide a chance for the module to finalize */
72 typedef void (*orte_rtc_base_module_fini_fn_t)(void);
73
74 /*
75 * rtc module version 1.0.0
76 */
77 typedef struct {
78 orte_rtc_base_module_init_fn_t init;
79 orte_rtc_base_module_fini_fn_t finalize;
80 orte_rtc_base_module_assign_fn_t assign;
81 orte_rtc_base_module_set_fn_t set;
82 orte_rtc_base_module_get_avail_vals_fn_t get_available_values;
83 } orte_rtc_base_module_t;
84
85
86 /* provide a public API version */
87 typedef struct {
88 orte_rtc_base_module_assign_fn_t assign;
89 orte_rtc_base_module_set_fn_t set;
90 orte_rtc_base_module_get_avail_vals_fn_t get_available_values;
91 } orte_rtc_API_module_t;
92
93
94 /**
95 * rtc component version 1.0.0
96 */
97 typedef struct orte_rtc_base_component_1_0_0_t {
98 /** Base MCA structure */
99 mca_base_component_t base_version;
100 /** Base MCA data */
101 mca_base_component_data_t base_data;
102 } orte_rtc_base_component_t;
103
104 /* declare the struct containing the public API */
105 ORTE_DECLSPEC extern orte_rtc_API_module_t orte_rtc;
106
107 /*
108 * Macro for use in components that are of type rtc
109 */
110 #define ORTE_RTC_BASE_VERSION_1_0_0 \
111 ORTE_MCA_BASE_VERSION_2_1_0("rtc", 1, 0, 0)
112
113
114 END_C_DECLS
115
116 #endif