root/oshmem/mca/sshmem/ucx/sshmem_ucx_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. ucx_runtime_query
  2. ucx_register
  3. ucx_open
  4. ucx_query
  5. ucx_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2017      Mellanox Technologies, Inc.
   4  *                         All rights reserved.
   5  * $COPYRIGHT$
   6  *
   7  * Additional copyrights may follow
   8  *
   9  * $HEADER$
  10  */
  11 
  12 #include "oshmem_config.h"
  13 
  14 #include "opal/constants.h"
  15 
  16 #include "oshmem/mca/sshmem/sshmem.h"
  17 #include "oshmem/mca/sshmem/base/base.h"
  18 #include "oshmem/mca/spml/base/base.h"
  19 
  20 #include "sshmem_ucx.h"
  21 
  22 /**
  23  * public string showing the shmem ompi_ucx component version number
  24  */
  25 const char *mca_sshmem_ucx_component_version_string =
  26     "OSHMEM ucx sshmem MCA component version " OSHMEM_VERSION;
  27 
  28 
  29 /**
  30  * local functions
  31  */
  32 static int ucx_register(void);
  33 static int ucx_open(void);
  34 static int ucx_close(void);
  35 static int ucx_query(mca_base_module_t **module, int *priority);
  36 static int ucx_runtime_query(mca_base_module_t **module,
  37                              int *priority,
  38                              const char *hint);
  39 
  40 /**
  41  * instantiate the public struct with all of our public information
  42  * and pointers to our public functions in it
  43  */
  44 mca_sshmem_ucx_component_t mca_sshmem_ucx_component = {
  45     /* ////////////////////////////////////////////////////////////////////// */
  46     /* super */
  47     /* ////////////////////////////////////////////////////////////////////// */
  48     {
  49         /**
  50          * common MCA component data
  51          */
  52         .base_version = {
  53             MCA_SSHMEM_BASE_VERSION_2_0_0,
  54 
  55             /* component name and version */
  56             .mca_component_name = "ucx",
  57             MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
  58                                   OSHMEM_RELEASE_VERSION),
  59 
  60             .mca_open_component = ucx_open,
  61             .mca_close_component = ucx_close,
  62             .mca_query_component = ucx_query,
  63             .mca_register_component_params = ucx_register,
  64         },
  65         /* MCA v2.0.0 component meta data */
  66         .base_data = {
  67             /* the component is checkpoint ready */
  68             MCA_BASE_METADATA_PARAM_CHECKPOINT
  69         },
  70         .runtime_query = ucx_runtime_query,
  71     },
  72 };
  73 
  74 static int
  75 ucx_runtime_query(mca_base_module_t **module,
  76                    int *priority,
  77                    const char *hint)
  78 {
  79     /* check that spml ucx was selected. Otherwise disqualify */
  80     if (strcmp(mca_spml_base_selected_component.spmlm_version.mca_component_name, "ucx")) {
  81         *module = NULL;
  82         return OSHMEM_ERR_NOT_AVAILABLE;
  83     }
  84 
  85     *priority = mca_sshmem_ucx_component.priority;
  86     *module = (mca_base_module_t *)&mca_sshmem_ucx_module.super;
  87     return OPAL_SUCCESS;
  88 }
  89 
  90 static int
  91 ucx_register(void)
  92 {
  93     /* (default) priority - set high to make ucx the default */
  94     mca_sshmem_ucx_component.priority = 100;
  95     mca_base_component_var_register (&mca_sshmem_ucx_component.super.base_version,
  96                                      "priority", "Priority for sshmem ucx "
  97                                      "component (default: 100)", MCA_BASE_VAR_TYPE_INT,
  98                                      NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  99                                      OPAL_INFO_LVL_3,
 100                                      MCA_BASE_VAR_SCOPE_ALL_EQ,
 101                                      &mca_sshmem_ucx_component.priority);
 102 
 103     return OSHMEM_SUCCESS;
 104 }
 105 
 106 static int
 107 ucx_open(void)
 108 {
 109     return OSHMEM_SUCCESS;
 110 }
 111 
 112 static int
 113 ucx_query(mca_base_module_t **module, int *priority)
 114 {
 115     *priority = mca_sshmem_ucx_component.priority;
 116     *module = (mca_base_module_t *)&mca_sshmem_ucx_module.super;
 117     return OSHMEM_SUCCESS;
 118 }
 119 
 120 static int
 121 ucx_close(void)
 122 {
 123     return OSHMEM_SUCCESS;
 124 }
 125 

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