root/orte/mca/ras/gridengine/ras_gridengine_component.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. orte_ras_gridengine_register
  2. orte_ras_gridengine_open
  3. orte_ras_gridengine_component_query
  4. orte_ras_gridengine_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006      Sun Microsystems, Inc.  All rights reserved.
  14  *                         Use is subject to license terms.
  15  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  16  *                         reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 /**
  24  * @file
  25  * Resource allocation for Grid Engine
  26  */
  27 
  28 #include "orte_config.h"
  29 #include "orte/constants.h"
  30 
  31 #include "opal/mca/base/base.h"
  32 #include "opal/util/output.h"
  33 
  34 #include "orte/runtime/orte_globals.h"
  35 #include "orte/util/name_fns.h"
  36 
  37 #include "orte/mca/ras/base/ras_private.h"
  38 #include "ras_gridengine.h"
  39 
  40 /*
  41  * Local functions
  42  */
  43 
  44 static int orte_ras_gridengine_register(void);
  45 static int orte_ras_gridengine_open(void);
  46 static int orte_ras_gridengine_close(void);
  47 static int orte_ras_gridengine_component_query(mca_base_module_t **module, int *priority);
  48 
  49 static int orte_ras_gridengine_verbose;
  50 
  51 orte_ras_gridengine_component_t mca_ras_gridengine_component = {
  52     {
  53         /* First, the mca_base_component_t struct containing meta
  54            information about the component itself */
  55 
  56         .base_version = {
  57             ORTE_RAS_BASE_VERSION_2_0_0,
  58             .mca_component_name = "gridengine",
  59             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  60                                   ORTE_RELEASE_VERSION),
  61             .mca_open_component = orte_ras_gridengine_open,
  62             .mca_close_component = orte_ras_gridengine_close,
  63             .mca_query_component = orte_ras_gridengine_component_query,
  64             .mca_register_component_params = orte_ras_gridengine_register,
  65         },
  66         .base_data = {
  67             /* The component is checkpoint ready */
  68             MCA_BASE_METADATA_PARAM_CHECKPOINT
  69         },
  70     }
  71 };
  72 
  73 static int orte_ras_gridengine_register(void)
  74 {
  75     mca_base_component_t *c = &mca_ras_gridengine_component.super.base_version;
  76 
  77     mca_ras_gridengine_component.priority = 100;
  78     (void) mca_base_component_var_register (c, "priority", "Priority of the gridengine ras component",
  79                                             MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9,
  80                                             MCA_BASE_VAR_SCOPE_READONLY, &mca_ras_gridengine_component.priority);
  81 
  82     orte_ras_gridengine_verbose = 0;
  83     (void) mca_base_component_var_register (c, "verbose",
  84                                             "Enable verbose output for the gridengine ras component",
  85                                             MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9,
  86                                             MCA_BASE_VAR_SCOPE_LOCAL, &orte_ras_gridengine_verbose);
  87 
  88     mca_ras_gridengine_component.show_jobid = false;
  89     (void) mca_base_component_var_register (c, "show_jobid", "Show the JOB_ID of the Grid Engine job",
  90                                             MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
  91                                             MCA_BASE_VAR_SCOPE_READONLY, &mca_ras_gridengine_component.show_jobid);
  92 
  93     return ORTE_SUCCESS;
  94 }
  95 
  96 /**
  97   * component open/close/init function
  98   */
  99 static int orte_ras_gridengine_open(void)
 100 {
 101     if (orte_ras_gridengine_verbose != 0) {
 102         mca_ras_gridengine_component.verbose = opal_output_open(NULL);
 103     } else {
 104         mca_ras_gridengine_component.verbose = -1;
 105     }
 106 
 107     return ORTE_SUCCESS;
 108 }
 109 
 110 static int orte_ras_gridengine_component_query(mca_base_module_t **module, int *priority)
 111 {
 112     *priority = mca_ras_gridengine_component.priority;
 113 
 114     if (NULL != getenv("SGE_ROOT") && NULL != getenv("ARC") &&
 115         NULL != getenv("PE_HOSTFILE") && NULL != getenv("JOB_ID")) {
 116         OPAL_OUTPUT_VERBOSE((2, orte_ras_base_framework.framework_output,
 117                              "%s ras:gridengine: available for selection",
 118                              ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
 119         *module = (mca_base_module_t *) &orte_ras_gridengine_module;
 120         return ORTE_SUCCESS;
 121     }
 122     OPAL_OUTPUT_VERBOSE((2, orte_ras_base_framework.framework_output,
 123                          "%s ras:gridengine: NOT available for selection",
 124                          ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
 125     *module = NULL;
 126     return ORTE_ERROR;
 127 }
 128 
 129 /**
 130  *  Close all subsystems.
 131  */
 132 static int orte_ras_gridengine_close(void)
 133 {
 134     return ORTE_SUCCESS;
 135 }

/* [<][>][^][v][top][bottom][index][help] */