root/orte/mca/rtc/hwloc/rtc_hwloc_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. rtc_hwloc_register
  2. rtc_hwloc_query

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
   4  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2017      Research Organization for Information Science
   7  *                         and Technology (RIST). All rights reserved.
   8  * Copyright (c) 2017      Inria.  All rights reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #include "orte_config.h"
  17 #include "orte/constants.h"
  18 
  19 #include "opal/mca/base/base.h"
  20 
  21 #include "rtc_hwloc.h"
  22 
  23 /*
  24  * Local functions
  25  */
  26 
  27 static int rtc_hwloc_query(mca_base_module_t **module, int *priority);
  28 static int rtc_hwloc_register(void);
  29 
  30 static int my_priority;
  31 
  32 orte_rtc_hwloc_component_t mca_rtc_hwloc_component = {
  33     .super = {
  34         .base_version = {
  35             ORTE_RTC_BASE_VERSION_1_0_0,
  36 
  37             .mca_component_name = "hwloc",
  38             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  39                                   ORTE_RELEASE_VERSION),
  40             .mca_query_component = rtc_hwloc_query,
  41             .mca_register_component_params = rtc_hwloc_register,
  42         },
  43         .base_data = {
  44             /* The component is checkpoint ready */
  45             MCA_BASE_METADATA_PARAM_CHECKPOINT
  46         },
  47     },
  48     .kind = VM_HOLE_BIGGEST
  49 };
  50 
  51 static char *biggest = "biggest";
  52 static char *vmhole;
  53 
  54 static int rtc_hwloc_register(void)
  55 {
  56     mca_base_component_t *c = &mca_rtc_hwloc_component.super.base_version;
  57 
  58     /* set as the default */
  59     my_priority = 70;
  60     (void) mca_base_component_var_register (c, "priority", "Priority of the HWLOC rtc component",
  61                                             MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  62                                             OPAL_INFO_LVL_9,
  63                                             MCA_BASE_VAR_SCOPE_READONLY,
  64                                             &my_priority);
  65 
  66     mca_rtc_hwloc_component.kind = VM_HOLE_BIGGEST;
  67     vmhole = biggest;
  68     (void) mca_base_component_var_register(c, "vmhole",
  69                                            "Kind of VM hole to identify - none, begin, biggest, libs, heap, stack (default=biggest)",
  70                                             MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  71                                            OPAL_INFO_LVL_9,
  72                                            MCA_BASE_VAR_SCOPE_READONLY,
  73                                            &vmhole);
  74     if (0 == strcasecmp(vmhole, "none")) {
  75         mca_rtc_hwloc_component.kind = VM_HOLE_NONE;
  76     } else if (0 == strcasecmp(vmhole, "begin")) {
  77         mca_rtc_hwloc_component.kind = VM_HOLE_BEGIN;
  78     } else if (0 == strcasecmp(vmhole, "biggest")) {
  79         mca_rtc_hwloc_component.kind = VM_HOLE_BIGGEST;
  80     } else if (0 == strcasecmp(vmhole, "libs")) {
  81         mca_rtc_hwloc_component.kind = VM_HOLE_IN_LIBS;
  82     } else if (0 == strcasecmp(vmhole, "heap")) {
  83         mca_rtc_hwloc_component.kind = VM_HOLE_AFTER_HEAP;
  84     } else if (0 == strcasecmp(vmhole, "stack")) {
  85         mca_rtc_hwloc_component.kind = VM_HOLE_BEFORE_STACK;
  86     } else {
  87         opal_output(0, "INVALID VM HOLE TYPE");
  88         return ORTE_ERROR;
  89     }
  90 
  91     return ORTE_SUCCESS;
  92 }
  93 
  94 
  95 static int rtc_hwloc_query(mca_base_module_t **module, int *priority)
  96 {
  97     /* Only run on the HNP */
  98 
  99     *priority = my_priority;
 100     *module = (mca_base_module_t *)&orte_rtc_hwloc_module;
 101 
 102     return ORTE_SUCCESS;
 103 }

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