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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
/*
* Copyright (c) 2004-2012 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2011 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "orte/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/util/output.h"
#include "opal/util/opal_environ.h"
#include "orte/mca/snapc/snapc.h"
#include "orte/mca/snapc/base/base.h"
#include "snapc_full.h"
/*
* Full module
*/
static orte_snapc_base_module_t loc_module = {
/** Initialization Function */
orte_snapc_full_module_init,
/** Finalization Function */
orte_snapc_full_module_finalize,
orte_snapc_full_setup_job,
orte_snapc_full_release_job,
orte_snapc_full_ft_event,
orte_snapc_full_start_ckpt,
orte_snapc_full_end_ckpt,
orte_snapc_full_request_op
};
/*
* Global Snapshot structure
*/
void orte_snapc_full_orted_construct(orte_snapc_full_orted_snapshot_t *obj);
void orte_snapc_full_orted_destruct( orte_snapc_full_orted_snapshot_t *obj);
OBJ_CLASS_INSTANCE(orte_snapc_full_orted_snapshot_t,
orte_snapc_base_global_snapshot_t,
orte_snapc_full_orted_construct,
orte_snapc_full_orted_destruct);
/*
* Local Snapshot structure
*/
void orte_snapc_full_app_construct(orte_snapc_full_app_snapshot_t *obj);
void orte_snapc_full_app_destruct( orte_snapc_full_app_snapshot_t *obj);
OBJ_CLASS_INSTANCE(orte_snapc_full_app_snapshot_t,
orte_snapc_base_local_snapshot_t,
orte_snapc_full_app_construct,
orte_snapc_full_app_destruct);
/************************************
* Locally Global vars & functions :)
************************************/
/************************
* Function Definitions
************************/
void orte_snapc_full_orted_construct(orte_snapc_full_orted_snapshot_t *snapshot) {
snapshot->process_name.jobid = 0;
snapshot->process_name.vpid = 0;
snapshot->state = ORTE_SNAPC_CKPT_STATE_NONE;
}
void orte_snapc_full_orted_destruct( orte_snapc_full_orted_snapshot_t *snapshot) {
snapshot->process_name.jobid = 0;
snapshot->process_name.vpid = 0;
snapshot->state = ORTE_SNAPC_CKPT_STATE_NONE;
}
void orte_snapc_full_app_construct(orte_snapc_full_app_snapshot_t *app_snapshot) {
app_snapshot->comm_pipe_r = NULL;
app_snapshot->comm_pipe_w = NULL;
app_snapshot->comm_pipe_r_fd = -1;
app_snapshot->comm_pipe_w_fd = -1;
app_snapshot->is_eh_active = false;
app_snapshot->unique_pipe_id = 0;
app_snapshot->process_pid = 0;
app_snapshot->migrating = false;
app_snapshot->finished = false;
}
void orte_snapc_full_app_destruct( orte_snapc_full_app_snapshot_t *app_snapshot) {
if( NULL != app_snapshot->comm_pipe_r ) {
free(app_snapshot->comm_pipe_r);
app_snapshot->comm_pipe_r = NULL;
}
if( NULL != app_snapshot->comm_pipe_w ) {
free(app_snapshot->comm_pipe_w);
app_snapshot->comm_pipe_w = NULL;
}
app_snapshot->comm_pipe_r_fd = -1;
app_snapshot->comm_pipe_w_fd = -1;
app_snapshot->is_eh_active = false;
app_snapshot->unique_pipe_id = 0;
app_snapshot->process_pid = 0;
app_snapshot->migrating = false;
app_snapshot->finished = false;
}
/*
* MCA Functions
*/
int orte_snapc_full_component_query(mca_base_module_t **module, int *priority)
{
opal_output_verbose(10, mca_snapc_full_component.super.output_handle,
"snapc:full: component_query()");
*priority = mca_snapc_full_component.super.priority;
*module = (mca_base_module_t *)&loc_module;
return ORTE_SUCCESS;
}
int orte_snapc_full_module_init(bool seed, bool app)
{
int ret, exit_status = ORTE_SUCCESS;
opal_output_verbose(10, mca_snapc_full_component.super.output_handle,
"snapc:full: module_init(%d, %d)", seed, app);
/*
* Global Snapshot Coordinator
*/
if(seed) {
opal_output_verbose(5, mca_snapc_full_component.super.output_handle,
"snapc:full: module_init: Global Snapshot Coordinator");
orte_snapc_coord_type |= ORTE_SNAPC_GLOBAL_COORD_TYPE;
if( ORTE_SUCCESS != (ret = global_coord_init()) ) {
exit_status = ret;
goto cleanup;
}
}
/*
* Local Snapshot Coordinator -- orted
*/
else if(!seed && !app) {
/*
* JJH Currently we are not guarenteed a bootproxy, and we have no way
* JJH (that I know of) to tell if we were generated from the bootproxy
* JJH or from the HNP inside the application.
* JJH so for this component we assume that there exists a local coordinator
*/
opal_output_verbose(5, mca_snapc_full_component.super.output_handle,
"snapc:full: module_init: Local Snapshot Coordinator");
orte_snapc_coord_type |= ORTE_SNAPC_LOCAL_COORD_TYPE;
if( ORTE_SUCCESS != (ret = local_coord_init()) ) {
exit_status = ret;
goto cleanup;
}
}
/*
* Application Snapshot Coordinator
*/
else if(app) {
/*
* Start the app coordinator only after ORTE has initialized.
*/
if(!orte_initialized) {
goto cleanup;
}
opal_output_verbose(5, mca_snapc_full_component.super.output_handle,
"snapc:full: module_init: Application Snapshot Coordinator");
orte_snapc_coord_type |= ORTE_SNAPC_APP_COORD_TYPE;
if( ORTE_SUCCESS != (ret = app_coord_init()) ) {
exit_status = ret;
goto cleanup;
}
}
else {
/*
* Logically this should not happen
*/
opal_output_verbose(5, mca_snapc_full_component.super.output_handle,
"snapc:full: module_init: Unknown Snapshot Coordinator");
orte_snapc_coord_type = ORTE_SNAPC_UNASSIGN_TYPE;
exit_status = ORTE_ERROR;
goto cleanup;
}
cleanup:
return exit_status;
}
int orte_snapc_full_module_finalize(void)
{
opal_output_verbose(10, mca_snapc_full_component.super.output_handle,
"snapc:full: module_finalize()");
switch(orte_snapc_coord_type)
{
case ORTE_SNAPC_GLOBAL_COORD_TYPE:
global_coord_finalize();
break;
case ORTE_SNAPC_LOCAL_COORD_TYPE:
local_coord_finalize();
break;
case ORTE_SNAPC_APP_COORD_TYPE:
app_coord_finalize();
break;
default:
break;
}
orte_snapc_coord_type = ORTE_SNAPC_UNASSIGN_TYPE;
return ORTE_SUCCESS;
}
int orte_snapc_full_setup_job(orte_jobid_t jobid) {
int ret, exit_status = ORTE_SUCCESS;
if( ORTE_SNAPC_GLOBAL_COORD_TYPE == (orte_snapc_coord_type & ORTE_SNAPC_GLOBAL_COORD_TYPE)) {
if(ORTE_SUCCESS != (ret = global_coord_setup_job(jobid) ) ) {
exit_status = ret;
}
}
else if( ORTE_SNAPC_LOCAL_COORD_TYPE == (orte_snapc_coord_type & ORTE_SNAPC_LOCAL_COORD_TYPE)) {
if(ORTE_SUCCESS != (ret = local_coord_setup_job(jobid) ) ) {
exit_status = ret;
}
}
return exit_status;
}
int orte_snapc_full_release_job(orte_jobid_t jobid) {
int ret, exit_status = ORTE_SUCCESS;
if( ORTE_SNAPC_GLOBAL_COORD_TYPE == (orte_snapc_coord_type & ORTE_SNAPC_GLOBAL_COORD_TYPE)) {
if(ORTE_SUCCESS != (ret = global_coord_release_job(jobid) ) ) {
exit_status = ret;
}
}
else if( ORTE_SNAPC_LOCAL_COORD_TYPE == (orte_snapc_coord_type & ORTE_SNAPC_LOCAL_COORD_TYPE )) {
if(ORTE_SUCCESS != (ret = local_coord_release_job(jobid) ) ) {
exit_status = ret;
}
}
return exit_status;
}
int orte_snapc_full_ft_event(int state) {
switch(orte_snapc_coord_type)
{
case ORTE_SNAPC_GLOBAL_COORD_TYPE:
case ORTE_SNAPC_LOCAL_COORD_TYPE:
; /* Do nothing */
break;
case ORTE_SNAPC_APP_COORD_TYPE:
return app_coord_ft_event(state);
break;
default:
break;
}
return ORTE_SUCCESS;
}
int orte_snapc_full_start_ckpt(orte_snapc_base_quiesce_t *datum)
{
switch(orte_snapc_coord_type)
{
case ORTE_SNAPC_GLOBAL_COORD_TYPE:
return global_coord_start_ckpt(datum);
break;
case ORTE_SNAPC_LOCAL_COORD_TYPE:
; /* Do nothing */
break;
case ORTE_SNAPC_APP_COORD_TYPE:
; /* Do nothing. Use app_coord_request_op() instead */
break;
default:
break;
}
return ORTE_SUCCESS;
}
int orte_snapc_full_end_ckpt(orte_snapc_base_quiesce_t *datum)
{
switch(orte_snapc_coord_type)
{
case ORTE_SNAPC_GLOBAL_COORD_TYPE:
return global_coord_end_ckpt(datum);
break;
case ORTE_SNAPC_LOCAL_COORD_TYPE:
; /* Do nothing */
break;
case ORTE_SNAPC_APP_COORD_TYPE:
; /* Do nothing. Use app_coord_request_op() instead */
break;
default:
break;
}
return ORTE_SUCCESS;
}
int orte_snapc_full_request_op(orte_snapc_base_request_op_t *datum)
{
switch(orte_snapc_coord_type)
{
case ORTE_SNAPC_GLOBAL_COORD_TYPE:
; /* Do nothing */
break;
case ORTE_SNAPC_LOCAL_COORD_TYPE:
; /* Do nothing */
break;
case ORTE_SNAPC_APP_COORD_TYPE:
return app_coord_request_op(datum);
break;
default:
break;
}
return ORTE_SUCCESS;
}
/******************
* Local functions
******************/
|