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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_mtl_portals4_component_register
  2. ompi_mtl_portals4_component_open
  3. ompi_mtl_portals4_component_query
  4. ompi_mtl_portals4_component_close
  5. ompi_mtl_portals4_component_init
  6. ompi_mtl_portals4_get_error
  7. ompi_mtl_portals4_progress

   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) 2010-2012 Sandia National Laboratories.  All rights reserved.
  14  * Copyright (c) 2014      Intel, Inc. All rights reserved.
  15  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
  16  *                         reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 
  24 #include "ompi_config.h"
  25 
  26 #include "opal/mca/event/event.h"
  27 #include "opal/util/output.h"
  28 #include "opal/mca/pmix/pmix.h"
  29 
  30 #include "mtl_portals4.h"
  31 #include "mtl_portals4_request.h"
  32 #include "mtl_portals4_recv_short.h"
  33 #include "mtl_portals4_message.h"
  34 #include "ompi/runtime/mpiruntime.h"
  35 
  36 static int param_priority;
  37 
  38 static int ompi_mtl_portals4_component_register(void);
  39 static int ompi_mtl_portals4_component_open(void);
  40 static int ompi_mtl_portals4_component_close(void);
  41 static int ompi_mtl_portals4_component_query(mca_base_module_t **module, int *priority);
  42 static mca_mtl_base_module_t*
  43 ompi_mtl_portals4_component_init(bool enable_progress_threads,
  44                                  bool enable_mpi_threads);
  45 
  46 OMPI_MODULE_DECLSPEC extern mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component;
  47 
  48 mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component = {
  49 
  50     /* First, the mca_base_component_t struct containing meta
  51      * information about the component itself */
  52 
  53     .mtl_version = {
  54         MCA_MTL_BASE_VERSION_2_0_0,
  55 
  56         .mca_component_name = "portals4",
  57         MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  58                               OMPI_RELEASE_VERSION),
  59         .mca_open_component = ompi_mtl_portals4_component_open,
  60         .mca_close_component = ompi_mtl_portals4_component_close,
  61         .mca_query_component = ompi_mtl_portals4_component_query,
  62         .mca_register_component_params = ompi_mtl_portals4_component_register,
  63     },
  64     .mtl_data = {
  65         /* The component is not checkpoint ready */
  66         MCA_BASE_METADATA_PARAM_NONE
  67     },
  68 
  69     .mtl_init = ompi_mtl_portals4_component_init,
  70 };
  71 
  72 static mca_base_var_enum_value_t long_protocol_values[] = {
  73     {eager, "eager"},
  74     {rndv, "rndv"},
  75     {0, NULL}
  76 };
  77 
  78 OBJ_CLASS_INSTANCE(ompi_mtl_portals4_rndv_get_frag_t,
  79                    opal_free_list_item_t,
  80                    NULL, NULL);
  81 
  82 static int
  83 ompi_mtl_portals4_component_register(void)
  84 {
  85     mca_base_var_enum_t *new_enum;
  86     int ret;
  87 
  88     ompi_mtl_portals4.use_logical = 0;
  89     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
  90                                            "use_logical",
  91                                            "Use the logical to physical table to accelerate portals4 adressing: 1 (true) : 0 (false)",
  92                                            MCA_BASE_VAR_TYPE_INT,
  93                                            NULL,
  94                                            0,
  95                                            0,
  96                                            OPAL_INFO_LVL_5,
  97                                            MCA_BASE_VAR_SCOPE_READONLY,
  98                                            &ompi_mtl_portals4.use_logical);
  99 
 100     param_priority = 10;
 101     (void) mca_base_component_var_register (&mca_mtl_portals4_component.mtl_version,
 102                                             "priority", "Priority of the Portals4 MTL component",
 103                                             MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 104                                             OPAL_INFO_LVL_9,
 105                                             MCA_BASE_VAR_SCOPE_READONLY,
 106                                             &param_priority);
 107     ompi_mtl_portals4.short_limit = 2 * 1024;
 108     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 109                                            "short_limit",
 110                                            "Size limit for short messages",
 111                                            MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
 112                                            NULL,
 113                                            0,
 114                                            0,
 115                                            OPAL_INFO_LVL_5,
 116                                            MCA_BASE_VAR_SCOPE_READONLY,
 117                                            &ompi_mtl_portals4.short_limit);
 118 
 119 
 120     ompi_mtl_portals4.eager_limit = 2 * 1024;
 121     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 122                                            "eager_limit",
 123                                            "Cross-over point from eager to rendezvous sends",
 124                                            MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
 125                                            NULL,
 126                                            0,
 127                                            0,
 128                                            OPAL_INFO_LVL_5,
 129                                            MCA_BASE_VAR_SCOPE_READONLY,
 130                                            &ompi_mtl_portals4.eager_limit);
 131 
 132     ompi_mtl_portals4.recv_short_num = 32;
 133     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 134                                            "short_recv_num",
 135                                            "Number of short message receive blocks",
 136                                            MCA_BASE_VAR_TYPE_INT,
 137                                            NULL,
 138                                            0,
 139                                            0,
 140                                            OPAL_INFO_LVL_5,
 141                                            MCA_BASE_VAR_SCOPE_READONLY,
 142                                            &ompi_mtl_portals4.recv_short_num);
 143 
 144     ompi_mtl_portals4.recv_short_size = 2 * 1024 * 1024;
 145     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 146                                            "short_recv_size",
 147                                            "Size of short message receive blocks",
 148                                            MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
 149                                            NULL,
 150                                            0,
 151                                            0,
 152                                            OPAL_INFO_LVL_5,
 153                                            MCA_BASE_VAR_SCOPE_READONLY,
 154                                            &ompi_mtl_portals4.recv_short_size);
 155 
 156     ompi_mtl_portals4.send_queue_size = 1024;
 157     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 158                                            "send_event_queue_size",
 159                                            "Size of the send event queue in entries",
 160                                            MCA_BASE_VAR_TYPE_INT,
 161                                            NULL,
 162                                            0,
 163                                            0,
 164                                            OPAL_INFO_LVL_5,
 165                                            MCA_BASE_VAR_SCOPE_READONLY,
 166                                            &ompi_mtl_portals4.send_queue_size);
 167 
 168     ompi_mtl_portals4.recv_queue_size = 1024;
 169     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 170                                            "recv_event_queue_size",
 171                                            "Size of the recv event queue in entries",
 172                                            MCA_BASE_VAR_TYPE_INT,
 173                                            NULL,
 174                                            0,
 175                                            0,
 176                                            OPAL_INFO_LVL_5,
 177                                            MCA_BASE_VAR_SCOPE_READONLY,
 178                                            &ompi_mtl_portals4.recv_queue_size);
 179 
 180     ompi_mtl_portals4.protocol = eager;
 181     mca_base_var_enum_create("mtl_portals4_long_protocol", long_protocol_values, &new_enum);
 182     ret = mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 183                                            "long_protocol",
 184                                            "Protocol to use for long messages.  Valid entries are eager and rndv",
 185                                            MCA_BASE_VAR_TYPE_INT,
 186                                            new_enum,
 187                                            0,
 188                                            0,
 189                                            OPAL_INFO_LVL_5,
 190                                            MCA_BASE_VAR_SCOPE_READONLY,
 191                                            &ompi_mtl_portals4.protocol);
 192 
 193     ompi_mtl_portals4.max_msg_size_mtl = PTL_SIZE_MAX;
 194     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 195                                            "max_msg_size",
 196                                            "Max size supported by portals4 (above that, a message is cut into messages less than that size)",
 197                                            MCA_BASE_VAR_TYPE_UNSIGNED_LONG,
 198                                            NULL,
 199                                            0,
 200                                            0,
 201                                            OPAL_INFO_LVL_5,
 202                                            MCA_BASE_VAR_SCOPE_READONLY,
 203                                            &ompi_mtl_portals4.max_msg_size_mtl);
 204 
 205     ompi_mtl_portals4.get_retransmit_timeout=10000;
 206     (void) mca_base_component_var_register(&mca_mtl_portals4_component.mtl_version,
 207                                            "get_retransmit_timeout",
 208                                            "PtlGET retransmission timeout in usec",
 209                                            MCA_BASE_VAR_TYPE_INT,
 210                                            NULL, 0, 0,
 211                                            OPAL_INFO_LVL_5,
 212                                            MCA_BASE_VAR_SCOPE_READONLY,
 213                                            &ompi_mtl_portals4.get_retransmit_timeout);
 214 
 215     OBJ_RELEASE(new_enum);
 216     if (0 > ret) {
 217         return OMPI_ERR_NOT_SUPPORTED;
 218     }
 219 
 220     return OMPI_SUCCESS;
 221 }
 222 
 223 static int
 224 ompi_mtl_portals4_component_open(void)
 225 {
 226     ompi_mtl_portals4.base.mtl_request_size =
 227         sizeof(ompi_mtl_portals4_request_t) -
 228         sizeof(struct mca_mtl_request_t);
 229 
 230     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 231                         "Flow control: "
 232 #if OMPI_MTL_PORTALS4_FLOW_CONTROL
 233                         "yes"
 234 #else
 235                         "no"
 236 #endif
 237                         );
 238     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 239                         "Max message size: %lu", (unsigned long)
 240                         ompi_mtl_portals4.max_msg_size_mtl);
 241     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 242                         "Short limit: %d", (int)
 243                         ompi_mtl_portals4.short_limit);
 244     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 245                         "Eager limit: %d", (int)
 246                         ompi_mtl_portals4.eager_limit);
 247     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 248                         "Short receive blocks: %d",
 249                         ompi_mtl_portals4.recv_short_num);
 250     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 251                         "Send queue size: %d", ompi_mtl_portals4.send_queue_size);
 252     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 253                         "Recv queue size: %d", ompi_mtl_portals4.recv_queue_size);
 254     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 255                         "Long protocol: %s",
 256                         (ompi_mtl_portals4.protocol == eager) ? "Eager" :
 257                         (ompi_mtl_portals4.protocol == rndv) ? "Rendezvous" :
 258                          "Other");
 259 
 260     OBJ_CONSTRUCT(&ompi_mtl_portals4.fl_message, opal_free_list_t);
 261     opal_free_list_init(&ompi_mtl_portals4.fl_message,
 262                         sizeof(ompi_mtl_portals4_message_t) +
 263                         ompi_mtl_portals4.eager_limit,
 264                         opal_cache_line_size,
 265                         OBJ_CLASS(ompi_mtl_portals4_message_t),
 266                         0, 0, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
 267 
 268     OBJ_CONSTRUCT(&ompi_mtl_portals4.fl_rndv_get_frag, opal_free_list_t);
 269     opal_free_list_init(&ompi_mtl_portals4.fl_rndv_get_frag,
 270                         sizeof(ompi_mtl_portals4_rndv_get_frag_t),
 271                         opal_cache_line_size,
 272                         OBJ_CLASS(ompi_mtl_portals4_rndv_get_frag_t),
 273                         0, 0, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
 274 
 275     ompi_mtl_portals4.ni_h = PTL_INVALID_HANDLE;
 276     ompi_mtl_portals4.send_eq_h = PTL_INVALID_HANDLE;
 277     ompi_mtl_portals4.recv_eq_h = PTL_INVALID_HANDLE;
 278     ompi_mtl_portals4.zero_md_h = PTL_INVALID_HANDLE;
 279     ompi_mtl_portals4.send_md_h = PTL_INVALID_HANDLE;
 280     ompi_mtl_portals4.long_overflow_me_h = PTL_INVALID_HANDLE;
 281     ompi_mtl_portals4.recv_idx = (ptl_pt_index_t) ~0UL;
 282     ompi_mtl_portals4.read_idx = (ptl_pt_index_t) ~0UL;
 283 
 284     ompi_mtl_portals4.need_init=1;
 285 
 286 #if OMPI_MTL_PORTALS4_FLOW_CONTROL
 287     ompi_mtl_portals4.use_flowctl=1;
 288 #else
 289     ompi_mtl_portals4.use_flowctl=0;
 290 #endif
 291 
 292     return OMPI_SUCCESS;
 293 }
 294 
 295 #define NEED_ALL_PROCS (ompi_mtl_portals4.use_logical || ompi_mtl_portals4.use_flowctl)
 296 
 297 static int
 298 ompi_mtl_portals4_component_query(mca_base_module_t **module, int *priority)
 299 {
 300     /*
 301      * assume if portals4 MTL was compiled, the user wants it
 302      */
 303 
 304     *priority = param_priority;
 305     *module = (mca_base_module_t *)&ompi_mtl_portals4.base;
 306 
 307     if (NEED_ALL_PROCS) {
 308         /* let the pml know we need add_procs to be calls with all the
 309          * procs in the job */
 310         ompi_mtl_portals4.base.mtl_flags |= MCA_MTL_BASE_FLAG_REQUIRE_WORLD;
 311     }
 312 
 313     return OMPI_SUCCESS;
 314 }
 315 
 316 
 317 static int
 318 ompi_mtl_portals4_component_close(void)
 319 {
 320     OBJ_DESTRUCT(&ompi_mtl_portals4.fl_message);
 321 
 322     return OMPI_SUCCESS;
 323 }
 324 
 325 
 326 static mca_mtl_base_module_t*
 327 ompi_mtl_portals4_component_init(bool enable_progress_threads,
 328                                  bool enable_mpi_threads)
 329 {
 330     int ret;
 331     ptl_process_t id;
 332     ptl_ni_limits_t actual_limits;
 333 
 334     if (enable_mpi_threads && ompi_mpi_thread_multiple) {
 335         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 336                             "mtl portals4 is initialized for threads");
 337     }
 338 
 339 
 340     /* Initialize Portals and create a physical, matching interface */
 341     ret = PtlInit();
 342     if (PTL_OK != ret) {
 343         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 344                             "%s:%d: PtlInit failed: %d\n",
 345                             __FILE__, __LINE__, ret);
 346         return NULL;
 347     }
 348 
 349     if (ompi_mtl_portals4.use_logical)
 350         ret = PtlNIInit(PTL_IFACE_DEFAULT,
 351                     PTL_NI_LOGICAL | PTL_NI_MATCHING,
 352                     PTL_PID_ANY,
 353                     NULL,
 354                     &actual_limits,
 355                     &ompi_mtl_portals4.ni_h);
 356     else ret = PtlNIInit(PTL_IFACE_DEFAULT,
 357                     PTL_NI_PHYSICAL | PTL_NI_MATCHING,
 358                     PTL_PID_ANY,
 359                     NULL,
 360                     &actual_limits,
 361                     &ompi_mtl_portals4.ni_h);
 362     if (PTL_OK != ret) {
 363         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 364                             "%s:%d: PtlNIInit failed: %d\n",
 365                             __FILE__, __LINE__, ret);
 366         goto error;
 367     }
 368 
 369     if (actual_limits.max_msg_size < ompi_mtl_portals4.max_msg_size_mtl)
 370         ompi_mtl_portals4.max_msg_size_mtl = actual_limits.max_msg_size;
 371     OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_framework.framework_output,
 372         "Due to portals4 and user configuration messages will not go over the size of %lu", ompi_mtl_portals4.max_msg_size_mtl));
 373 
 374     if (ompi_comm_rank(MPI_COMM_WORLD) == 0) {
 375         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_entries=%d", actual_limits.max_entries);
 376         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_unexpected_headers=%d", actual_limits.max_unexpected_headers);
 377         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_mds=%d", actual_limits.max_mds);
 378         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_eqs=%d", actual_limits.max_eqs);
 379         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_cts=%d", actual_limits.max_cts);
 380         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_pt_index=%d", actual_limits.max_pt_index);
 381         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_iovecs=%d", actual_limits.max_iovecs);
 382         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_list_size=%d", actual_limits.max_list_size);
 383         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_triggered_ops=%d", actual_limits.max_triggered_ops);
 384         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_msg_size=%ld", actual_limits.max_msg_size);
 385         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_atomic_size=%ld", actual_limits.max_atomic_size);
 386         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_fetch_atomic_size=%ld", actual_limits.max_fetch_atomic_size);
 387         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_waw_ordered_size=%ld", actual_limits.max_waw_ordered_size);
 388         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_war_ordered_size=%ld", actual_limits.max_war_ordered_size);
 389         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "max_volatile_size=%ld", actual_limits.max_volatile_size);
 390         opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "features=%u", actual_limits.features);
 391     }
 392 
 393     ret = PtlGetUid(ompi_mtl_portals4.ni_h, &ompi_mtl_portals4.uid);
 394     if (PTL_OK != ret) {
 395         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 396                             "%s:%d: PtlGetUid failed: %d\n",
 397                             __FILE__, __LINE__, ret);
 398         goto error;
 399     }
 400 
 401     /* Publish our NID/PID in the modex */
 402     ret = PtlGetPhysId(ompi_mtl_portals4.ni_h, &id);
 403     if (PTL_OK != ret) {
 404         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 405                             "%s:%d: PtlGetPhysId failed: %d\n",
 406                             __FILE__, __LINE__, ret);
 407         goto error;
 408     }
 409 
 410     ompi_mtl_portals4.ptl_process_id = id;
 411     OPAL_OUTPUT_VERBOSE((90, ompi_mtl_base_framework.framework_output,
 412         "PtlGetPhysId rank=%x nid=%x pid=%x\n", id.rank, id.phys.nid, id.phys.pid));
 413 
 414     OPAL_MODEX_SEND(ret, OPAL_PMIX_GLOBAL,
 415                     &mca_mtl_portals4_component.mtl_version,
 416                     &id, sizeof(id));
 417     if (OMPI_SUCCESS != ret) {
 418         opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 419                             "%s:%d: ompi_modex_send failed: %d\n",
 420                             __FILE__, __LINE__, ret);
 421         goto error;
 422     }
 423 
 424     OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output,
 425                          "My nid,pid = %x,%x",
 426                          id.phys.nid, id.phys.pid));
 427 
 428     ompi_mtl_portals4.base.mtl_max_tag = MTL_PORTALS4_MAX_TAG;
 429     return &ompi_mtl_portals4.base;
 430 
 431  error:
 432     return NULL;
 433 }
 434 
 435 
 436 int
 437 ompi_mtl_portals4_get_error(int ptl_error)
 438 {
 439     int ret;
 440 
 441     switch (ptl_error) {
 442     case PTL_OK:
 443         ret = OMPI_SUCCESS;
 444         break;
 445     case PTL_ARG_INVALID:
 446         ret = OMPI_ERR_BAD_PARAM;
 447         break;
 448     case PTL_CT_NONE_REACHED:
 449         ret = OMPI_ERR_TIMEOUT;
 450         break;
 451     case PTL_EQ_DROPPED:
 452         ret = OMPI_ERR_OUT_OF_RESOURCE;
 453         break;
 454     case PTL_EQ_EMPTY:
 455         ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE;
 456         break;
 457     case PTL_FAIL:
 458         ret = OMPI_ERROR;
 459         break;
 460     case PTL_IN_USE:
 461         ret = OMPI_ERR_RESOURCE_BUSY;
 462         break;
 463     case PTL_INTERRUPTED:
 464         ret = OMPI_ERR_RESOURCE_BUSY;
 465         break;
 466     case PTL_LIST_TOO_LONG:
 467         ret = OMPI_ERR_OUT_OF_RESOURCE;
 468         break;
 469     case PTL_NO_INIT:
 470         ret = OMPI_ERR_FATAL;
 471         break;
 472     case PTL_NO_SPACE:
 473         ret = OMPI_ERR_OUT_OF_RESOURCE;
 474         break;
 475     case PTL_PID_IN_USE:
 476         ret = OMPI_ERR_BAD_PARAM;
 477         break;
 478     case PTL_PT_FULL:
 479         ret = OMPI_ERR_OUT_OF_RESOURCE;
 480         break;
 481     case PTL_PT_EQ_NEEDED:
 482         ret = OMPI_ERR_FATAL;
 483         break;
 484     case PTL_PT_IN_USE:
 485         ret = OMPI_ERR_RESOURCE_BUSY;
 486         break;
 487     default:
 488         ret = OMPI_ERROR;
 489     }
 490 
 491     return ret;
 492 }
 493 
 494 
 495 int
 496 ompi_mtl_portals4_progress(void)
 497 {
 498     int count = 0, ret;
 499     unsigned int which;
 500     ptl_event_t ev;
 501     ompi_mtl_portals4_base_request_t *ptl_request;
 502     ompi_mtl_portals4_rndv_get_frag_t *rndv_get_frag;
 503 
 504     while (true) {
 505         ret = PtlEQPoll(ompi_mtl_portals4.eqs_h, 2, 0, &ev, &which);
 506         if (PTL_OK == ret) {
 507             OPAL_OUTPUT_VERBOSE((60, ompi_mtl_base_framework.framework_output,
 508                                  "Found event of type %d\n", ev.type));
 509             count++;
 510             switch (ev.type) {
 511             case PTL_EVENT_GET:
 512             case PTL_EVENT_PUT:
 513             case PTL_EVENT_PUT_OVERFLOW:
 514             case PTL_EVENT_SEND:
 515             case PTL_EVENT_ACK:
 516             case PTL_EVENT_AUTO_FREE:
 517             case PTL_EVENT_AUTO_UNLINK:
 518             case PTL_EVENT_SEARCH:
 519             case PTL_EVENT_LINK:
 520                 if (NULL != ev.user_ptr) {
 521                     ptl_request = ev.user_ptr;
 522                     ret = ptl_request->event_callback(&ev, ptl_request);
 523                     if (OMPI_SUCCESS != ret) {
 524                         opal_output(ompi_mtl_base_framework.framework_output,
 525                                     "Error returned from target event callback: %d", ret);
 526                         abort();
 527                     }
 528                 }
 529                 break;
 530 
 531             case PTL_EVENT_REPLY:
 532                 if (NULL != ev.user_ptr) {
 533                     rndv_get_frag = ev.user_ptr;
 534                     ret = rndv_get_frag->event_callback(&ev, rndv_get_frag);
 535                     if (OMPI_SUCCESS != ret) {
 536                         opal_output(ompi_mtl_base_framework.framework_output,
 537                                     "Error returned from target event callback: %d", ret);
 538                         abort();
 539                     }
 540                 }
 541                 break;
 542 
 543             case PTL_EVENT_PT_DISABLED:
 544 #if OMPI_MTL_PORTALS4_FLOW_CONTROL
 545                 OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_framework.framework_output,
 546                                      "Received PT_DISABLED event on pt %d\n",
 547                                      (int) ev.pt_index));
 548                 ret = ompi_mtl_portals4_flowctl_trigger();
 549                 if (OMPI_SUCCESS != ret) {
 550                     opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
 551                                         "%s:%d: flowctl_trigger() failed: %d\n",
 552                                         __FILE__, __LINE__, ret);
 553                     abort();
 554                 }
 555 #else
 556                 opal_output(ompi_mtl_base_framework.framework_output,
 557                             "Flow control situation without recovery (PT_DISABLED)");
 558                 abort();
 559 #endif
 560                 break;
 561 
 562             case PTL_EVENT_GET_OVERFLOW:
 563             case PTL_EVENT_FETCH_ATOMIC:
 564             case PTL_EVENT_FETCH_ATOMIC_OVERFLOW:
 565             case PTL_EVENT_ATOMIC:
 566             case PTL_EVENT_ATOMIC_OVERFLOW:
 567                 opal_output(ompi_mtl_base_framework.framework_output,
 568                             "Unexpected event of type %d", ev.type);
 569             }
 570         } else if (PTL_EQ_EMPTY == ret) {
 571             break;
 572         } else if (PTL_EQ_DROPPED == ret) {
 573             opal_output(ompi_mtl_base_framework.framework_output,
 574                         "Flow control situation without recovery (EQ_DROPPED): %d",
 575                         which);
 576             abort();
 577         } else {
 578             opal_output(ompi_mtl_base_framework.framework_output,
 579                         "Error returned from PtlEQGet: %d", ret);
 580             break;
 581         }
 582     }
 583 
 584 #if OMPI_MTL_PORTALS4_FLOW_CONTROL
 585     if (OPAL_UNLIKELY(0 == count &&
 586                       0 != opal_list_get_size(&ompi_mtl_portals4.flowctl.pending_sends))) {
 587         ompi_mtl_portals4_pending_list_progress();
 588     }
 589 #endif
 590 
 591     return count;
 592 }
 593 

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