This source file includes following definitions.
- rgpusm_open
- rgpusm_register
- rgpusm_close
- rgpusm_init
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 #define OPAL_DISABLE_ENABLE_MEM_DEBUG 1
  27 #include "opal_config.h"
  28 #include "opal/mca/base/base.h"
  29 #include "rcache_rgpusm.h"
  30 #ifdef HAVE_UNISTD_H
  31 #include <unistd.h>
  32 #endif
  33 #ifdef HAVE_MALLOC_H
  34 #include <malloc.h>
  35 #endif
  36 
  37 
  38 
  39 
  40 static int rgpusm_open(void);
  41 static int rgpusm_close(void);
  42 static int rgpusm_register(void);
  43 static mca_rcache_base_module_t* rgpusm_init(struct mca_rcache_base_resources_t* resources);
  44 
  45 static int opal_rcache_rgpusm_verbose = 0;
  46 
  47 mca_rcache_rgpusm_component_t mca_rcache_rgpusm_component = {
  48     {
  49         
  50 
  51 
  52         .rcache_version = {
  53             MCA_RCACHE_BASE_VERSION_3_0_0,
  54 
  55             .mca_component_name = "rgpusm",
  56             MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  57                                   OPAL_RELEASE_VERSION),
  58             .mca_open_component = rgpusm_open,
  59             .mca_close_component = rgpusm_close,
  60             .mca_register_component_params = rgpusm_register,
  61         },
  62         .rcache_data = {
  63             
  64             MCA_BASE_METADATA_PARAM_CHECKPOINT
  65         },
  66 
  67         .rcache_init = rgpusm_init
  68     }
  69 };
  70 
  71 
  72 
  73 
  74 static int rgpusm_open(void)
  75 {
  76     mca_rcache_rgpusm_component.output = opal_output_open(NULL);
  77     opal_output_set_verbosity(mca_rcache_rgpusm_component.output, opal_rcache_rgpusm_verbose);
  78 
  79     return OPAL_SUCCESS;
  80 }
  81 
  82 
  83 static int rgpusm_register(void)
  84 {
  85     mca_rcache_rgpusm_component.rcache_name = "vma";
  86     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
  87                                            "rcache_name",
  88                                            "The name of the registration cache the rcache should use",
  89                                            MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
  90                                            OPAL_INFO_LVL_9,
  91                                            MCA_BASE_VAR_SCOPE_READONLY,
  92                                            &mca_rcache_rgpusm_component.rcache_name);
  93     mca_rcache_rgpusm_component.rcache_size_limit = 0;
  94     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
  95                                            "rcache_size_limit",
  96                                            "the maximum size of registration cache in bytes. "
  97                                            "0 is unlimited (default 0)",
  98                                            MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, 0, 0,
  99                                            OPAL_INFO_LVL_9,
 100                                            MCA_BASE_VAR_SCOPE_READONLY,
 101                                            &mca_rcache_rgpusm_component.rcache_size_limit);
 102 
 103     mca_rcache_rgpusm_component.leave_pinned = 1;
 104     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
 105                                            "leave_pinned",
 106                                            "Whether to keep memory handles around or release them when done. ",
 107                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 108                                            OPAL_INFO_LVL_9,
 109                                            MCA_BASE_VAR_SCOPE_READONLY,
 110                                            &mca_rcache_rgpusm_component.leave_pinned);
 111 
 112     mca_rcache_rgpusm_component.print_stats = false;
 113     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
 114                                            "print_stats",
 115                                            "print pool usage statistics at the end of the run",
 116                                            MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 117                                            OPAL_INFO_LVL_9,
 118                                            MCA_BASE_VAR_SCOPE_READONLY,
 119                                            &mca_rcache_rgpusm_component.print_stats);
 120 
 121     
 122     opal_rcache_rgpusm_verbose = 0;
 123     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
 124                                            "verbose", "Set level of rcache rgpusm verbosity",
 125                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 126                                            OPAL_INFO_LVL_9,
 127                                            MCA_BASE_VAR_SCOPE_READONLY,
 128                                            &opal_rcache_rgpusm_verbose);
 129 
 130     
 131     mca_rcache_rgpusm_component.empty_cache = false;
 132     (void) mca_base_component_var_register(&mca_rcache_rgpusm_component.super.rcache_version,
 133                                            "empty_cache", "When set, empty entire registration cache when it is full",
 134                                            MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 135                                            OPAL_INFO_LVL_5,
 136                                            MCA_BASE_VAR_SCOPE_READONLY,
 137                                            &mca_rcache_rgpusm_component.empty_cache);
 138 
 139     return OPAL_SUCCESS;
 140 }
 141 
 142 
 143 static int rgpusm_close(void)
 144 {
 145     return OPAL_SUCCESS;
 146 }
 147 
 148 
 149 static mca_rcache_base_module_t* rgpusm_init(
 150      struct mca_rcache_base_resources_t *resources)
 151 {
 152     mca_rcache_rgpusm_module_t* rcache_module;
 153 
 154     
 155     (void) resources;
 156 
 157     rcache_module = (mca_rcache_rgpusm_module_t *) calloc (1, sizeof (*rcache_module));
 158     if (NULL == rcache_module) {
 159         return NULL;
 160     }
 161 
 162     mca_rcache_rgpusm_module_init(rcache_module);
 163 
 164     return &rcache_module->super;
 165 }