This source file includes following definitions.
- mca_vprotocol_pessimist_component_register
- mca_vprotocol_pessimist_component_open
- mca_vprotocol_pessimist_component_close
- mca_vprotocol_pessimist_component_init
- mca_vprotocol_pessimist_component_finalize
- mca_vprotocol_pessimist_enable
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include "ompi_config.h"
15
16 #include "ompi/mca/mca.h"
17 #include "vprotocol_pessimist.h"
18
19 static int mca_vprotocol_pessimist_component_register(void);
20 static int mca_vprotocol_pessimist_component_open(void);
21 static int mca_vprotocol_pessimist_component_close(void);
22
23 static mca_vprotocol_base_module_t *mca_vprotocol_pessimist_component_init( int* priority, bool, bool);
24 static int mca_vprotocol_pessimist_component_finalize(void);
25
26 static int _priority;
27 static int _free_list_num;
28 static int _free_list_max;
29 static int _free_list_inc;
30 static int _sender_based_size;
31 static int _event_buffer_size;
32 static char *_mmap_file_name;
33
34 mca_vprotocol_base_component_2_0_0_t mca_vprotocol_pessimist_component =
35 {
36
37
38 .pmlm_version = {
39 MCA_VPROTOCOL_BASE_VERSION_2_0_0,
40
41 .mca_component_name = "pessimist",
42 .mca_component_major_version = OMPI_MAJOR_VERSION,
43 .mca_component_minor_version = OMPI_MINOR_VERSION,
44 .mca_component_release_version = OMPI_RELEASE_VERSION,
45 .mca_open_component = mca_vprotocol_pessimist_component_open,
46 .mca_close_component = mca_vprotocol_pessimist_component_close,
47 .mca_register_component_params = mca_vprotocol_pessimist_component_register,
48 },
49 .pmlm_data = {
50
51 MCA_BASE_METADATA_PARAM_NONE
52 },
53
54 .pmlm_init = mca_vprotocol_pessimist_component_init,
55 .pmlm_finalize = mca_vprotocol_pessimist_component_finalize,
56 };
57
58
59
60 static int mca_vprotocol_pessimist_component_register(void)
61 {
62 _priority = 30;
63 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
64 "priority", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
65 OPAL_INFO_LVL_9,
66 MCA_BASE_VAR_SCOPE_READONLY, &_priority);\
67 _free_list_num = 16;
68 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
69 "free_list_num", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
70 OPAL_INFO_LVL_9,
71 MCA_BASE_VAR_SCOPE_READONLY, &_free_list_num);
72 _free_list_max = -1;
73 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
74 "free_list_max", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
75 OPAL_INFO_LVL_9,
76 MCA_BASE_VAR_SCOPE_READONLY, &_free_list_max);
77 _free_list_inc = 64;
78 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
79 "free_list_inc", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
80 OPAL_INFO_LVL_9,
81 MCA_BASE_VAR_SCOPE_READONLY, &_free_list_inc);
82 _sender_based_size = 256 * 1024 * 1024;
83 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
84 "sender_based_chunk", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
85 OPAL_INFO_LVL_9,
86 MCA_BASE_VAR_SCOPE_READONLY, &_sender_based_size);
87 _event_buffer_size = 1024;
88 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
89 "event_buffer_size", NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
90 OPAL_INFO_LVL_9,
91 MCA_BASE_VAR_SCOPE_READONLY, &_event_buffer_size);
92 _mmap_file_name = "vprotocol_pessimist-senderbased";
93 (void) mca_base_component_var_register(&mca_vprotocol_pessimist_component.pmlm_version,
94 "sender_based_file", NULL, MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
95 OPAL_INFO_LVL_9,
96 MCA_BASE_VAR_SCOPE_READONLY, &_mmap_file_name);
97 return OMPI_SUCCESS;
98 }
99
100 static int mca_vprotocol_pessimist_component_open(void)
101 {
102 V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_open: read priority %d", _priority);
103 return OMPI_SUCCESS;
104 }
105
106 static int mca_vprotocol_pessimist_component_close(void)
107 {
108 V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_close");
109 return OMPI_SUCCESS;
110 }
111
112
113
114 static mca_vprotocol_base_module_t *mca_vprotocol_pessimist_component_init( int* priority,
115 bool enable_progress_threads,
116 bool enable_mpi_threads)
117 {
118 V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_init");
119 *priority = _priority;
120
121
122 if(enable_mpi_threads)
123 {
124 opal_output(0, "vprotocol_pessimist: component_init: threads are enabled, and not supported by vprotocol pessimist fault tolerant layer, will not load");
125 return NULL;
126 }
127
128 mca_vprotocol_pessimist.clock = 1;
129 mca_vprotocol_pessimist.replay = false;
130 OBJ_CONSTRUCT(&mca_vprotocol_pessimist.replay_events, opal_list_t);
131 OBJ_CONSTRUCT(&mca_vprotocol_pessimist.pending_events, opal_list_t);
132 OBJ_CONSTRUCT(&mca_vprotocol_pessimist.events_pool, opal_free_list_t);
133 opal_free_list_init (&mca_vprotocol_pessimist.events_pool,
134 sizeof(mca_vprotocol_pessimist_event_t),
135 opal_cache_line_size,
136 OBJ_CLASS(mca_vprotocol_pessimist_event_t),
137 0,opal_cache_line_size,
138 _free_list_num,
139 _free_list_max,
140 _free_list_inc,
141 NULL, 0, NULL, NULL, NULL);
142 mca_vprotocol_pessimist.event_buffer_max_length =
143 _event_buffer_size / sizeof(vprotocol_pessimist_mem_event_t);
144 mca_vprotocol_pessimist.event_buffer_length = 0;
145 mca_vprotocol_pessimist.event_buffer =
146 (vprotocol_pessimist_mem_event_t *) malloc(_event_buffer_size);
147 mca_vprotocol_pessimist.el_comm = MPI_COMM_NULL;
148
149 return &mca_vprotocol_pessimist.super;
150 }
151
152 static int mca_vprotocol_pessimist_component_finalize(void)
153 {
154 V_OUTPUT_VERBOSE(500, "vprotocol_pessimist_finalize");
155 free(mca_vprotocol_pessimist.event_buffer);
156 OBJ_DESTRUCT(&mca_vprotocol_pessimist.replay_events);
157 OBJ_DESTRUCT(&mca_vprotocol_pessimist.pending_events);
158 OBJ_DESTRUCT(&mca_vprotocol_pessimist.events_pool);
159 return OMPI_SUCCESS;
160 }
161
162 int mca_vprotocol_pessimist_enable(bool enable) {
163 if(enable) {
164 int ret;
165 if((ret = vprotocol_pessimist_sender_based_init(_mmap_file_name,
166 _sender_based_size)) != OMPI_SUCCESS)
167 return ret;
168 }
169 else {
170 vprotocol_pessimist_sender_based_finalize();
171 vprotocol_pessimist_event_logger_disconnect(mca_vprotocol_pessimist.el_comm);
172 }
173 return OMPI_SUCCESS;
174 }