root/ompi/mca/pml/cm/pml_cm_start.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_cm_start

   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-2006 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2016      Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #include "ompi_config.h"
  24 
  25 #include "ompi/mca/pml/base/pml_base_request.h"
  26 #include "ompi/mca/pml/base/pml_base_sendreq.h"
  27 #include "ompi/mca/pml/base/pml_base_recvreq.h"
  28 
  29 #include "pml_cm.h"
  30 #include "pml_cm_sendreq.h"
  31 #include "pml_cm_recvreq.h"
  32 
  33 
  34 int
  35 mca_pml_cm_start(size_t count, ompi_request_t** requests)
  36 {
  37     int rc;
  38 
  39     for (size_t i = 0 ; i < count ; i++) {
  40         mca_pml_cm_request_t *pml_request = (mca_pml_cm_request_t*)requests[i];
  41         if (OMPI_REQUEST_PML != requests[i]->req_type || NULL == pml_request) {
  42             continue;
  43         }
  44 
  45         /* start the request */
  46         switch (pml_request->req_pml_type) {
  47         case MCA_PML_CM_REQUEST_SEND_HEAVY:
  48             {
  49                 mca_pml_cm_hvy_send_request_t* sendreq =
  50                     (mca_pml_cm_hvy_send_request_t*)pml_request;
  51                 if (!sendreq->req_send.req_base.req_pml_complete) {
  52                     ompi_request_t *request;
  53 
  54                     /* buffered sends can be mpi complete and pml incomplete. to support this
  55                      * case we need to allocate a new request. */
  56                     rc = mca_pml_cm_isend_init (sendreq->req_addr,
  57                                                 sendreq->req_count,
  58                                                 sendreq->req_send.req_base.req_datatype,
  59                                                 sendreq->req_peer,
  60                                                 sendreq->req_tag,
  61                                                 sendreq->req_send.req_send_mode,
  62                                                 sendreq->req_send.req_base.req_comm,
  63                                                 &request);
  64                     if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
  65                         return rc;
  66                     }
  67 
  68                     /* copy the callback and callback data to the new requests */
  69                     request->req_complete_cb = pml_request->req_ompi.req_complete_cb;
  70                     request->req_complete_cb_data = pml_request->req_ompi.req_complete_cb_data;
  71 
  72                     /* ensure the old request gets released */
  73                     pml_request->req_free_called = true;
  74 
  75                     sendreq = (mca_pml_cm_hvy_send_request_t *) request;
  76                     requests[i] = request;
  77                 }
  78 
  79                 /* reset the completion flag */
  80                 sendreq->req_send.req_base.req_pml_complete = false;
  81 
  82                 MCA_PML_CM_HVY_SEND_REQUEST_START(sendreq, rc);
  83                 if(rc != OMPI_SUCCESS)
  84                     return rc;
  85                 break;
  86             }
  87         case MCA_PML_CM_REQUEST_RECV_HEAVY:
  88             {
  89                 mca_pml_cm_hvy_recv_request_t* recvreq =
  90                     (mca_pml_cm_hvy_recv_request_t*)pml_request;
  91                 MCA_PML_CM_HVY_RECV_REQUEST_START(recvreq, rc);
  92                 if(rc != OMPI_SUCCESS)
  93                     return rc;
  94                 break;
  95             }
  96         default:
  97             return OMPI_ERR_REQUEST;
  98         }
  99     }
 100     return OMPI_SUCCESS;
 101 }

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