2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2007-03-22 18:26:16 +03:00
|
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
2005-03-14 23:57:21 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-03-23 03:47:30 +03:00
|
|
|
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
|
|
|
|
2005-08-24 22:37:28 +04:00
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2005-09-11 14:14:29 +04:00
|
|
|
#include "opal/util/output.h"
|
2007-03-23 03:47:30 +03:00
|
|
|
#include "opal/util/basename.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/orte_constants.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/util/proc_info.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
#include "ras_tm.h"
|
|
|
|
|
|
|
|
|
2005-08-25 00:50:26 +04:00
|
|
|
/*
|
|
|
|
* Local variables
|
|
|
|
*/
|
|
|
|
static int param_priority;
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2005-08-25 00:50:26 +04:00
|
|
|
static int ras_tm_open(void);
|
2005-03-14 23:57:21 +03:00
|
|
|
static orte_ras_base_module_t *ras_tm_init(int*);
|
|
|
|
|
|
|
|
|
2007-02-09 18:06:45 +03:00
|
|
|
orte_ras_tm_component_t mca_ras_tm_component = {
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2007-02-09 18:06:45 +03:00
|
|
|
/* First, the mca_base_component_t struct containing meta
|
|
|
|
information about the component itself */
|
|
|
|
|
|
|
|
{
|
|
|
|
/* Indicate that we are a ras v1.3.0 component (which also
|
|
|
|
implies a specific MCA version) */
|
|
|
|
|
|
|
|
ORTE_RAS_BASE_VERSION_1_3_0,
|
|
|
|
|
|
|
|
/* Component name and version */
|
|
|
|
|
|
|
|
"tm",
|
|
|
|
ORTE_MAJOR_VERSION,
|
|
|
|
ORTE_MINOR_VERSION,
|
|
|
|
ORTE_RELEASE_VERSION,
|
|
|
|
|
|
|
|
/* Component open and close functions */
|
|
|
|
|
|
|
|
ras_tm_open,
|
|
|
|
NULL
|
|
|
|
},
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2007-02-09 18:06:45 +03:00
|
|
|
/* Next the MCA v1.0.0 component meta data */
|
|
|
|
{
|
2007-03-17 02:11:45 +03:00
|
|
|
/* The component is checkpoint ready */
|
|
|
|
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
2007-02-09 18:06:45 +03:00
|
|
|
},
|
|
|
|
ras_tm_init
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-08-25 00:50:26 +04:00
|
|
|
static int ras_tm_open(void)
|
|
|
|
{
|
2007-03-22 18:26:16 +03:00
|
|
|
mca_base_component_t *c = &mca_ras_tm_component.super.ras_version;
|
|
|
|
char *pbs_nodefile_env = NULL;
|
|
|
|
char *default_nodefile_dir = NULL;
|
|
|
|
bool free_default_nodefile_dir = false;
|
|
|
|
|
2005-08-25 00:50:26 +04:00
|
|
|
param_priority =
|
2007-02-09 18:06:45 +03:00
|
|
|
mca_base_param_reg_int(c,
|
2005-08-25 00:50:26 +04:00
|
|
|
"priority",
|
|
|
|
"Priority of the tm ras component",
|
|
|
|
false, false, 100, NULL);
|
|
|
|
|
2007-03-22 18:26:16 +03:00
|
|
|
/* try to detect the default directory */
|
|
|
|
pbs_nodefile_env = getenv("PBS_NODEFILE");
|
|
|
|
if ( NULL != pbs_nodefile_env ) {
|
|
|
|
default_nodefile_dir = opal_dirname(pbs_nodefile_env);
|
|
|
|
if ( NULL != default_nodefile_dir ) {
|
|
|
|
free_default_nodefile_dir = true;
|
|
|
|
} else {
|
|
|
|
default_nodefile_dir = "/var/torque/aux";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
default_nodefile_dir = "/var/torque/aux";
|
|
|
|
}
|
|
|
|
|
2007-02-09 18:06:45 +03:00
|
|
|
mca_base_param_reg_string(c, "nodefile_dir",
|
|
|
|
"The directory where the PBS nodefile can be found",
|
2007-03-22 18:26:16 +03:00
|
|
|
false, false, default_nodefile_dir,
|
2007-02-09 18:06:45 +03:00
|
|
|
&mca_ras_tm_component.nodefile_dir);
|
|
|
|
|
2007-03-22 18:26:16 +03:00
|
|
|
if ( free_default_nodefile_dir ) {
|
|
|
|
free(default_nodefile_dir);
|
|
|
|
}
|
|
|
|
|
2005-08-25 00:50:26 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
static orte_ras_base_module_t *ras_tm_init(int* priority)
|
|
|
|
{
|
2006-09-15 01:29:51 +04:00
|
|
|
/* if we are not an HNP, then we must not be selected */
|
|
|
|
if (!orte_process_info.seed) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* Are we running under a TM job? */
|
|
|
|
if (NULL != getenv("PBS_ENVIRONMENT") &&
|
|
|
|
NULL != getenv("PBS_JOBID")) {
|
2005-08-25 00:50:26 +04:00
|
|
|
mca_base_param_lookup_int(param_priority, priority);
|
2005-08-24 22:37:28 +04:00
|
|
|
opal_output(orte_ras_base.ras_output,
|
|
|
|
"ras:tm: available for selection");
|
2005-03-14 23:57:21 +03:00
|
|
|
return &orte_ras_tm_module;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sadly, no */
|
2005-08-24 22:37:28 +04:00
|
|
|
opal_output(orte_ras_base.ras_output,
|
|
|
|
"ras:tm: NOT available for selection");
|
2005-03-14 23:57:21 +03:00
|
|
|
return NULL;
|
|
|
|
}
|