root/opal/mca/rcache/base/rcache_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_rcache_base_registration_constructor
  2. mca_rcache_base_close
  3. mca_rcache_base_open
  4. mca_rcache_base_register_mca_variables

   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) 2012-2018 Los Alamos National Security, LLC.
  14  *                         All rights reserved
  15  * Copyright (c) 2015-2016 Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * Copyright (c) 2017      Cisco Systems, Inc.  All rights reserved
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 
  26 #include "opal_config.h"
  27 #include <stdio.h>
  28 
  29 #include "opal/mca/mca.h"
  30 #include "opal/mca/base/base.h"
  31 #include "opal/mca/base/mca_base_pvar.h"
  32 #include "opal/mca/rcache/rcache.h"
  33 #include "opal/mca/rcache/base/base.h"
  34 #include "opal/memoryhooks/memory.h"
  35 #include "opal/constants.h"
  36 #include "rcache_base_mem_cb.h"
  37 
  38 /* two-level macro for stringifying a number */
  39 #define STRINGIFYX(x) #x
  40 #define STRINGIFY(x) STRINGIFYX(x)
  41 
  42 /*
  43  * The following file was created by configure.  It contains extern
  44  * statements and the definition of an array of pointers to each
  45  * component's public mca_base_component_t struct.
  46  */
  47 
  48 #include "opal/mca/rcache/base/static-components.h"
  49 
  50 int mca_rcache_base_used_mem_hooks = 0;
  51 
  52 /**
  53  * Memory Pool Registration
  54  */
  55 
  56 static void mca_rcache_base_registration_constructor( mca_rcache_base_registration_t * reg )
  57 {
  58     reg->rcache = NULL;
  59     reg->base = NULL;
  60     reg->bound = NULL;
  61     reg->ref_count = 0;
  62     reg->flags = 0;
  63 }
  64 
  65 OBJ_CLASS_INSTANCE(mca_rcache_base_registration_t, opal_free_list_item_t,
  66                    mca_rcache_base_registration_constructor, NULL);
  67 
  68 #define TREE_ITEMS_MIN 2048
  69 #define TREE_ITEMS_MAX 16384
  70 #define TREE_ITEMS_INC 2048
  71 
  72 /*
  73  * Global variables
  74  */
  75 opal_list_t mca_rcache_base_modules = {{0}};
  76 
  77 OBJ_CLASS_INSTANCE(mca_rcache_base_selected_module_t, opal_list_item_t, NULL, NULL);
  78 
  79 static int mca_rcache_base_close(void)
  80 {
  81     opal_list_item_t *item;
  82     mca_rcache_base_selected_module_t *sm;
  83 
  84     /* Finalize all the rcache components and free their list items */
  85 
  86     while (NULL != (item = opal_list_remove_first(&mca_rcache_base_modules))) {
  87         sm = (mca_rcache_base_selected_module_t *) item;
  88 
  89         /* Blatently ignore the return code (what would we do to recover,
  90            anyway?  This component is going away, so errors don't matter
  91            anymore).  Note that it's legal for the module to have NULL for
  92            the finalize function. */
  93 
  94         if (NULL != sm->rcache_module->rcache_finalize) {
  95             sm->rcache_module->rcache_finalize(sm->rcache_module);
  96         }
  97         OBJ_RELEASE(sm);
  98     }
  99 
 100     /* deregister memory free callback */
 101     if (mca_rcache_base_used_mem_hooks) {
 102         opal_mem_hooks_unregister_release(mca_rcache_base_mem_cb);
 103 
 104         /* close the memory manager components.  Registered hooks can
 105            still be fired any time between now and the call to
 106            opal_mem_free_finalize(), and callbacks from the memory manager
 107            hooks to the bowels of the mem_free code can still occur any
 108            time between now and end of application (even post main()!) */
 109         (void) mca_base_framework_close (&opal_memory_base_framework);
 110     }
 111 
 112     /* All done */
 113     /* Close all remaining available components */
 114     return mca_base_framework_components_close(&opal_rcache_base_framework, NULL);
 115 }
 116 
 117 /**
 118  * Function for finding and opening either all MCA components, or the one
 119  * that was specifically requested via a MCA parameter.
 120  */
 121 static int mca_rcache_base_open(mca_base_open_flag_t flags)
 122 {
 123     /* Initialize the list so that in mca_rcache_base_close(), we can
 124        iterate over it (even if it's empty, as in the case of the opal_info-tool) */
 125 
 126     OBJ_CONSTRUCT(&mca_rcache_base_modules, opal_list_t);
 127 
 128      /* Open up all available components */
 129     return mca_base_framework_components_open(&opal_rcache_base_framework, flags);
 130 }
 131 
 132 static int mca_rcache_base_register_mca_variables (mca_base_register_flag_t flags)
 133 {
 134     return OPAL_SUCCESS;
 135 }
 136 
 137 MCA_BASE_FRAMEWORK_DECLARE(opal, rcache, "OPAL Registration Cache",
 138                            mca_rcache_base_register_mca_variables,
 139                            mca_rcache_base_open, mca_rcache_base_close,
 140                            mca_rcache_base_static_components, 0);
 141 

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