Exemplo n.º 1
0
int
mca_pml_ob1_mprobe(int src,
                   int tag,
                   struct ompi_communicator_t *comm,
                   struct ompi_message_t **message,
                   ompi_status_public_t * status)
{
    int rc = OMPI_SUCCESS;
    mca_pml_ob1_recv_request_t *recvreq;

    MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq, rc);
    if (NULL == recvreq)
        return rc;
    recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_MPROBE;

    /* initialize the request enough to probe and get the status */
    MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt, 
                                  src, tag, comm, false);
    MCA_PML_OB1_RECV_REQUEST_START(recvreq);

    ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi);

    if( NULL != status ) {
        *status = recvreq->req_recv.req_base.req_ompi.req_status;
    }

    *message = ompi_message_alloc();
    (*message)->comm = comm;
    (*message)->req_ptr = recvreq;
    (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount;

    return OMPI_SUCCESS;
}
Exemplo n.º 2
0
int
ompi_mtl_psm2_improbe(struct mca_mtl_base_module_t *mtl,
                     struct ompi_communicator_t *comm,
                     int src,
                     int tag,
                     int *matched,
                     struct ompi_message_t **message,
                     struct ompi_status_public_t *status)
{
    struct ompi_message_t* msg;
    psm2_mq_tag_t mqtag, tagsel;
    psm2_mq_status2_t mqstat;
    psm2_mq_req_t mqreq;
    psm2_error_t err;

    PSM2_MAKE_TAGSEL(src, tag, comm->c_contextid, mqtag, tagsel);

    err = psm2_mq_improbe2(ompi_mtl_psm2.mq,
            PSM2_MQ_ANY_ADDR, &mqtag, &tagsel, &mqreq, &mqstat);
    if (err == PSM2_OK) {

	if(MPI_STATUS_IGNORE != status) {
            status->MPI_SOURCE = mqstat.msg_tag.tag1;
            status->MPI_TAG = mqstat.msg_tag.tag0;
            status->_ucount = mqstat.nbytes;

            switch (mqstat.error_code) {
	    case PSM2_OK:
		status->MPI_ERROR = OMPI_SUCCESS;
		break;
	    case PSM2_MQ_TRUNCATION:
		status->MPI_ERROR = MPI_ERR_TRUNCATE;
		break;
	    default:
		status->MPI_ERROR = MPI_ERR_INTERN;
            }
        }

	msg = ompi_message_alloc();
	if(NULL == msg) {
	    return OMPI_ERR_OUT_OF_RESOURCE;
	}

	msg->comm = comm;
	msg->req_ptr = mqreq;
	msg->peer = mqstat.msg_tag.tag1;
	msg->count = mqstat.nbytes;

	*message = msg;
	*matched = 1;
	return OMPI_SUCCESS;
    } else if(err == PSM2_MQ_INCOMPLETE) {
	*matched = 0;
	*message = MPI_MESSAGE_NULL;
	return OMPI_SUCCESS;
    } else {
	return OMPI_ERROR;
    }
}
Exemplo n.º 3
0
int
mca_pml_ob1_improbe(int src,
                    int tag,
                    struct ompi_communicator_t *comm,
                    int *matched, 
                    struct ompi_message_t **message,
                    ompi_status_public_t * status)
{
    int rc = OMPI_SUCCESS;
    mca_pml_ob1_recv_request_t *recvreq;

    MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq, rc);
    if (NULL == recvreq)
        return rc;
    recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_IMPROBE;

    /* initialize the request enough to probe and get the status */
    MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt, 
                                  src, tag, comm, false);
    MCA_PML_OB1_RECV_REQUEST_START(recvreq);

    if( recvreq->req_recv.req_base.req_ompi.req_complete == true ) {
        if( NULL != status ) {
            *status = recvreq->req_recv.req_base.req_ompi.req_status;
        }
        *matched = 1;

        *message = ompi_message_alloc();
        (*message)->comm = comm;
        (*message)->req_ptr = recvreq;
        (*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
        (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount;

        rc = OMPI_SUCCESS;
    } else {
        *matched = 0;

        /* we only free if we didn't match, because we're going to
           translate the request into a receive request later on if it
           was matched */
        ompi_request_free((ompi_request_t**)&recvreq);
        
        opal_progress();
    }

    return rc;
}