2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
2008-03-31 22:13:41 +04:00
|
|
|
* Copyright (c) 2004-2008 The Trustees of the University of Tennessee.
|
2007-03-17 02:11:45 +03:00
|
|
|
* 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.
|
2007-10-17 17:47:36 +04:00
|
|
|
* Copyright (c) 2007 Evergrid, Inc. All rights reserved.
|
|
|
|
*
|
2007-03-17 02:11:45 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
|
|
|
|
2009-03-13 05:10:32 +03:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
2008-06-18 07:15:56 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2008-03-31 22:13:41 +04:00
|
|
|
#include "opal/util/opal_environ.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2009-03-13 05:10:32 +03:00
|
|
|
#include "orte/constants.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "orte/mca/snapc/snapc.h"
|
|
|
|
#include "orte/mca/snapc/base/base.h"
|
|
|
|
|
|
|
|
#include "orte/mca/snapc/base/static-components.h"
|
|
|
|
|
2008-06-18 07:15:56 +04:00
|
|
|
#if ORTE_DISABLE_FULL_SUPPORT
|
|
|
|
/* have to include a bogus function here so that
|
|
|
|
* the build system sees at least one function
|
|
|
|
* in the library
|
|
|
|
*/
|
|
|
|
int orte_snapc_base_open(void)
|
|
|
|
{
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Globals
|
|
|
|
*/
|
|
|
|
int orte_snapc_base_output = -1;
|
|
|
|
bool orte_snapc_base_is_tool = false;
|
|
|
|
orte_snapc_base_module_t orte_snapc = {
|
|
|
|
NULL, /* snapc_init */
|
|
|
|
NULL, /* snapc_finalize */
|
|
|
|
NULL, /* setup_job */
|
|
|
|
NULL /* release_job */
|
|
|
|
};
|
|
|
|
|
|
|
|
opal_list_t orte_snapc_base_components_available;
|
|
|
|
orte_snapc_base_component_t orte_snapc_base_selected_component;
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_snapc_coord_type_t orte_snapc_coord_type = ORTE_SNAPC_UNASSIGN_TYPE;
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
char * orte_snapc_base_global_snapshot_dir = NULL;
|
2007-10-17 17:47:36 +04:00
|
|
|
char * orte_snapc_base_global_snapshot_loc = NULL;
|
|
|
|
char * orte_snapc_base_global_snapshot_ref = NULL;
|
2007-03-17 02:11:45 +03:00
|
|
|
bool orte_snapc_base_store_in_place = true;
|
2007-10-17 17:47:36 +04:00
|
|
|
bool orte_snapc_base_store_only_one_seq = false;
|
2008-03-05 07:57:23 +03:00
|
|
|
bool orte_snapc_base_establish_global_snapshot_dir = false;
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components,
|
|
|
|
* or the one that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
|
|
|
int orte_snapc_base_open(void)
|
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
int value = 0;
|
2007-03-17 02:11:45 +03:00
|
|
|
char * str_value = NULL;
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((10, orte_snapc_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"snapc:base: open()"));
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
orte_snapc_base_output = opal_output_open(NULL);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/* Global Snapshot directory */
|
2007-08-18 07:05:45 +04:00
|
|
|
mca_base_param_reg_string_name("snapc",
|
|
|
|
"base_global_snapshot_dir",
|
2007-03-17 02:11:45 +03:00
|
|
|
"The base directory to use when storing global snapshots",
|
|
|
|
false, false,
|
2008-03-31 22:13:41 +04:00
|
|
|
opal_home_directory(),
|
2007-03-17 02:11:45 +03:00
|
|
|
&orte_snapc_base_global_snapshot_dir);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_snapc_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"snapc:base: open: base_global_snapshot_dir = %s",
|
|
|
|
orte_snapc_base_global_snapshot_dir));
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/*
|
|
|
|
* Store the checkpoint files in their final location.
|
|
|
|
* This assumes that the storage place is on a shared file
|
|
|
|
* system that all nodes can access uniformly.
|
|
|
|
* Default = enabled
|
|
|
|
*/
|
2007-08-18 07:05:45 +04:00
|
|
|
mca_base_param_reg_int_name("snapc",
|
|
|
|
"base_store_in_place",
|
2007-03-17 02:11:45 +03:00
|
|
|
"If global_snapshot_dir is on a shared file system all nodes can access, "
|
|
|
|
"then the checkpoint files can be stored in place instead of incurring a "
|
|
|
|
"remote copy. [Default = enabled]",
|
|
|
|
false, false,
|
|
|
|
1,
|
|
|
|
&value);
|
2007-12-13 17:37:17 +03:00
|
|
|
orte_snapc_base_store_in_place = OPAL_INT_TO_BOOL(value);
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_snapc_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"snapc:base: open: base_store_in_place = %d",
|
|
|
|
orte_snapc_base_store_in_place));
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2007-10-17 17:47:36 +04:00
|
|
|
/*
|
|
|
|
* Reuse sequence numbers
|
|
|
|
* This will create a directory and always use seq 0 for all checkpoints
|
|
|
|
* This *should* also enforce a 2-phase commit protocol
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_int_name("snapc_base",
|
|
|
|
"only_one_seq",
|
|
|
|
"Only store the most recent checkpoint sequence. [Default = disabled]",
|
|
|
|
false, false,
|
|
|
|
0,
|
|
|
|
&value);
|
2007-12-13 17:37:17 +03:00
|
|
|
orte_snapc_base_store_only_one_seq = OPAL_INT_TO_BOOL(value);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_snapc_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"snapc:base: open: base_only_one_seq = %d",
|
|
|
|
orte_snapc_base_store_only_one_seq));
|
|
|
|
|
2007-10-17 17:47:36 +04:00
|
|
|
/*
|
|
|
|
* Pre-establish the global snapshot directory upon job registration
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_int_name("snapc_base",
|
|
|
|
"establish_global_snapshot_dir",
|
|
|
|
"Establish the global snapshot directory on job startup. [Default = disabled]",
|
|
|
|
false, false,
|
|
|
|
0,
|
|
|
|
&value);
|
2008-03-05 07:57:23 +03:00
|
|
|
orte_snapc_base_establish_global_snapshot_dir = OPAL_INT_TO_BOOL(value);
|
2007-10-17 17:47:36 +04:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_snapc_base_output,
|
2008-03-05 07:57:23 +03:00
|
|
|
"snapc:base: open: base_establish_global_snapshot_dir = %d",
|
|
|
|
orte_snapc_base_establish_global_snapshot_dir));
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2007-10-17 17:47:36 +04:00
|
|
|
/*
|
|
|
|
* User defined global snapshot directory name for this job
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_string_name("snapc_base",
|
|
|
|
"global_snapshot_ref",
|
|
|
|
"The global snapshot reference to be used for this job. "
|
|
|
|
" [Default = ompi_global_snapshot_MPIRUNPID.ckpt]",
|
|
|
|
false, false,
|
|
|
|
NULL,
|
|
|
|
&orte_snapc_base_global_snapshot_ref);
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_snapc_base_output,
|
2008-02-28 04:57:57 +03:00
|
|
|
"snapc:base: open: base_global_snapshot_ref = %s",
|
|
|
|
orte_snapc_base_global_snapshot_ref));
|
2007-10-17 17:47:36 +04:00
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/* Init the sequence (interval) number */
|
|
|
|
orte_snapc_base_snapshot_seq_number = 0;
|
|
|
|
|
2007-10-17 17:47:36 +04:00
|
|
|
if( NULL == orte_snapc_base_global_snapshot_loc ) {
|
|
|
|
char *t1 = NULL;
|
|
|
|
char *t2 = NULL;
|
|
|
|
t1 = strdup( orte_snapc_base_unique_global_snapshot_name( getpid() ) );
|
|
|
|
t2 = orte_snapc_base_get_global_snapshot_directory( t1 );
|
|
|
|
orte_snapc_base_global_snapshot_loc = strdup(t2);
|
|
|
|
free(t1);
|
|
|
|
free(t2);
|
|
|
|
}
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Which SnapC component to open
|
|
|
|
* - NULL or "" = auto-select
|
|
|
|
* - "none" = Empty component
|
|
|
|
* - ow. select that specific component
|
|
|
|
* Note: Set the default to NULL here so ompi_info will work correctly,
|
|
|
|
* The 'real' default is set in base_select.c
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_string_name("snapc", NULL,
|
|
|
|
"Which SNAPC component to use (empty = auto-select)",
|
|
|
|
false, false,
|
|
|
|
NULL, &str_value);
|
|
|
|
if( NULL != str_value ) {
|
|
|
|
free(str_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open up all available components */
|
|
|
|
if (OPAL_SUCCESS !=
|
|
|
|
mca_base_components_open("snapc",
|
|
|
|
orte_snapc_base_output,
|
|
|
|
mca_snapc_base_static_components,
|
|
|
|
&orte_snapc_base_components_available,
|
|
|
|
true)) {
|
|
|
|
return ORTE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
2008-06-18 07:15:56 +04:00
|
|
|
|
|
|
|
#endif /* ORTE_DISABLE_FULL_SUPPORT */
|