root/orte/mca/rml/base/rml_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. orte_rml_base_register
  2. orte_rml_base_close
  3. orte_rml_base_open
  4. orte_rml_base_select
  5. orte_rml_send_callback
  6. orte_rml_recv_callback
  7. xfer_cons
  8. send_cons
  9. send_req_cons
  10. send_req_des
  11. recv_cons
  12. recv_des
  13. rcv_cons
  14. rcv_des
  15. prcv_cons
  16. prq_cons
  17. prq_des

   1 /*
   2  * Copyright (c) 2004-2011 The University of Tennessee and The University
   3  *                         of Tennessee Research Foundation.  All rights
   4  *                         reserved.
   5  * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
   6  *                         reserved.
   7  * Copyright (c) 2013      Cisco Systems, Inc.  All rights reserved.
   8  * Copyright (c) 2014-2019 Intel, Inc.  All rights reserved.
   9  * Copyright (c) 2015-2017 Research Organization for Information Science
  10  *                         and Technology (RIST). All rights reserved.
  11  * $COPYRIGHT$
  12  *
  13  * Additional copyrights may follow
  14  *
  15  * $HEADER$
  16  */
  17 
  18 #include "orte_config.h"
  19 
  20 #include <string.h>
  21 
  22 #include "opal/dss/dss.h"
  23 #include "orte/mca/mca.h"
  24 #include "opal/mca/base/mca_base_component_repository.h"
  25 #include "opal/util/output.h"
  26 
  27 #include "orte/mca/errmgr/errmgr.h"
  28 #include "orte/mca/rml/rml.h"
  29 #include "orte/mca/state/state.h"
  30 #include "orte/runtime/orte_wait.h"
  31 #include "orte/util/name_fns.h"
  32 #include "orte/util/threads.h"
  33 
  34 #include "orte/mca/rml/base/base.h"
  35 
  36 /* The following file was created by configure.  It contains extern
  37  * statements and the definition of an array of pointers to each
  38  * component's public mca_base_component_t struct. */
  39 #include "orte/mca/rml/base/static-components.h"
  40 
  41 
  42 /* Initialising stub fns in the global var used by other modules */
  43 orte_rml_base_module_t orte_rml = {0};
  44 
  45 orte_rml_base_t orte_rml_base = {{{0}}};
  46 
  47 static int orte_rml_base_register(mca_base_register_flag_t flags)
  48 {
  49     orte_rml_base.max_retries = 3;
  50     mca_base_var_register("orte", "rml", "base", "max_retries",
  51                            "Max #times to retry sending a message",
  52                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  53                            OPAL_INFO_LVL_9,
  54                            MCA_BASE_VAR_SCOPE_READONLY,
  55                            &orte_rml_base.max_retries);
  56 
  57 #if OPAL_ENABLE_TIMING
  58     orte_rml_base.timing = false;
  59     (void) mca_base_var_register ("orte", "rml", "base", "timing",
  60                                   "Enable RML timings",
  61                                   MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
  62                                   OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
  63                                   &orte_rml_base.timing);
  64 #endif
  65 
  66     return ORTE_SUCCESS;
  67 }
  68 
  69 static int orte_rml_base_close(void)
  70 {
  71     OPAL_LIST_DESTRUCT(&orte_rml_base.posted_recvs);
  72     return mca_base_framework_components_close(&orte_rml_base_framework, NULL);
  73 }
  74 
  75 static int orte_rml_base_open(mca_base_open_flag_t flags)
  76 {
  77     /* Initialize globals */
  78     /* construct object for holding the active plugin modules */
  79     OBJ_CONSTRUCT(&orte_rml_base.posted_recvs, opal_list_t);
  80     OBJ_CONSTRUCT(&orte_rml_base.unmatched_msgs, opal_list_t);
  81 
  82     /* Open up all available components */
  83     return mca_base_framework_components_open(&orte_rml_base_framework, flags);
  84 }
  85 
  86 MCA_BASE_FRAMEWORK_DECLARE(orte, rml, "ORTE Run-Time Messaging Layer",
  87                            orte_rml_base_register, orte_rml_base_open, orte_rml_base_close,
  88                            mca_rml_base_static_components, 0);
  89 
  90 /**
  91  * Function for ordering the component(plugin) by priority
  92  */
  93 int orte_rml_base_select(void)
  94 {
  95     orte_rml_component_t *best_component = NULL;
  96     orte_rml_base_module_t *best_module = NULL;
  97 
  98     /*
  99      * Select the best component
 100      */
 101     if( OPAL_SUCCESS != mca_base_select("rml", orte_rml_base_framework.framework_output,
 102                                         &orte_rml_base_framework.framework_components,
 103                                         (mca_base_module_t **) &best_module,
 104                                         (mca_base_component_t **) &best_component, NULL) ) {
 105         /* This will only happen if no component was selected */
 106         /* If we didn't find one to select, that is an error */
 107         return ORTE_ERROR;
 108     }
 109 
 110     /* Save the winner */
 111     orte_rml = *best_module;
 112 
 113     return ORTE_SUCCESS;
 114 }
 115 
 116 void orte_rml_send_callback(int status, orte_process_name_t *peer,
 117                             opal_buffer_t* buffer, orte_rml_tag_t tag,
 118                             void* cbdata)
 119 
 120 {
 121     OBJ_RELEASE(buffer);
 122     if (ORTE_SUCCESS != status) {
 123         opal_output_verbose(2, orte_rml_base_framework.framework_output,
 124                             "%s UNABLE TO SEND MESSAGE TO %s TAG %d: %s",
 125                             ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
 126                             ORTE_NAME_PRINT(peer), tag,
 127                             ORTE_ERROR_NAME(status));
 128         if (ORTE_ERR_NO_PATH_TO_TARGET == status) {
 129             ORTE_ACTIVATE_PROC_STATE(peer, ORTE_PROC_STATE_NO_PATH_TO_TARGET);
 130         } else if (ORTE_ERR_ADDRESSEE_UNKNOWN == status) {
 131             ORTE_ACTIVATE_PROC_STATE(peer, ORTE_PROC_STATE_PEER_UNKNOWN);
 132         } else {
 133             ORTE_ACTIVATE_PROC_STATE(peer, ORTE_PROC_STATE_UNABLE_TO_SEND_MSG);
 134         }
 135     }
 136 }
 137 
 138 void orte_rml_recv_callback(int status, orte_process_name_t* sender,
 139                             opal_buffer_t *buffer,
 140                             orte_rml_tag_t tag, void *cbdata)
 141 {
 142     orte_rml_recv_cb_t *blob = (orte_rml_recv_cb_t*)cbdata;
 143 
 144     ORTE_ACQUIRE_OBJECT(blob);
 145     /* transfer the sender */
 146     blob->name.jobid = sender->jobid;
 147     blob->name.vpid = sender->vpid;
 148     /* just copy the payload to the buf */
 149     opal_dss.copy_payload(&blob->data, buffer);
 150     /* flag as complete */
 151     ORTE_POST_OBJECT(blob);
 152     blob->active = false;
 153 }
 154 
 155 
 156 /***   RML CLASS INSTANCES   ***/
 157 static void xfer_cons(orte_self_send_xfer_t *xfer)
 158 {
 159     xfer->iov = NULL;
 160     xfer->cbfunc.iov = NULL;
 161     xfer->buffer = NULL;
 162     xfer->cbfunc.buffer = NULL;
 163     xfer->cbdata = NULL;
 164 }
 165 OBJ_CLASS_INSTANCE(orte_self_send_xfer_t,
 166                    opal_object_t,
 167                    xfer_cons, NULL);
 168 
 169 static void send_cons(orte_rml_send_t *ptr)
 170 {
 171     ptr->retries = 0;
 172     ptr->cbdata = NULL;
 173     ptr->iov = NULL;
 174     ptr->buffer = NULL;
 175     ptr->data = NULL;
 176     ptr->seq_num = 0xFFFFFFFF;
 177 }
 178 OBJ_CLASS_INSTANCE(orte_rml_send_t,
 179                    opal_list_item_t,
 180                    send_cons, NULL);
 181 
 182 
 183 static void send_req_cons(orte_rml_send_request_t *ptr)
 184 {
 185     OBJ_CONSTRUCT(&ptr->send, orte_rml_send_t);
 186 }
 187 static void send_req_des(orte_rml_send_request_t *ptr)
 188 {
 189     OBJ_DESTRUCT(&ptr->send);
 190 }
 191 OBJ_CLASS_INSTANCE(orte_rml_send_request_t,
 192                    opal_object_t,
 193                    send_req_cons, send_req_des);
 194 
 195 static void recv_cons(orte_rml_recv_t *ptr)
 196 {
 197     ptr->iov.iov_base = NULL;
 198     ptr->iov.iov_len = 0;
 199 }
 200 static void recv_des(orte_rml_recv_t *ptr)
 201 {
 202     if (NULL != ptr->iov.iov_base) {
 203         free(ptr->iov.iov_base);
 204     }
 205 }
 206 OBJ_CLASS_INSTANCE(orte_rml_recv_t,
 207                    opal_list_item_t,
 208                    recv_cons, recv_des);
 209 
 210 static void rcv_cons(orte_rml_recv_cb_t *ptr)
 211 {
 212     OBJ_CONSTRUCT(&ptr->data, opal_buffer_t);
 213     ptr->active = false;
 214 }
 215 static void rcv_des(orte_rml_recv_cb_t *ptr)
 216 {
 217     OBJ_DESTRUCT(&ptr->data);
 218 }
 219 OBJ_CLASS_INSTANCE(orte_rml_recv_cb_t, opal_object_t,
 220                    rcv_cons, rcv_des);
 221 
 222 static void prcv_cons(orte_rml_posted_recv_t *ptr)
 223 {
 224     ptr->cbdata = NULL;
 225 }
 226 OBJ_CLASS_INSTANCE(orte_rml_posted_recv_t,
 227                    opal_list_item_t,
 228                    prcv_cons, NULL);
 229 
 230 static void prq_cons(orte_rml_recv_request_t *ptr)
 231 {
 232     ptr->cancel = false;
 233     ptr->post = OBJ_NEW(orte_rml_posted_recv_t);
 234 }
 235 static void prq_des(orte_rml_recv_request_t *ptr)
 236 {
 237     if (NULL != ptr->post) {
 238         OBJ_RELEASE(ptr->post);
 239     }
 240 }
 241 OBJ_CLASS_INSTANCE(orte_rml_recv_request_t,
 242                    opal_object_t,
 243                    prq_cons, prq_des);

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