2005-05-24 02:06:50 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2013-07-04 12:34:37 +04:00
|
|
|
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-05-24 02:06:50 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-06-12 20:25:26 +04:00
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2012-10-04 18:39:51 +04:00
|
|
|
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
|
2012-02-06 21:35:21 +04:00
|
|
|
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
2005-05-24 02:06:50 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/request/request.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1_recvreq.h"
|
2012-02-06 21:35:21 +04:00
|
|
|
#include "pml_ob1_recvfrag.h"
|
2006-03-31 21:09:09 +04:00
|
|
|
#include "ompi/peruse/peruse-internal.h"
|
2012-02-06 21:35:21 +04:00
|
|
|
#include "ompi/message/message.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
int mca_pml_ob1_irecv_init(void *addr,
|
|
|
|
size_t count,
|
|
|
|
ompi_datatype_t * datatype,
|
|
|
|
int src,
|
|
|
|
int tag,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
struct ompi_request_t **request)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_request_t *recvreq;
|
2013-07-04 12:34:37 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
|
2005-05-24 02:06:50 +04:00
|
|
|
if (NULL == recvreq)
|
2013-07-04 12:34:37 +04:00
|
|
|
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq,
|
2005-05-24 02:06:50 +04:00
|
|
|
addr,
|
|
|
|
count, datatype, src, tag, comm, true);
|
2008-05-05 17:57:27 +04:00
|
|
|
|
2007-08-23 09:52:33 +04:00
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
|
|
|
|
&((recvreq)->req_recv.req_base),
|
|
|
|
PERUSE_RECV);
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
*request = (ompi_request_t *) recvreq;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_pml_ob1_irecv(void *addr,
|
|
|
|
size_t count,
|
|
|
|
ompi_datatype_t * datatype,
|
|
|
|
int src,
|
|
|
|
int tag,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
struct ompi_request_t **request)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_request_t *recvreq;
|
2013-07-04 12:34:37 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
|
2005-05-24 02:06:50 +04:00
|
|
|
if (NULL == recvreq)
|
2013-07-04 12:34:37 +04:00
|
|
|
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq,
|
2005-05-24 02:06:50 +04:00
|
|
|
addr,
|
|
|
|
count, datatype, src, tag, comm, false);
|
|
|
|
|
2007-08-23 09:52:33 +04:00
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
|
|
|
|
&((recvreq)->req_recv.req_base),
|
|
|
|
PERUSE_RECV);
|
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_START(recvreq);
|
2005-05-24 02:06:50 +04:00
|
|
|
*request = (ompi_request_t *) recvreq;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int mca_pml_ob1_recv(void *addr,
|
|
|
|
size_t count,
|
|
|
|
ompi_datatype_t * datatype,
|
|
|
|
int src,
|
|
|
|
int tag,
|
|
|
|
struct ompi_communicator_t *comm,
|
|
|
|
ompi_status_public_t * status)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
mca_pml_ob1_recv_request_t *recvreq;
|
2013-07-04 12:34:37 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
|
2005-05-24 02:06:50 +04:00
|
|
|
if (NULL == recvreq)
|
2013-07-04 12:34:37 +04:00
|
|
|
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq,
|
2005-05-24 02:06:50 +04:00
|
|
|
addr,
|
|
|
|
count, datatype, src, tag, comm, false);
|
|
|
|
|
2007-08-23 09:52:33 +04:00
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
|
|
|
|
&((recvreq)->req_recv.req_base),
|
|
|
|
PERUSE_RECV);
|
|
|
|
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_START(recvreq);
|
2007-10-18 16:33:21 +04:00
|
|
|
ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi);
|
2006-03-02 03:39:07 +03:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
if (NULL != status) { /* return status */
|
2012-10-04 18:39:51 +04:00
|
|
|
*status = recvreq->req_recv.req_base.req_ompi.req_status;
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
|
2006-03-16 01:53:41 +03:00
|
|
|
ompi_request_free( (ompi_request_t**)&recvreq );
|
2005-05-24 02:06:50 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2012-02-06 21:35:21 +04:00
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_ob1_imrecv( void *buf,
|
|
|
|
size_t count,
|
|
|
|
ompi_datatype_t *datatype,
|
|
|
|
struct ompi_message_t **message,
|
|
|
|
struct ompi_request_t **request )
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_frag_t* frag;
|
|
|
|
mca_pml_ob1_recv_request_t *recvreq;
|
|
|
|
mca_pml_ob1_hdr_t *hdr;
|
|
|
|
int src, tag;
|
|
|
|
ompi_communicator_t *comm;
|
|
|
|
mca_pml_ob1_comm_proc_t* proc;
|
|
|
|
mca_pml_ob1_comm_t* ob1_comm;
|
|
|
|
uint64_t seq;
|
|
|
|
|
|
|
|
/* get the request from the message and the frag from the request
|
|
|
|
before we overwrite everything */
|
|
|
|
recvreq = (mca_pml_ob1_recv_request_t*) (*message)->req_ptr;
|
|
|
|
frag = (mca_pml_ob1_recv_frag_t*) recvreq->req_recv.req_base.req_addr;
|
|
|
|
src = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
|
|
|
|
tag = recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG;
|
|
|
|
comm = (*message)->comm;
|
|
|
|
ob1_comm = recvreq->req_recv.req_base.req_comm->c_pml_comm;
|
|
|
|
seq = recvreq->req_recv.req_base.req_sequence;
|
|
|
|
|
|
|
|
/* make the request a recv request again */
|
2013-03-08 01:55:22 +04:00
|
|
|
/* The old request kept pointers to comm and the char datatype.
|
|
|
|
We're about to release those, but need to make sure comm
|
|
|
|
doesn't go out of scope (we don't care about the char datatype
|
|
|
|
anymore). So retain comm, then release the frag, then reinit
|
|
|
|
the frag (which will retain comm), then release comm (but the
|
|
|
|
frag still has it's ref, so it'll stay in scope). Make
|
|
|
|
sense? */
|
|
|
|
OBJ_RETAIN(comm);
|
|
|
|
MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq->req_recv);
|
2012-02-06 21:35:21 +04:00
|
|
|
recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_RECV;
|
|
|
|
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq,
|
|
|
|
buf,
|
|
|
|
count, datatype,
|
|
|
|
src, tag, comm, false);
|
2013-03-08 01:55:22 +04:00
|
|
|
OBJ_RELEASE(comm);
|
2012-02-06 21:35:21 +04:00
|
|
|
|
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
|
|
|
|
&((recvreq)->req_recv.req_base),
|
|
|
|
PERUSE_RECV);
|
|
|
|
|
|
|
|
/* init/re-init the request */
|
|
|
|
recvreq->req_lock = 0;
|
|
|
|
recvreq->req_pipeline_depth = 0;
|
|
|
|
recvreq->req_bytes_received = 0;
|
|
|
|
/* What about req_rdma_cnt ? */
|
|
|
|
recvreq->req_rdma_idx = 0;
|
|
|
|
recvreq->req_pending = false;
|
|
|
|
recvreq->req_ack_sent = false;
|
|
|
|
|
|
|
|
MCA_PML_BASE_RECV_START(&recvreq->req_recv.req_base);
|
|
|
|
|
|
|
|
/* Note - sequence number already assigned */
|
|
|
|
recvreq->req_recv.req_base.req_sequence = seq;
|
|
|
|
|
|
|
|
proc = &ob1_comm->procs[recvreq->req_recv.req_base.req_peer];
|
|
|
|
recvreq->req_recv.req_base.req_proc = proc->ompi_proc;
|
|
|
|
prepare_recv_req_converter(recvreq);
|
|
|
|
|
2013-03-08 01:55:22 +04:00
|
|
|
/* we can't go through the match, since we already have the match.
|
2012-02-06 21:35:21 +04:00
|
|
|
Cheat and do what REQUEST_START does, but without the frag
|
|
|
|
search */
|
|
|
|
hdr = (mca_pml_ob1_hdr_t*)frag->segments->seg_addr.pval;
|
|
|
|
switch(hdr->hdr_common.hdr_type) {
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_MATCH:
|
|
|
|
mca_pml_ob1_recv_request_progress_match(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_RNDV:
|
|
|
|
mca_pml_ob1_recv_request_progress_rndv(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_RGET:
|
|
|
|
mca_pml_ob1_recv_request_progress_rget(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
|
|
|
|
|
|
|
|
ompi_message_return(*message);
|
|
|
|
*message = MPI_MESSAGE_NULL;
|
|
|
|
*request = (ompi_request_t *) recvreq;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
mca_pml_ob1_mrecv( void *buf,
|
|
|
|
size_t count,
|
|
|
|
ompi_datatype_t *datatype,
|
|
|
|
struct ompi_message_t **message,
|
|
|
|
ompi_status_public_t* status )
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_frag_t* frag;
|
|
|
|
mca_pml_ob1_recv_request_t *recvreq;
|
|
|
|
mca_pml_ob1_hdr_t *hdr;
|
|
|
|
int src, tag, rc;
|
|
|
|
ompi_communicator_t *comm;
|
|
|
|
mca_pml_ob1_comm_proc_t* proc;
|
|
|
|
mca_pml_ob1_comm_t* ob1_comm;
|
|
|
|
uint64_t seq;
|
|
|
|
|
|
|
|
/* get the request from the message and the frag from the request
|
|
|
|
before we overwrite everything */
|
|
|
|
comm = (*message)->comm;
|
|
|
|
recvreq = (mca_pml_ob1_recv_request_t*) (*message)->req_ptr;
|
|
|
|
frag = (mca_pml_ob1_recv_frag_t*) recvreq->req_recv.req_base.req_addr;
|
|
|
|
src = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE;
|
|
|
|
tag = recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG;
|
|
|
|
seq = recvreq->req_recv.req_base.req_sequence;
|
|
|
|
ob1_comm = recvreq->req_recv.req_base.req_comm->c_pml_comm;
|
|
|
|
|
|
|
|
/* make the request a recv request again */
|
2013-03-08 01:55:22 +04:00
|
|
|
/* The old request kept pointers to comm and the char datatype.
|
|
|
|
We're about to release those, but need to make sure comm
|
|
|
|
doesn't go out of scope (we don't care about the char datatype
|
|
|
|
anymore). So retain comm, then release the frag, then reinit
|
|
|
|
the frag (which will retain comm), then release comm (but the
|
|
|
|
frag still has it's ref, so it'll stay in scope). Make
|
|
|
|
sense? */
|
|
|
|
OBJ_RETAIN(comm);
|
|
|
|
MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq->req_recv);
|
2012-02-06 21:35:21 +04:00
|
|
|
recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_RECV;
|
|
|
|
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq,
|
|
|
|
buf,
|
|
|
|
count, datatype,
|
|
|
|
src, tag, comm, false);
|
2013-03-08 01:55:22 +04:00
|
|
|
OBJ_RELEASE(comm);
|
2012-02-06 21:35:21 +04:00
|
|
|
|
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
|
|
|
|
&((recvreq)->req_recv.req_base),
|
|
|
|
PERUSE_RECV);
|
|
|
|
|
|
|
|
/* init/re-init the request */
|
|
|
|
recvreq->req_lock = 0;
|
|
|
|
recvreq->req_pipeline_depth = 0;
|
|
|
|
recvreq->req_bytes_received = 0;
|
|
|
|
recvreq->req_rdma_cnt = 0;
|
|
|
|
recvreq->req_rdma_idx = 0;
|
|
|
|
recvreq->req_pending = false;
|
|
|
|
|
|
|
|
MCA_PML_BASE_RECV_START(&recvreq->req_recv.req_base);
|
|
|
|
|
|
|
|
/* Note - sequence number already assigned */
|
|
|
|
recvreq->req_recv.req_base.req_sequence = seq;
|
|
|
|
|
|
|
|
proc = &ob1_comm->procs[recvreq->req_recv.req_base.req_peer];
|
|
|
|
recvreq->req_recv.req_base.req_proc = proc->ompi_proc;
|
|
|
|
prepare_recv_req_converter(recvreq);
|
|
|
|
|
2013-03-08 01:55:22 +04:00
|
|
|
/* we can't go through the match, since we already have the match.
|
2012-02-06 21:35:21 +04:00
|
|
|
Cheat and do what REQUEST_START does, but without the frag
|
|
|
|
search */
|
|
|
|
hdr = (mca_pml_ob1_hdr_t*)frag->segments->seg_addr.pval;
|
|
|
|
switch(hdr->hdr_common.hdr_type) {
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_MATCH:
|
|
|
|
mca_pml_ob1_recv_request_progress_match(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_RNDV:
|
|
|
|
mca_pml_ob1_recv_request_progress_rndv(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_RGET:
|
|
|
|
mca_pml_ob1_recv_request_progress_rget(recvreq, frag->btl, frag->segments,
|
|
|
|
frag->num_segments);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_message_return(*message);
|
|
|
|
*message = MPI_MESSAGE_NULL;
|
|
|
|
ompi_request_wait_completion(&(recvreq->req_recv.req_base.req_ompi));
|
|
|
|
|
|
|
|
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
|
|
|
|
|
|
|
|
if (NULL != status) { /* return status */
|
|
|
|
*status = recvreq->req_recv.req_base.req_ompi.req_status;
|
|
|
|
}
|
|
|
|
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
|
|
|
|
ompi_request_free( (ompi_request_t**)&recvreq );
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|