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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_ob1_iprobe
  2. mca_pml_ob1_probe
  3. mca_pml_ob1_improbe
  4. mca_pml_ob1_mprobe

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2016 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2009-2012 Oracle and/or its affiliates.  All rights reserved.
  13  * Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  */
  20 
  21 #include "ompi_config.h"
  22 #include "ompi/request/request.h"
  23 #include "ompi/message/message.h"
  24 #include "pml_ob1_recvreq.h"
  25 
  26 
  27 int mca_pml_ob1_iprobe(int src,
  28                        int tag,
  29                        struct ompi_communicator_t *comm,
  30                        int *matched, ompi_status_public_t * status)
  31 {
  32     int rc = OMPI_SUCCESS;
  33     mca_pml_ob1_recv_request_t recvreq;
  34 
  35     OBJ_CONSTRUCT( &recvreq, mca_pml_ob1_recv_request_t );
  36     recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML;
  37     recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_IPROBE;
  38 
  39     MCA_PML_OB1_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char.dt, src, tag, comm, false);
  40     MCA_PML_OB1_RECV_REQUEST_START(&recvreq);
  41 
  42     if( REQUEST_COMPLETE( &(recvreq.req_recv.req_base.req_ompi)) ) {
  43         if( NULL != status ) {
  44             *status = recvreq.req_recv.req_base.req_ompi.req_status;
  45         }
  46         rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR;
  47         *matched = 1;
  48     } else {
  49         *matched = 0;
  50         opal_progress();
  51     }
  52     MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv );
  53     return rc;
  54 }
  55 
  56 
  57 int mca_pml_ob1_probe(int src,
  58                       int tag,
  59                       struct ompi_communicator_t *comm,
  60                       ompi_status_public_t * status)
  61 {
  62     int rc = OMPI_SUCCESS;
  63     mca_pml_ob1_recv_request_t recvreq;
  64 
  65     OBJ_CONSTRUCT( &recvreq, mca_pml_ob1_recv_request_t );
  66     recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML;
  67     recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_PROBE;
  68 
  69     MCA_PML_OB1_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char.dt, src, tag, comm, false);
  70     MCA_PML_OB1_RECV_REQUEST_START(&recvreq);
  71 
  72     ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi);
  73     rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR;
  74     if (NULL != status) {
  75         *status = recvreq.req_recv.req_base.req_ompi.req_status;
  76     }
  77 
  78     MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv );
  79     return rc;
  80 }
  81 
  82 
  83 int
  84 mca_pml_ob1_improbe(int src,
  85                     int tag,
  86                     struct ompi_communicator_t *comm,
  87                     int *matched,
  88                     struct ompi_message_t **message,
  89                     ompi_status_public_t * status)
  90 {
  91     int rc = OMPI_SUCCESS;
  92     mca_pml_ob1_recv_request_t *recvreq;
  93 
  94     *message = ompi_message_alloc();
  95     if (NULL == *message) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
  96 
  97     MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
  98     if (NULL == recvreq) {
  99         ompi_message_return(*message);
 100         return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
 101     }
 102     recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_IMPROBE;
 103 
 104     /* initialize the request enough to probe and get the status */
 105     MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt,
 106                                   src, tag, comm, false);
 107     MCA_PML_OB1_RECV_REQUEST_START(recvreq);
 108 
 109     if( REQUEST_COMPLETE( &(recvreq->req_recv.req_base.req_ompi)) ) {
 110         if( NULL != status ) {
 111             *status = recvreq->req_recv.req_base.req_ompi.req_status;
 112         }
 113         *matched = 1;
 114 
 115         (*message)->comm = comm;
 116         (*message)->req_ptr = recvreq;
 117         (*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
 118         (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount;
 119 
 120         rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
 121     } else {
 122         *matched = 0;
 123 
 124         /* we only free if we didn't match, because we're going to
 125            translate the request into a receive request later on if it
 126            was matched */
 127         MCA_PML_OB1_RECV_REQUEST_RETURN( recvreq );
 128         ompi_message_return(*message);
 129         *message = MPI_MESSAGE_NULL;
 130 
 131         opal_progress();
 132     }
 133 
 134     return rc;
 135 }
 136 
 137 
 138 int
 139 mca_pml_ob1_mprobe(int src,
 140                    int tag,
 141                    struct ompi_communicator_t *comm,
 142                    struct ompi_message_t **message,
 143                    ompi_status_public_t * status)
 144 {
 145     int rc = OMPI_SUCCESS;
 146     mca_pml_ob1_recv_request_t *recvreq;
 147 
 148     *message = ompi_message_alloc();
 149     if (NULL == *message) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
 150 
 151     MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
 152     if (NULL == recvreq) {
 153         ompi_message_return(*message);
 154         return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
 155     }
 156     recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_MPROBE;
 157 
 158     /* initialize the request enough to probe and get the status */
 159     MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt,
 160                                   src, tag, comm, false);
 161     MCA_PML_OB1_RECV_REQUEST_START(recvreq);
 162 
 163     ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi);
 164     rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
 165 
 166     if( NULL != status ) {
 167         *status = recvreq->req_recv.req_base.req_ompi.req_status;
 168     }
 169 
 170     (*message)->comm = comm;
 171     (*message)->req_ptr = recvreq;
 172     (*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
 173     (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount;
 174 
 175     return rc;
 176 }

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