root/opal/mca/rcache/rgpusm/rcache_rgpusm_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. rgpusm_open
  2. rgpusm_register
  3. rgpusm_close
  4. rgpusm_init

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 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      Voltaire. All rights reserved.
  14  * Copyright (c) 2007-2009 Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2012-2015 NVIDIA Corporation.  All rights reserved.
  16  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
  17  *                         reserved.
  18  *
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  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  * Local functions
  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         /* First, the mca_base_component_t struct containing meta
  50            information about the component itself */
  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             /* The component is checkpoint ready */
  64             MCA_BASE_METADATA_PARAM_CHECKPOINT
  65         },
  66 
  67         .rcache_init = rgpusm_init
  68     }
  69 };
  70 
  71 /**
  72   * component open/close/init function
  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     /* Set different levels of verbosity in the rgpusm related code. */
 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     /* Force emptying of entire registration cache when it gets full */
 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     /* ignore passed in resource structure */
 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 }

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