root/oshmem/mca/sshmem/mmap/sshmem_mmap_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. mmap_runtime_query
  2. mmap_register
  3. mmap_open
  4. mmap_query
  5. mmap_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2014      Mellanox Technologies, Inc.
   4  *                         All rights reserved.
   5  * Copyright (c) 2014 Cisco Systems, Inc.  All rights reserved.
   6  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   7  *                         reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 
  15 #include "oshmem_config.h"
  16 
  17 #include "opal/constants.h"
  18 
  19 #include "oshmem/mca/sshmem/sshmem.h"
  20 #include "oshmem/mca/sshmem/base/base.h"
  21 
  22 #include "sshmem_mmap.h"
  23 
  24 /**
  25  * public string showing the shmem ompi_mmap component version number
  26  */
  27 const char *mca_sshmem_mmap_component_version_string =
  28     "OSHMEM mmap sshmem MCA component version " OSHMEM_VERSION;
  29 
  30 int mca_sshmem_mmap_relocate_backing_file = 0;
  31 char *mca_sshmem_mmap_backing_file_base_dir = NULL;
  32 bool mca_sshmem_mmap_nfs_warning = true;
  33 
  34 /**
  35  * local functions
  36  */
  37 static int mmap_register(void);
  38 static int mmap_open(void);
  39 static int mmap_close(void);
  40 static int mmap_query(mca_base_module_t **module, int *priority);
  41 static int mmap_runtime_query(mca_base_module_t **module,
  42                              int *priority,
  43                              const char *hint);
  44 
  45 /**
  46  * instantiate the public struct with all of our public information
  47  * and pointers to our public functions in it
  48  */
  49 mca_sshmem_mmap_component_t mca_sshmem_mmap_component = {
  50     /* ////////////////////////////////////////////////////////////////////// */
  51     /* super */
  52     /* ////////////////////////////////////////////////////////////////////// */
  53     {
  54         /**
  55          * common MCA component data
  56          */
  57         .base_version = {
  58             MCA_SSHMEM_BASE_VERSION_2_0_0,
  59 
  60             /* component name and version */
  61             .mca_component_name = "mmap",
  62             MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
  63                                   OSHMEM_RELEASE_VERSION),
  64 
  65             .mca_open_component = mmap_open,
  66             .mca_close_component = mmap_close,
  67             .mca_query_component = mmap_query,
  68             .mca_register_component_params = mmap_register,
  69         },
  70         /* MCA v2.0.0 component meta data */
  71         .base_data = {
  72             /* the component is checkpoint ready */
  73             MCA_BASE_METADATA_PARAM_CHECKPOINT
  74         },
  75         .runtime_query = mmap_runtime_query,
  76     },
  77 };
  78 
  79 /* ////////////////////////////////////////////////////////////////////////// */
  80 static int
  81 mmap_runtime_query(mca_base_module_t **module,
  82                    int *priority,
  83                    const char *hint)
  84 {
  85     /* no run-time query needed for mmap, so this is easy */
  86     *priority = mca_sshmem_mmap_component.priority;
  87     *module = (mca_base_module_t *)&mca_sshmem_mmap_module.super;
  88     return OPAL_SUCCESS;
  89 }
  90 
  91 /* ////////////////////////////////////////////////////////////////////////// */
  92 static int
  93 mmap_register(void)
  94 {
  95     /* ////////////////////////////////////////////////////////////////////// */
  96     /* (default) priority - set high to make mmap the default */
  97     mca_sshmem_mmap_component.priority = 40;
  98     mca_base_component_var_register (&mca_sshmem_mmap_component.super.base_version,
  99                                      "priority", "Priority for sshmem mmap "
 100                                      "component (default: 40)", MCA_BASE_VAR_TYPE_INT,
 101                                      NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 102                                      OPAL_INFO_LVL_3,
 103                                      MCA_BASE_VAR_SCOPE_ALL_EQ,
 104                                      &mca_sshmem_mmap_component.priority);
 105 
 106     mca_sshmem_mmap_component.is_anonymous = 1;
 107     mca_base_component_var_register (&mca_sshmem_mmap_component.super.base_version,
 108                                     "anonymous", "Select whether anonymous sshmem is used for mmap "
 109                                     "component (default: 1)", MCA_BASE_VAR_TYPE_INT,
 110                                     NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 111                                     OPAL_INFO_LVL_4,
 112                                     MCA_BASE_VAR_SCOPE_ALL_EQ,
 113                                     &mca_sshmem_mmap_component.is_anonymous);
 114 
 115    mca_sshmem_mmap_component.is_start_addr_fixed = 1;
 116    mca_base_component_var_register (&mca_sshmem_mmap_component.super.base_version,
 117                                     "fixed", "Select whether fixed start address is used for shmem "
 118                                     "(default: 1)", MCA_BASE_VAR_TYPE_INT,
 119                                     NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 120                                     OPAL_INFO_LVL_4,
 121                                     MCA_BASE_VAR_SCOPE_ALL_EQ,
 122                                     &mca_sshmem_mmap_component.is_start_addr_fixed);
 123     return OSHMEM_SUCCESS;
 124 }
 125 
 126 /* ////////////////////////////////////////////////////////////////////////// */
 127 static int
 128 mmap_open(void)
 129 {
 130     return OSHMEM_SUCCESS;
 131 }
 132 
 133 /* ////////////////////////////////////////////////////////////////////////// */
 134 static int
 135 mmap_query(mca_base_module_t **module, int *priority)
 136 {
 137     *priority = mca_sshmem_mmap_component.priority;
 138     *module = (mca_base_module_t *)&mca_sshmem_mmap_module.super;
 139     return OSHMEM_SUCCESS;
 140 }
 141 
 142 /* ////////////////////////////////////////////////////////////////////////// */
 143 static int
 144 mmap_close(void)
 145 {
 146     return OSHMEM_SUCCESS;
 147 }
 148 

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