2007-03-17 02:11:45 +03:00
|
|
|
/*
|
2008-06-25 18:55:09 +04:00
|
|
|
* Copyright (c) 2004-2008 The Trustees of Indiana University.
|
2007-03-17 02:11:45 +03:00
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 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.
|
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$
|
|
|
|
*/
|
|
|
|
|
2007-04-01 20:10:05 +04:00
|
|
|
#include "opal_config.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
|
2009-03-13 05:10:32 +03:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2009-03-12 22:21:11 +03:00
|
|
|
#include "opal/constants.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "opal/mca/crs/crs.h"
|
|
|
|
#include "opal/mca/crs/base/base.h"
|
|
|
|
#include "opal/util/output.h"
|
2010-05-18 03:08:56 +04:00
|
|
|
#include "opal/util/opal_sos.h"
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
#include "opal/mca/crs/base/static-components.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Globals
|
|
|
|
*/
|
|
|
|
int opal_crs_base_output = -1;
|
|
|
|
opal_crs_base_module_t opal_crs = {
|
|
|
|
NULL, /* crs_init */
|
|
|
|
NULL, /* crs_finalize */
|
|
|
|
NULL, /* crs_checkpoint */
|
|
|
|
NULL, /* crs_restart_cmd */
|
|
|
|
NULL, /* crs_disable_checkpoint */
|
2008-02-20 01:15:52 +03:00
|
|
|
NULL, /* crs_enable_checkpoint */
|
|
|
|
NULL, /* crs_prelaunch */
|
|
|
|
NULL /* crs_reg_thread */
|
2007-03-17 02:11:45 +03:00
|
|
|
};
|
|
|
|
opal_list_t opal_crs_base_components_available;
|
|
|
|
opal_crs_base_component_t opal_crs_base_selected_component;
|
|
|
|
char * opal_crs_base_snapshot_dir = NULL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components,
|
|
|
|
* or the one that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
|
|
|
int opal_crs_base_open(void)
|
|
|
|
{
|
2008-06-25 18:55:09 +04:00
|
|
|
int ret, exit_status = OPAL_SUCCESS;
|
2007-03-17 02:11:45 +03:00
|
|
|
int value;
|
|
|
|
char *str_value = NULL;
|
|
|
|
|
|
|
|
/* Debugging/Verbose output */
|
2007-08-18 07:05:45 +04:00
|
|
|
mca_base_param_reg_int_name("crs",
|
|
|
|
"base_verbose",
|
2007-03-17 02:11:45 +03:00
|
|
|
"Verbosity level of the CRS framework",
|
|
|
|
false, false,
|
|
|
|
0, &value);
|
|
|
|
if(0 != value) {
|
|
|
|
opal_crs_base_output = opal_output_open(NULL);
|
|
|
|
} else {
|
|
|
|
opal_crs_base_output = -1;
|
|
|
|
}
|
|
|
|
opal_output_set_verbosity(opal_crs_base_output, value);
|
|
|
|
|
|
|
|
/* Base snapshot directory */
|
2007-08-18 07:05:45 +04:00
|
|
|
mca_base_param_reg_string_name("crs",
|
|
|
|
"base_snapshot_dir",
|
2007-03-17 02:11:45 +03:00
|
|
|
"The base directory to use when storing snapshots",
|
|
|
|
true, false,
|
|
|
|
strdup("/tmp"),
|
|
|
|
&opal_crs_base_snapshot_dir);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Which CRS component to open
|
|
|
|
* - NULL or "" = auto-select
|
|
|
|
* - "none" = Empty component
|
|
|
|
* - ow. select that specific component
|
|
|
|
*/
|
|
|
|
mca_base_param_reg_string_name("crs", NULL,
|
|
|
|
"Which CRS component to use (empty = auto-select)",
|
|
|
|
false, false,
|
2008-07-09 00:04:39 +04:00
|
|
|
"none", &str_value);
|
2007-03-17 02:11:45 +03:00
|
|
|
|
|
|
|
/* Open up all available components */
|
2008-06-25 18:55:09 +04:00
|
|
|
if (OPAL_SUCCESS != (ret = mca_base_components_open("crs",
|
|
|
|
opal_crs_base_output,
|
|
|
|
mca_crs_base_static_components,
|
|
|
|
&opal_crs_base_components_available,
|
|
|
|
true)) ) {
|
2010-05-18 03:08:56 +04:00
|
|
|
if( OPAL_ERR_NOT_FOUND == OPAL_SOS_GET_ERROR_CODE(ret) &&
|
2008-06-25 18:55:09 +04:00
|
|
|
NULL != str_value &&
|
|
|
|
0 == strncmp(str_value, "none", strlen("none")) ) {
|
|
|
|
exit_status = OPAL_SUCCESS;
|
|
|
|
} else {
|
|
|
|
exit_status = OPAL_ERROR;
|
|
|
|
}
|
2007-03-17 02:11:45 +03:00
|
|
|
}
|
|
|
|
|
2008-06-25 18:55:09 +04:00
|
|
|
if( NULL != str_value ) {
|
|
|
|
free(str_value);
|
|
|
|
}
|
|
|
|
return exit_status;
|
2007-03-17 02:11:45 +03:00
|
|
|
}
|