root/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_mtl_portals4_flowctl_init
  2. ompi_mtl_portals4_flowctl_fini
  3. ompi_mtl_portals4_flowctl_add_procs
  4. ompi_mtl_portals4_flowctl_trigger
  5. seqnum_compare
  6. start_recover
  7. setup_alarm
  8. setup_barrier
  9. flowctl_alert_callback
  10. flowctl_fanout_callback

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2012      Sandia National Laboratories.  All rights reserved.
   4  * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 #include "ompi_config.h"
  14 
  15 #include "ompi/proc/proc.h"
  16 
  17 #include "mtl_portals4.h"
  18 #include "mtl_portals4_flowctl.h"
  19 #include "mtl_portals4_recv_short.h"
  20 
  21 OBJ_CLASS_INSTANCE(ompi_mtl_portals4_pending_request_t, opal_free_list_item_t,
  22                    NULL, NULL);
  23 
  24 static int flowctl_alert_callback(ptl_event_t *ev,
  25                                   ompi_mtl_portals4_base_request_t *ptl_base_request);
  26 static int flowctl_fanout_callback(ptl_event_t *ev,
  27                                    ompi_mtl_portals4_base_request_t *ptl_base_request);
  28 
  29 static int start_recover(void);
  30 static int setup_alarm(uint32_t epoch);
  31 static int setup_barrier(uint32_t epoch);
  32 
  33 int
  34 ompi_mtl_portals4_flowctl_init(void)
  35 {
  36     ptl_me_t me;
  37     int ret;
  38 
  39     ompi_mtl_portals4.flowctl.flowctl_active = false;
  40 
  41     OBJ_CONSTRUCT(&ompi_mtl_portals4.flowctl.pending_sends, opal_list_t);
  42 
  43     OBJ_CONSTRUCT(&ompi_mtl_portals4.flowctl.pending_fl, opal_free_list_t);
  44     opal_free_list_init(&ompi_mtl_portals4.flowctl.pending_fl,
  45                         sizeof(ompi_mtl_portals4_pending_request_t),
  46                         opal_cache_line_size,
  47                         OBJ_CLASS(ompi_mtl_portals4_pending_request_t),
  48                         0, 0, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
  49 
  50     ompi_mtl_portals4.flowctl.max_send_slots = (ompi_mtl_portals4.send_queue_size - 3) / 3;
  51     ompi_mtl_portals4.flowctl.send_slots = ompi_mtl_portals4.flowctl.max_send_slots;
  52 
  53     ompi_mtl_portals4.flowctl.alert_req.type = portals4_req_flowctl;
  54     ompi_mtl_portals4.flowctl.alert_req.event_callback = flowctl_alert_callback;
  55 
  56     ompi_mtl_portals4.flowctl.fanout_req.type = portals4_req_flowctl;
  57     ompi_mtl_portals4.flowctl.fanout_req.event_callback = flowctl_fanout_callback;
  58 
  59     ompi_mtl_portals4.flowctl.epoch_counter = -1;
  60 
  61     ret = PtlPTAlloc(ompi_mtl_portals4.ni_h,
  62                      PTL_PT_ONLY_TRUNCATE,
  63                      ompi_mtl_portals4.send_eq_h,
  64                      REQ_FLOWCTL_TABLE_ID,
  65                      &ompi_mtl_portals4.flowctl_idx);
  66     if (OPAL_UNLIKELY(PTL_OK != ret)) {
  67         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
  68                             "%s:%d: PtlPTAlloc failed: %d\n",
  69                             __FILE__, __LINE__, ret);
  70         goto error;
  71     }
  72 
  73     if (ompi_mtl_portals4.flowctl_idx != REQ_FLOWCTL_TABLE_ID) {
  74         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
  75                             "%s:%d: PtlPTAlloc did not allocate the requested PT: %d\n",
  76                             __FILE__, __LINE__, ompi_mtl_portals4.flowctl_idx);
  77         goto error;
  78     }
  79 
  80     ret = PtlCTAlloc(ompi_mtl_portals4.ni_h,
  81                      &ompi_mtl_portals4.flowctl.trigger_ct_h);
  82     if (OPAL_UNLIKELY(PTL_OK != ret)) {
  83         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
  84                             "%s:%d: PtlCTAlloc failed: %d\n",
  85                             __FILE__, __LINE__, ret);
  86         goto error;
  87     }
  88 
  89     /* everyone creates the trigger ME, even if the root may be the
  90        only to use it */
  91     me.start = NULL;
  92     me.length = 0;
  93     me.min_free = 0;
  94     me.uid = ompi_mtl_portals4.uid;
  95     if (ompi_mtl_portals4.use_logical) {
  96         me.match_id.rank = PTL_RANK_ANY;
  97     } else {
  98         me.match_id.phys.nid = PTL_NID_ANY;
  99         me.match_id.phys.pid = PTL_PID_ANY;
 100     }
 101     me.ignore_bits = 0;
 102 
 103     me.options = PTL_ME_OP_PUT |
 104         PTL_ME_ACK_DISABLE |
 105         PTL_ME_EVENT_LINK_DISABLE |
 106         PTL_ME_EVENT_UNLINK_DISABLE |
 107         PTL_ME_EVENT_COMM_DISABLE |
 108         PTL_ME_EVENT_CT_COMM;
 109     me.ct_handle = ompi_mtl_portals4.flowctl.trigger_ct_h;
 110     me.match_bits = MTL_PORTALS4_FLOWCTL_TRIGGER;
 111     ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
 112                       ompi_mtl_portals4.flowctl_idx,
 113                       &me,
 114                       PTL_PRIORITY_LIST,
 115                       NULL,
 116                       &ompi_mtl_portals4.flowctl.trigger_me_h);
 117     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 118         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 119                             "%s:%d: PtlMEAppend failed: %d\n",
 120                             __FILE__, __LINE__, ret);
 121         goto error;
 122     }
 123 
 124 
 125     /* Alert CT/ME for broadcasting out alert when root receives a
 126        trigger */
 127     ret = PtlCTAlloc(ompi_mtl_portals4.ni_h,
 128                      &ompi_mtl_portals4.flowctl.alert_ct_h);
 129     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 130         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 131                             "%s:%d: PtlCTAlloc failed: %d\n",
 132                             __FILE__, __LINE__, ret);
 133         goto error;
 134     }
 135     me.options = PTL_ME_OP_PUT |
 136         PTL_ME_ACK_DISABLE |
 137         PTL_ME_EVENT_LINK_DISABLE |
 138         PTL_ME_EVENT_UNLINK_DISABLE |
 139         PTL_ME_EVENT_CT_COMM;
 140     me.ct_handle = ompi_mtl_portals4.flowctl.alert_ct_h;
 141     me.match_bits = MTL_PORTALS4_FLOWCTL_ALERT;
 142     ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
 143                       ompi_mtl_portals4.flowctl_idx,
 144                       &me,
 145                       PTL_PRIORITY_LIST,
 146                       &ompi_mtl_portals4.flowctl.alert_req,
 147                       &ompi_mtl_portals4.flowctl.alert_me_h);
 148     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 149         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 150                             "%s:%d: PtlMEAppend failed: %d\n",
 151                             __FILE__, __LINE__, ret);
 152         goto error;
 153     }
 154 
 155     /* Fanin CT/ME for receiving fan-in for restart */
 156     ret = PtlCTAlloc(ompi_mtl_portals4.ni_h,
 157                      &ompi_mtl_portals4.flowctl.fanin_ct_h);
 158     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 159         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 160                             "%s:%d: PtlCTAlloc failed: %d\n",
 161                             __FILE__, __LINE__, ret);
 162         goto error;
 163     }
 164     me.options = PTL_ME_OP_PUT |
 165         PTL_ME_ACK_DISABLE |
 166         PTL_ME_EVENT_COMM_DISABLE |
 167         PTL_ME_EVENT_LINK_DISABLE |
 168         PTL_ME_EVENT_UNLINK_DISABLE |
 169         PTL_ME_EVENT_CT_COMM;
 170     me.ct_handle = ompi_mtl_portals4.flowctl.fanin_ct_h;
 171     me.match_bits = MTL_PORTALS4_FLOWCTL_FANIN;
 172     ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
 173                       ompi_mtl_portals4.flowctl_idx,
 174                       &me,
 175                       PTL_PRIORITY_LIST,
 176                       NULL,
 177                       &ompi_mtl_portals4.flowctl.fanin_me_h);
 178     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 179         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 180                             "%s:%d: PtlMEAppend failed: %d\n",
 181                             __FILE__, __LINE__, ret);
 182         goto error;
 183     }
 184 
 185     /* Fan-out CT/ME for sending restart messages after fan-in */
 186     ret = PtlCTAlloc(ompi_mtl_portals4.ni_h,
 187                      &ompi_mtl_portals4.flowctl.fanout_ct_h);
 188     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 189         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 190                             "%s:%d: PtlCTAlloc failed: %d\n",
 191                             __FILE__, __LINE__, ret);
 192         goto error;
 193     }
 194     me.options = PTL_ME_OP_PUT |
 195         PTL_ME_ACK_DISABLE |
 196         PTL_ME_EVENT_LINK_DISABLE |
 197         PTL_ME_EVENT_UNLINK_DISABLE |
 198         PTL_ME_EVENT_CT_COMM;
 199     me.ct_handle = ompi_mtl_portals4.flowctl.fanout_ct_h;
 200     me.match_bits = MTL_PORTALS4_FLOWCTL_FANOUT;
 201     ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
 202                       ompi_mtl_portals4.flowctl_idx,
 203                       &me,
 204                       PTL_PRIORITY_LIST,
 205                       &ompi_mtl_portals4.flowctl.fanout_req,
 206                       &ompi_mtl_portals4.flowctl.fanout_me_h);
 207     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 208         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 209                             "%s:%d: PtlMEAppend failed: %d\n",
 210                             __FILE__, __LINE__, ret);
 211         goto error;
 212     }
 213 
 214     ompi_mtl_portals4.flowctl.num_children = 0;
 215 
 216     gettimeofday(&ompi_mtl_portals4.flowctl.tv, NULL);
 217     ompi_mtl_portals4.flowctl.backoff_count = 0;
 218 
 219     ret = OMPI_SUCCESS;
 220 
 221  error:
 222     return ret;
 223 }
 224 
 225 
 226 int
 227 ompi_mtl_portals4_flowctl_fini(void)
 228 {
 229     PtlMEUnlink(ompi_mtl_portals4.flowctl.trigger_me_h);
 230     PtlCTFree(ompi_mtl_portals4.flowctl.trigger_ct_h);
 231     PtlMEUnlink(ompi_mtl_portals4.flowctl.alert_me_h);
 232     PtlCTFree(ompi_mtl_portals4.flowctl.alert_ct_h);
 233     PtlMEUnlink(ompi_mtl_portals4.flowctl.fanin_me_h);
 234     PtlCTFree(ompi_mtl_portals4.flowctl.fanin_ct_h);
 235     PtlMEUnlink(ompi_mtl_portals4.flowctl.fanout_me_h);
 236     PtlCTFree(ompi_mtl_portals4.flowctl.fanout_ct_h);
 237 
 238     PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.flowctl_idx);
 239 
 240     return OMPI_SUCCESS;
 241 }
 242 
 243 
 244 int
 245 ompi_mtl_portals4_flowctl_add_procs(size_t me,
 246                                     size_t npeers,
 247                                     struct ompi_proc_t **procs)
 248 {
 249     int i;
 250 
 251     /* if epoch isn't 0, that means setup trees has been called, which
 252        means that this add_procs is a dynamic process, which we don't
 253        support */
 254     if (ompi_mtl_portals4.flowctl.epoch_counter != -1) {
 255         return OMPI_ERR_NOT_SUPPORTED;
 256     }
 257     ompi_mtl_portals4.flowctl.epoch_counter = 0;
 258 
 259     ompi_mtl_portals4.flowctl.num_procs = npeers;
 260     if (0 == me) ompi_mtl_portals4.flowctl.i_am_root = true;
 261     else         ompi_mtl_portals4.flowctl.i_am_root = false;
 262 
 263     if (ompi_mtl_portals4.use_logical) {
 264         ompi_mtl_portals4.flowctl.root.rank = 0;
 265         if (false == ompi_mtl_portals4.flowctl.i_am_root) {
 266             ompi_mtl_portals4.flowctl.parent.rank =  (me - 1) / 2;
 267         }
 268         ompi_mtl_portals4.flowctl.me.rank = me;
 269     }
 270     else {
 271         ompi_mtl_portals4.flowctl.root =
 272             *((ptl_process_t*) procs[0]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
 273         if (false == ompi_mtl_portals4.flowctl.i_am_root) {
 274             ompi_mtl_portals4.flowctl.parent =
 275                 *((ptl_process_t*) procs[(me - 1) / 2]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
 276         }
 277         ompi_mtl_portals4.flowctl.me =
 278             *((ptl_process_t*) procs[me]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
 279     }
 280 
 281     for (i = 0 ; i < 2 ; ++i) {
 282         size_t tmp = (2 * me) + i + 1;
 283         if (tmp < npeers) {
 284             ompi_mtl_portals4.flowctl.num_children++;
 285             if (ompi_mtl_portals4.use_logical)
 286                 ompi_mtl_portals4.flowctl.children[i].rank = tmp;
 287             else ompi_mtl_portals4.flowctl.children[i] =
 288                     *((ptl_process_t*) procs[tmp]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
 289         }
 290     }
 291 
 292     return setup_alarm(ompi_mtl_portals4.flowctl.epoch_counter);
 293 }
 294 
 295 
 296 int
 297 ompi_mtl_portals4_flowctl_trigger(void)
 298 {
 299     int32_t _tmp_value = 0;
 300     int ret;
 301 
 302     if (true == OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_32(&ompi_mtl_portals4.flowctl.flowctl_active, &_tmp_value, 1)) {
 303         /* send trigger to root */
 304         ret = PtlPut(ompi_mtl_portals4.zero_md_h,
 305                      0,
 306                      0,
 307                      PTL_NO_ACK_REQ,
 308                      ompi_mtl_portals4.flowctl.root,
 309                      ompi_mtl_portals4.flowctl_idx,
 310                      MTL_PORTALS4_FLOWCTL_TRIGGER,
 311                      0,
 312                      NULL,
 313                      0);
 314         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 315             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 316                                 "%s:%d: PtlPut failed: %d\n",
 317                                 __FILE__, __LINE__, ret);
 318             return ret;
 319         }
 320     }
 321 
 322     return OMPI_SUCCESS;
 323 }
 324 
 325 
 326 static int
 327 seqnum_compare(opal_list_item_t **ap, opal_list_item_t **bp)
 328 {
 329     ompi_mtl_portals4_pending_request_t *a =
 330         (ompi_mtl_portals4_pending_request_t*) *ap;
 331     ompi_mtl_portals4_pending_request_t *b =
 332         (ompi_mtl_portals4_pending_request_t*) *bp;
 333 
 334     if (a->ptl_request->opcount > b->ptl_request->opcount) {
 335         return 1;
 336     } else if (a->ptl_request->opcount == b->ptl_request->opcount) {
 337         return 0;
 338     } else {
 339         return -1;
 340     }
 341 }
 342 
 343 static int
 344 start_recover(void)
 345 {
 346     int ret;
 347     int64_t epoch_counter;
 348 
 349     ompi_mtl_portals4.flowctl.flowctl_active = true;
 350     epoch_counter = opal_atomic_add_fetch_64(&ompi_mtl_portals4.flowctl.epoch_counter, 1);
 351 
 352     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 353                         "Entering flowctl_start_recover %ld",
 354                         epoch_counter);
 355 
 356     /* re-arm trigger/alarm for next time */
 357     ret = setup_alarm(epoch_counter);
 358     if (OMPI_SUCCESS != ret) {
 359         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 360                             "%s:%d setup_alarm failed: %d\n",
 361                             __FILE__, __LINE__, ret);
 362         return ret;
 363     }
 364 
 365     /* setup barrier tree for getting us out of flow control */
 366     ret = setup_barrier(epoch_counter);
 367     if (OMPI_SUCCESS != ret) {
 368         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 369                             "%s:%d setup_barrier failed: %d\n",
 370                             __FILE__, __LINE__, ret);
 371         return ret;
 372     }
 373 
 374     /* drain all pending sends */
 375     while (ompi_mtl_portals4.flowctl.send_slots !=
 376            ompi_mtl_portals4.flowctl.max_send_slots) {
 377         opal_progress();
 378     }
 379 
 380     /* drain event queue */
 381     while (0 != ompi_mtl_portals4_progress()) { ; }
 382 
 383     /* check short block active count */
 384     ret = ompi_mtl_portals4_recv_short_link(1);
 385     if (OMPI_SUCCESS != ret) {
 386         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 387                             "%s:%d: recv_short_link failed: %d",
 388                             __FILE__, __LINE__, ret);
 389     }
 390 
 391     /* reorder the pending sends by operation count */
 392     ret = opal_list_sort(&ompi_mtl_portals4.flowctl.pending_sends, seqnum_compare);
 393     if (OMPI_SUCCESS != ret) {
 394         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 395                             "%s:%d opal_list_sort failed: %d\n",
 396                             __FILE__, __LINE__, ret);
 397         return ret;
 398     }
 399 
 400     /* drain event queue again, just to make sure */
 401     while (0 != ompi_mtl_portals4_progress()) { ; }
 402 
 403     /* send barrier entry message */
 404     ret = PtlPut(ompi_mtl_portals4.zero_md_h,
 405                  0,
 406                  0,
 407                  PTL_NO_ACK_REQ,
 408                  ompi_mtl_portals4.flowctl.me,
 409                  ompi_mtl_portals4.flowctl_idx,
 410                  MTL_PORTALS4_FLOWCTL_FANIN,
 411                  0,
 412                  NULL,
 413                  0);
 414     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 415         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 416                             "%s:%d: PtlPut failed: %d\n",
 417                             __FILE__, __LINE__, ret);
 418         goto error;
 419     }
 420 
 421     /* recovery complete when fan-out event arrives, async event, so
 422        we're done now */
 423     ret = OMPI_SUCCESS;
 424 
 425  error:
 426     OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output,
 427                          "Exiting flowctl_start_recover %ld",
 428                          epoch_counter));
 429 
 430     return ret;
 431 }
 432 
 433 
 434 static int
 435 setup_alarm(uint32_t epoch)
 436 {
 437     int ret = OMPI_SUCCESS;
 438     size_t i;
 439 
 440     /* setup trigger */
 441     if (ompi_mtl_portals4.flowctl.i_am_root) {
 442         ret = PtlTriggeredPut(ompi_mtl_portals4.zero_md_h,
 443                               0,
 444                               0,
 445                               PTL_NO_ACK_REQ,
 446                               ompi_mtl_portals4.flowctl.me,
 447                               ompi_mtl_portals4.flowctl_idx,
 448                               MTL_PORTALS4_FLOWCTL_ALERT,
 449                               0,
 450                               NULL,
 451                               0,
 452                               ompi_mtl_portals4.flowctl.trigger_ct_h,
 453                               (epoch * ompi_mtl_portals4.flowctl.num_procs) + 1);
 454         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 455             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 456                                 "%s:%d: PtlTriggeredPut failed: %d\n",
 457                                 __FILE__, __LINE__, ret);
 458             goto cleanup;
 459         }
 460     }
 461 
 462     /* setup the alert broadcast tree */
 463     for (i = 0 ; i < ompi_mtl_portals4.flowctl.num_children ; ++i) {
 464         ret = PtlTriggeredPut(ompi_mtl_portals4.zero_md_h,
 465                               0,
 466                               0,
 467                               PTL_NO_ACK_REQ,
 468                               ompi_mtl_portals4.flowctl.children[i],
 469                               ompi_mtl_portals4.flowctl_idx,
 470                               MTL_PORTALS4_FLOWCTL_ALERT,
 471                               0,
 472                               NULL,
 473                               0,
 474                               ompi_mtl_portals4.flowctl.alert_ct_h,
 475                               epoch + 1);
 476         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 477             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 478                                 "%s:%d: PtlTriggeredPut failed: %d\n",
 479                                 __FILE__, __LINE__, ret);
 480             goto cleanup;
 481         }
 482     }
 483 
 484  cleanup:
 485     return ret;
 486 }
 487 
 488 
 489 static int
 490 setup_barrier(uint32_t epoch)
 491 {
 492     int ret = OMPI_SUCCESS;
 493     size_t i;
 494     ptl_ct_event_t ct;
 495 
 496     if (ompi_mtl_portals4.flowctl.i_am_root) {
 497         ct.success = ompi_mtl_portals4.flowctl.epoch_counter *
 498             ompi_mtl_portals4.flowctl.num_procs;
 499         ct.failure = 0;
 500         ret = PtlTriggeredCTSet(ompi_mtl_portals4.flowctl.trigger_ct_h,
 501                                 ct,
 502                                 ompi_mtl_portals4.flowctl.fanin_ct_h,
 503                                 epoch * (ompi_mtl_portals4.flowctl.num_children + 1));
 504         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 505             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 506                                 "%s:%d: PtlTriggeredCTSet failed: %d\n",
 507                                 __FILE__, __LINE__, ret);
 508             goto cleanup;
 509         }
 510 
 511         ret = PtlTriggeredPut(ompi_mtl_portals4.zero_md_h,
 512                               0,
 513                               0,
 514                               PTL_NO_ACK_REQ,
 515                               ompi_mtl_portals4.flowctl.me,
 516                               ompi_mtl_portals4.flowctl_idx,
 517                               MTL_PORTALS4_FLOWCTL_FANOUT,
 518                               0,
 519                               NULL,
 520                               0,
 521                               ompi_mtl_portals4.flowctl.fanin_ct_h,
 522                               epoch * (ompi_mtl_portals4.flowctl.num_children + 1));
 523         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 524             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 525                                 "%s:%d: PtlTriggeredPut failed: %d\n",
 526                                 __FILE__, __LINE__, ret);
 527             goto cleanup;
 528         }
 529     } else {
 530         ret = PtlTriggeredPut(ompi_mtl_portals4.zero_md_h,
 531                               0,
 532                               0,
 533                               PTL_NO_ACK_REQ,
 534                               ompi_mtl_portals4.flowctl.parent,
 535                               ompi_mtl_portals4.flowctl_idx,
 536                               MTL_PORTALS4_FLOWCTL_FANIN,
 537                               0,
 538                               NULL,
 539                               0,
 540                               ompi_mtl_portals4.flowctl.fanin_ct_h,
 541                               epoch * (ompi_mtl_portals4.flowctl.num_children + 1));
 542         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 543             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 544                                 "%s:%d: PtlTriggeredPut failed: %d\n",
 545                                 __FILE__, __LINE__, ret);
 546             goto cleanup;
 547         }
 548     }
 549 
 550     for (i = 0 ; i < ompi_mtl_portals4.flowctl.num_children ; ++i) {
 551         ret = PtlTriggeredPut(ompi_mtl_portals4.zero_md_h,
 552                               0,
 553                               0,
 554                               PTL_NO_ACK_REQ,
 555                               ompi_mtl_portals4.flowctl.children[i],
 556                               ompi_mtl_portals4.flowctl_idx,
 557                               MTL_PORTALS4_FLOWCTL_FANOUT,
 558                               0,
 559                               NULL,
 560                               0,
 561                               ompi_mtl_portals4.flowctl.fanout_ct_h,
 562                               epoch);
 563         if (OPAL_UNLIKELY(PTL_OK != ret)) {
 564             opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 565                                 "%s:%d: PtlTriggeredPut failed: %d\n",
 566                                 __FILE__, __LINE__, ret);
 567             return ret;
 568         }
 569     }
 570 
 571  cleanup:
 572     return ret;
 573 }
 574 
 575 
 576 static int
 577 flowctl_alert_callback(ptl_event_t *ev,
 578                        ompi_mtl_portals4_base_request_t *ptl_base_request)
 579 {
 580     return start_recover();
 581 }
 582 
 583 
 584 static int
 585 flowctl_fanout_callback(ptl_event_t *ev,
 586                         ompi_mtl_portals4_base_request_t *ptl_base_request)
 587 {
 588     int ret;
 589     struct timeval tv;
 590 
 591     ompi_mtl_portals4.flowctl.flowctl_active = false;
 592     ret = PtlPTEnable(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.recv_idx);
 593     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 594         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 595                             "%s:%d: PtlPTEnabled failed: %d\n",
 596                             __FILE__, __LINE__, ret);
 597         return ret;
 598     }
 599 
 600     gettimeofday(&tv, NULL);
 601     if (((tv.tv_sec * 1000000 + tv.tv_usec) -
 602          (ompi_mtl_portals4.flowctl.tv.tv_sec * 1000000 + ompi_mtl_portals4.flowctl.tv.tv_usec))
 603         < 1000000 * ompi_mtl_portals4.flowctl.backoff_count) {
 604         usleep(++ompi_mtl_portals4.flowctl.backoff_count);
 605     } else {
 606         ompi_mtl_portals4.flowctl.backoff_count = 0;
 607     }
 608     ompi_mtl_portals4.flowctl.tv = tv;
 609 
 610     ompi_mtl_portals4_pending_list_progress();
 611 
 612     OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output,
 613                          "Exiting flowctl_fanout_callback %ld",
 614                          ompi_mtl_portals4.flowctl.epoch_counter));
 615 
 616     return OMPI_SUCCESS;
 617 }

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