root/ompi/mca/coll/demo/coll_demo_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. demo_register
  2. mca_coll_demo_module_construct
  3. mca_coll_demo_module_destruct

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 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) 2008      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  *
  22  * These symbols are in a file by themselves to provide nice linker
  23  * semantics.  Since linkers generally pull in symbols by object
  24  * files, keeping these symbols as the only symbols in this file
  25  * prevents utility programs such as "ompi_info" from having to import
  26  * entire components just to query their version and parameters.
  27  */
  28 
  29 #include "ompi_config.h"
  30 
  31 #include "mpi.h"
  32 #include "ompi/mca/coll/coll.h"
  33 #include "coll_demo.h"
  34 
  35 /*
  36  * Public string showing the coll ompi_demo component version number
  37  */
  38 const char *mca_coll_demo_component_version_string =
  39   "OMPI/MPI demo collective MCA component version " OMPI_VERSION;
  40 
  41 /*
  42  * Global variable
  43  */
  44 int mca_coll_demo_priority = -1;
  45 int mca_coll_demo_verbose = 0;
  46 
  47 /*
  48  * Local function
  49  */
  50 static int demo_register(void);
  51 
  52 
  53 /*
  54  * Instantiate the public struct with all of our public information
  55  * and pointers to our public functions in it
  56  */
  57 
  58 const mca_coll_base_component_2_0_0_t mca_coll_demo_component = {
  59 
  60     /* First, the mca_component_t struct containing meta information
  61        about the component itself */
  62 
  63     .collm_version = {
  64         MCA_COLL_BASE_VERSION_2_0_0,
  65 
  66         /* Component name and version */
  67         .mca_component_name = "demo",
  68         MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  69                               OMPI_RELEASE_VERSION),
  70 
  71         /* Component open and close functions */
  72         .mca_register_component_params = demo_register,
  73     },
  74     .collm_data = {
  75         /* The component is checkpoint ready */
  76         MCA_BASE_METADATA_PARAM_CHECKPOINT
  77     },
  78 
  79     /* Initialization / querying functions */
  80 
  81     .collm_init_query = mca_coll_demo_init_query,
  82     .collm_comm_query = mca_coll_demo_comm_query,
  83 };
  84 
  85 
  86 static int demo_register(void)
  87 {
  88     mca_coll_demo_priority = 20;
  89     (void) mca_base_component_var_register(&mca_coll_demo_component.collm_version, "priority",
  90                                            NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  91                                            OPAL_INFO_LVL_9,
  92                                            MCA_BASE_VAR_SCOPE_READONLY,
  93                                            &mca_coll_demo_priority);
  94     mca_coll_demo_verbose = 0;
  95     (void) mca_base_component_var_register(&mca_coll_demo_component.collm_version, "verbose",
  96                                            NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  97                                            OPAL_INFO_LVL_9,
  98                                            MCA_BASE_VAR_SCOPE_READONLY,
  99                                            &mca_coll_demo_verbose);
 100 
 101     return OMPI_SUCCESS;
 102 }
 103 
 104 
 105 static void
 106 mca_coll_demo_module_construct(mca_coll_demo_module_t *module)
 107 {
 108     memset(&module->underlying, 0, sizeof(mca_coll_base_comm_coll_t));
 109 }
 110 
 111 #define RELEASE(module, func)                                           \
 112     do {                                                                \
 113         if (NULL != module->underlying.coll_ ## func ## _module) { \
 114             OBJ_RELEASE(module->underlying.coll_ ## func ## _module); \
 115         }                                                               \
 116     } while (0)
 117 
 118 static void
 119 mca_coll_demo_module_destruct(mca_coll_demo_module_t *module)
 120 {
 121     RELEASE(module, allgather);
 122     RELEASE(module, allgatherv);
 123     RELEASE(module, allreduce);
 124     RELEASE(module, alltoall);
 125     RELEASE(module, alltoallv);
 126     RELEASE(module, alltoallw);
 127     RELEASE(module, barrier);
 128     RELEASE(module, bcast);
 129     RELEASE(module, exscan);
 130     RELEASE(module, gather);
 131     RELEASE(module, gatherv);
 132     RELEASE(module, reduce);
 133     RELEASE(module, reduce_scatter);
 134     RELEASE(module, scan);
 135     RELEASE(module, scatter);
 136     RELEASE(module, scatterv);
 137 }
 138 
 139 
 140 OBJ_CLASS_INSTANCE(mca_coll_demo_module_t,
 141                    mca_coll_base_module_t,
 142                    mca_coll_demo_module_construct,
 143                    mca_coll_demo_module_destruct);

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