2015-04-17 19:00:31 -06:00
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2005-03-14 20:57:21 +00:00
/*
2008-05-06 18:08:45 +00:00
* Copyright ( c ) 2004 - 2008 The Trustees of Indiana University and Indiana
2005-11-05 19:57:48 +00: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 .
2015-06-23 20:59:57 -07:00
* Copyright ( c ) 2004 - 2005 High Performance Computing Center Stuttgart ,
2005-03-14 20:57:21 +00:00
* University of Stuttgart . All rights reserved .
2005-03-24 12:43:37 +00:00
* Copyright ( c ) 2004 - 2005 The Regents of the University of California .
* All rights reserved .
2006-07-04 20:12:35 +00:00
* Copyright ( c ) 2006 Cisco Systems , Inc . All rights reserved .
2015-04-17 19:00:31 -06:00
* Copyright ( c ) 2015 Los Alamos National Security , LLC . All rights
* reserved .
2005-03-14 20:57:21 +00:00
* $ COPYRIGHT $
2015-06-23 20:59:57 -07:00
*
2005-03-14 20:57:21 +00:00
* Additional copyrights may follow
2015-06-23 20:59:57 -07:00
*
2005-03-14 20:57:21 +00:00
* $ HEADER $
*
* These symbols are in a file by themselves to provide nice linker
* semantics . Since linkers generally pull in symbols by object
* files , keeping these symbols as the only symbols in this file
* prevents utility programs such as " ompi_info " from having to import
* entire components just to query their version and parameters .
*/
2006-02-12 01:33:29 +00:00
# include "orte_config.h"
2008-02-28 01:57:57 +00:00
# include "orte/constants.h"
2005-03-14 20:57:21 +00:00
2005-10-04 19:38:51 +00:00
# include "opal/util/argv.h"
2006-09-14 21:29:51 +00:00
2008-02-28 01:57:57 +00:00
# include "orte/mca/plm/plm.h"
# include "orte/mca/plm/base/base.h"
# include "orte/mca/plm/base/plm_private.h"
# include "plm_tm.h"
2005-03-14 20:57:21 +00:00
/*
2008-02-28 01:57:57 +00:00
* Public string showing the plm ompi_tm component version number
2005-03-14 20:57:21 +00:00
*/
2008-02-28 01:57:57 +00:00
const char * mca_plm_tm_component_version_string =
" Open MPI tm plm MCA component version " ORTE_VERSION ;
2005-03-14 20:57:21 +00:00
/*
* Local function
*/
2013-03-27 21:09:41 +00:00
static int plm_tm_register ( void ) ;
2008-02-28 01:57:57 +00:00
static int plm_tm_open ( void ) ;
static int plm_tm_close ( void ) ;
2008-05-06 18:08:45 +00:00
static int orte_plm_tm_component_query ( mca_base_module_t * * module , int * priority ) ;
2005-03-14 20:57:21 +00:00
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
2008-02-28 01:57:57 +00:00
orte_plm_tm_component_t mca_plm_tm_component = {
2005-03-14 20:57:21 +00:00
{
2005-08-19 16:49:59 +00:00
/* First, the mca_component_t struct containing meta information
about the component itself */
2015-04-17 19:00:31 -06:00
. base_version = {
2008-07-28 22:40:57 +00:00
ORTE_PLM_BASE_VERSION_2_0_0 ,
2005-08-19 16:49:59 +00:00
/* Component name and version */
2015-04-17 19:00:31 -06:00
. mca_component_name = " tm " ,
MCA_BASE_MAKE_VERSION ( component , ORTE_MAJOR_VERSION , ORTE_MINOR_VERSION ,
ORTE_RELEASE_VERSION ) ,
2005-08-19 16:49:59 +00:00
/* Component open and close functions */
2015-04-17 19:00:31 -06:00
. mca_open_component = plm_tm_open ,
. mca_close_component = plm_tm_close ,
. mca_query_component = orte_plm_tm_component_query ,
. mca_register_component_params = plm_tm_register ,
2005-08-19 16:49:59 +00:00
} ,
2015-04-17 19:00:31 -06:00
. base_data = {
2007-03-16 23:11:45 +00:00
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
2015-04-17 19:00:31 -06:00
} ,
2005-08-19 16:49:59 +00:00
}
2005-03-14 20:57:21 +00:00
} ;
2013-03-27 21:09:41 +00:00
static int plm_tm_register ( void )
2005-03-14 20:57:21 +00:00
{
2008-05-06 18:08:45 +00:00
mca_base_component_t * comp = & mca_plm_tm_component . super . base_version ;
2005-08-19 16:49:59 +00:00
2013-03-27 21:09:41 +00:00
mca_plm_tm_component . want_path_check = true ;
( void ) mca_base_component_var_register ( comp , " want_path_check " ,
" Whether the launching process should check for the plm_tm_orted executable in the PATH before launching (the TM API does not give an indication of failure; this is a somewhat-lame workaround; non-zero values enable this check) " ,
MCA_BASE_VAR_TYPE_BOOL , NULL , 0 , 0 ,
OPAL_INFO_LVL_9 ,
MCA_BASE_VAR_SCOPE_READONLY ,
& mca_plm_tm_component . want_path_check ) ;
return ORTE_SUCCESS ;
}
static int plm_tm_open ( void )
{
2008-02-28 01:57:57 +00:00
mca_plm_tm_component . checked_paths = NULL ;
2015-06-23 20:59:57 -07:00
2005-10-04 19:38:51 +00:00
return ORTE_SUCCESS ;
}
2008-02-28 01:57:57 +00:00
static int plm_tm_close ( void )
2005-10-04 19:38:51 +00:00
{
2008-02-28 01:57:57 +00:00
if ( NULL ! = mca_plm_tm_component . checked_paths ) {
opal_argv_free ( mca_plm_tm_component . checked_paths ) ;
2005-10-04 19:38:51 +00:00
}
2005-03-14 20:57:21 +00:00
return ORTE_SUCCESS ;
}
2008-05-06 18:08:45 +00:00
static int orte_plm_tm_component_query ( mca_base_module_t * * module , int * priority )
2005-03-14 20:57:21 +00:00
{
/* Are we running under a TM job? */
if ( NULL ! = getenv ( " PBS_ENVIRONMENT " ) & &
NULL ! = getenv ( " PBS_JOBID " ) ) {
2006-09-14 21:29:51 +00:00
2008-02-28 01:57:57 +00:00
* priority = 75 ;
2008-05-06 18:08:45 +00:00
* module = ( mca_base_module_t * ) & orte_plm_tm_module ;
return ORTE_SUCCESS ;
2005-03-14 20:57:21 +00:00
}
/* Sadly, no */
2008-05-06 18:08:45 +00:00
* module = NULL ;
2008-05-06 21:26:17 +00:00
return ORTE_ERROR ;
2005-03-14 20:57:21 +00:00
}