root/orte/mca/grpcomm/base/grpcomm_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. orte_grpcomm_base_close
  2. orte_grpcomm_base_open
  3. scon
  4. sdes
  5. ccon
  6. cdes

   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) 2011-2016 Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
  16  * Copyright (c) 2015-2017 Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 
  26 #include "orte_config.h"
  27 #include "orte/constants.h"
  28 
  29 #include "orte/mca/mca.h"
  30 #include "opal/util/output.h"
  31 #include "opal/mca/base/base.h"
  32 
  33 #include "orte/mca/rml/rml.h"
  34 #include "orte/mca/state/state.h"
  35 
  36 #include "orte/mca/grpcomm/base/base.h"
  37 
  38 
  39 /*
  40  * The following file was created by configure.  It contains extern
  41  * statements and the definition of an array of pointers to each
  42  * component's public mca_base_component_t struct.
  43  */
  44 
  45 #include "orte/mca/grpcomm/base/static-components.h"
  46 
  47 /*
  48  * Global variables
  49  */
  50 orte_grpcomm_base_t orte_grpcomm_base = {{{0}}};
  51 
  52 orte_grpcomm_API_module_t orte_grpcomm = {
  53     orte_grpcomm_API_xcast,
  54     orte_grpcomm_API_allgather
  55 };
  56 
  57 static bool recv_issued = false;
  58 
  59 static int orte_grpcomm_base_close(void)
  60 {
  61     orte_grpcomm_base_active_t *active;
  62     void *key;
  63     size_t size;
  64     uint32_t *seq_number;
  65 
  66     if (recv_issued) {
  67         orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_XCAST);
  68         recv_issued = false;
  69     }
  70 
  71     /* Close the active modules */
  72     OPAL_LIST_FOREACH(active, &orte_grpcomm_base.actives, orte_grpcomm_base_active_t) {
  73         if (NULL != active->module->finalize) {
  74             active->module->finalize();
  75         }
  76     }
  77     OPAL_LIST_DESTRUCT(&orte_grpcomm_base.actives);
  78     OPAL_LIST_DESTRUCT(&orte_grpcomm_base.ongoing);
  79     for (void *_nptr=NULL;                                   \
  80          OPAL_SUCCESS == opal_hash_table_get_next_key_ptr(&orte_grpcomm_base.sig_table, &key, &size, (void **)&seq_number, _nptr, &_nptr);) {
  81         free(seq_number);
  82     }
  83     OBJ_DESTRUCT(&orte_grpcomm_base.sig_table);
  84 
  85     return mca_base_framework_components_close(&orte_grpcomm_base_framework, NULL);
  86 }
  87 
  88 /**
  89  * Function for finding and opening either all MCA components, or the one
  90  * that was specifically requested via a MCA parameter.
  91  */
  92 static int orte_grpcomm_base_open(mca_base_open_flag_t flags)
  93 {
  94     OBJ_CONSTRUCT(&orte_grpcomm_base.actives, opal_list_t);
  95     OBJ_CONSTRUCT(&orte_grpcomm_base.ongoing, opal_list_t);
  96     OBJ_CONSTRUCT(&orte_grpcomm_base.sig_table, opal_hash_table_t);
  97     opal_hash_table_init(&orte_grpcomm_base.sig_table, 128);
  98 
  99     return mca_base_framework_components_open(&orte_grpcomm_base_framework, flags);
 100 }
 101 
 102 MCA_BASE_FRAMEWORK_DECLARE(orte, grpcomm, "GRPCOMM", NULL,
 103                            orte_grpcomm_base_open,
 104                            orte_grpcomm_base_close,
 105                            mca_grpcomm_base_static_components, 0);
 106 
 107 OBJ_CLASS_INSTANCE(orte_grpcomm_base_active_t,
 108                    opal_list_item_t,
 109                    NULL, NULL);
 110 
 111 static void scon(orte_grpcomm_signature_t *p)
 112 {
 113     p->signature = NULL;
 114     p->sz = 0;
 115 }
 116 static void sdes(orte_grpcomm_signature_t *p)
 117 {
 118     if (NULL != p->signature) {
 119         free(p->signature);
 120     }
 121 }
 122 OBJ_CLASS_INSTANCE(orte_grpcomm_signature_t,
 123                    opal_object_t,
 124                    scon, sdes);
 125 
 126 static void ccon(orte_grpcomm_coll_t *p)
 127 {
 128     p->sig = NULL;
 129     OBJ_CONSTRUCT(&p->bucket, opal_buffer_t);
 130     OBJ_CONSTRUCT(&p->distance_mask_recv, opal_bitmap_t);
 131     p->dmns = NULL;
 132     p->ndmns = 0;
 133     p->nexpected = 0;
 134     p->nreported = 0;
 135     p->cbfunc = NULL;
 136     p->cbdata = NULL;
 137     p->buffers = NULL;
 138 }
 139 static void cdes(orte_grpcomm_coll_t *p)
 140 {
 141     if (NULL != p->sig) {
 142         OBJ_RELEASE(p->sig);
 143     }
 144     OBJ_DESTRUCT(&p->bucket);
 145     OBJ_DESTRUCT(&p->distance_mask_recv);
 146     free(p->dmns);
 147     free(p->buffers);
 148 }
 149 OBJ_CLASS_INSTANCE(orte_grpcomm_coll_t,
 150                    opal_list_item_t,
 151                    ccon, cdes);

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