root/ompi/mca/pml/ob1/pml_ob1_start.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_ob1_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-2016 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2008 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) 2006      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2010      Oracle and/or its affiliates.  All rights reserved.
  15  * Copyright (c) 2016-2018 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 "pml_ob1.h"
  27 #include "pml_ob1_recvreq.h"
  28 #include "pml_ob1_sendreq.h"
  29 #include "ompi/memchecker.h"
  30 
  31 
  32 int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
  33 {
  34     int rc;
  35 
  36     for (size_t i = 0 ; i < count ; ++i) {
  37         mca_pml_base_request_t *pml_request = (mca_pml_base_request_t*)requests[i];
  38         if (NULL == pml_request || OMPI_REQUEST_PML != requests[i]->req_type) {
  39             continue;
  40         }
  41 
  42         /* If the persistent request is currently active - verify the status
  43          * is incomplete. if the pml layer has not completed the request - mark
  44          * the request as free called - so that it will be freed when the request
  45          * completes - and create a new request.
  46          */
  47 
  48         opal_atomic_rmb();
  49 
  50         /* start the request */
  51         switch(pml_request->req_type) {
  52             case MCA_PML_REQUEST_SEND:
  53             {
  54                 mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)pml_request;
  55                 MEMCHECKER(
  56                     memchecker_call(&opal_memchecker_base_isdefined,
  57                                     pml_request->req_addr, pml_request->req_count,
  58                                     pml_request->req_datatype);
  59                 );
  60 
  61                 if (!pml_request->req_pml_complete) {
  62                     ompi_request_t *request;
  63 
  64                     /* buffered sends can be mpi complete and pml incomplete. to support this
  65                      * case we need to allocate a new request. */
  66                     rc = mca_pml_ob1_isend_init (pml_request->req_addr,
  67                                                  pml_request->req_count,
  68                                                  pml_request->req_datatype,
  69                                                  pml_request->req_peer,
  70                                                  pml_request->req_tag,
  71                                                  sendreq->req_send.req_send_mode,
  72                                                  pml_request->req_comm,
  73                                                  &request);
  74                     if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
  75                         return rc;
  76                     }
  77 
  78                     /* copy the callback and callback data to the new requests */
  79                     request->req_complete_cb = pml_request->req_ompi.req_complete_cb;
  80                     request->req_complete_cb_data = pml_request->req_ompi.req_complete_cb_data;
  81 
  82                     /* ensure the old request gets released */
  83                     pml_request->req_free_called = true;
  84 
  85                     sendreq = (mca_pml_ob1_send_request_t *) request;
  86                     requests[i] = request;
  87                 } else if (sendreq->req_send.req_bytes_packed != 0) {
  88                     size_t offset = 0;
  89                     /**
  90                      * Reset the convertor in case we're dealing with the original
  91                      * request, which when completed do not reset the convertor.
  92                      */
  93                     opal_convertor_set_position (&sendreq->req_send.req_base.req_convertor,
  94                                                  &offset);
  95                 }
  96 
  97                 /* reset the completion flag */
  98                 pml_request->req_pml_complete = false;
  99 
 100                 MCA_PML_OB1_SEND_REQUEST_START(sendreq, rc);
 101                 if(rc != OMPI_SUCCESS)
 102                     return rc;
 103                 break;
 104             }
 105             case MCA_PML_REQUEST_RECV:
 106             {
 107                 mca_pml_ob1_recv_request_t* recvreq = (mca_pml_ob1_recv_request_t*)pml_request;
 108                 MCA_PML_OB1_RECV_REQUEST_START(recvreq);
 109                 break;
 110             }
 111             default:
 112                 return OMPI_ERR_REQUEST;
 113         }
 114     }
 115     return OMPI_SUCCESS;
 116 }
 117 

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