Small cleanups. Remove some switch cases that cannot be reached. Rename
a struct field. This commit was SVN r18931.
Этот коммит содержится в:
родитель
319a8b3219
Коммит
939fa3001d
@ -97,11 +97,12 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl,
|
||||
/* communicator pointer */
|
||||
comm_ptr = ompi_comm_lookup(hdr->hdr_ctx);
|
||||
if(OPAL_UNLIKELY(NULL == comm_ptr)) {
|
||||
/* This is a special case. A message for a not yet existing communicator can
|
||||
* happens, but right now we segfault. Instead, and until we find a better
|
||||
* solution, just drop the message. However, in the near future we should
|
||||
* store this fragment in a global list, and deliver it to the right
|
||||
* communicator once it get created.
|
||||
/* This is a special case. A message for a not yet existing
|
||||
* communicator can happens, but right now we
|
||||
* segfault. Instead, and until we find a better solution,
|
||||
* just drop the message. However, in the near future we
|
||||
* should store this fragment in a global list, and deliver
|
||||
* it to the right communicator once it get created.
|
||||
*/
|
||||
opal_output( 0, "Dropped message for the non-existing communicator %d\n",
|
||||
(int)hdr->hdr_ctx );
|
||||
@ -112,11 +113,11 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl,
|
||||
/* source sequence number */
|
||||
proc = &comm->procs[hdr->hdr_src];
|
||||
|
||||
/**
|
||||
* We generate the MSG_ARRIVED event as soon as the PML is aware of a matching
|
||||
* fragment arrival. Independing if it is received on the correct order or not.
|
||||
* This will allow the tools to figure out if the messages are not received in the
|
||||
* correct order (if multiple network interfaces).
|
||||
/* We generate the MSG_ARRIVED event as soon as the PML is aware
|
||||
* of a matching fragment arrival. Independing if it is received
|
||||
* on the correct order or not. This will allow the tools to
|
||||
* figure out if the messages are not received in the correct
|
||||
* order (if multiple network interfaces).
|
||||
*/
|
||||
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm_ptr,
|
||||
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
|
||||
@ -137,29 +138,26 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl,
|
||||
goto slow_path;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the sequence number we were expecting,
|
||||
* so we can try matching it to already posted
|
||||
* receives.
|
||||
/* This is the sequence number we were expecting, so we can try
|
||||
* matching it to already posted receives.
|
||||
*/
|
||||
|
||||
/* We're now expecting the next sequence number. */
|
||||
proc->expected_sequence++;
|
||||
|
||||
/**
|
||||
* We generate the SEARCH_POSTED_QUEUE only when the message is received
|
||||
* in the correct sequence. Otherwise, we delay the event generation until
|
||||
* we reach the correct sequence number.
|
||||
/* We generate the SEARCH_POSTED_QUEUE only when the message is
|
||||
* received in the correct sequence. Otherwise, we delay the event
|
||||
* generation until we reach the correct sequence number.
|
||||
*/
|
||||
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_BEGIN, comm_ptr,
|
||||
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
|
||||
|
||||
match = match_one(btl, hdr, segment, num_segments, comm_ptr, proc, frag);
|
||||
|
||||
/**
|
||||
* The match is over. We generate the SEARCH_POSTED_Q_END here, before going
|
||||
* into the mca_pml_ob1_check_cantmatch_for_match so we can make a difference
|
||||
* for the searching time for all messages.
|
||||
/* The match is over. We generate the SEARCH_POSTED_Q_END here,
|
||||
* before going into the mca_pml_ob1_check_cantmatch_for_match so
|
||||
* we can make a difference for the searching time for all
|
||||
* messages.
|
||||
*/
|
||||
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_END, comm_ptr,
|
||||
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
|
||||
|
@ -552,7 +552,7 @@ void mca_pml_ob1_recv_request_progress_rndv( mca_pml_ob1_recv_request_t* recvreq
|
||||
|
||||
bytes_received -= sizeof(mca_pml_ob1_rendezvous_hdr_t);
|
||||
recvreq->req_recv.req_bytes_packed = hdr->hdr_rndv.hdr_msg_length;
|
||||
recvreq->req_send = hdr->hdr_rndv.hdr_src_req;
|
||||
recvreq->remote_req_send = hdr->hdr_rndv.hdr_src_req;
|
||||
recvreq->req_rdma_offset = bytes_received;
|
||||
MCA_PML_OB1_RECV_REQUEST_MATCHED(recvreq, &hdr->hdr_match);
|
||||
mca_pml_ob1_recv_request_ack(recvreq, &hdr->hdr_rndv, bytes_received);
|
||||
@ -591,7 +591,6 @@ void mca_pml_ob1_recv_request_progress_rndv( mca_pml_ob1_recv_request_t* recvreq
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the recv request status to reflect the number of bytes
|
||||
* received and actually delivered to the application.
|
||||
@ -602,9 +601,7 @@ void mca_pml_ob1_recv_request_progress_match( mca_pml_ob1_recv_request_t* recvre
|
||||
mca_btl_base_segment_t* segments,
|
||||
size_t num_segments )
|
||||
{
|
||||
size_t bytes_received = 0;
|
||||
size_t bytes_delivered = 0;
|
||||
size_t data_offset = 0;
|
||||
size_t bytes_received = 0, bytes_delivered = 0, data_offset = 0;
|
||||
mca_pml_ob1_hdr_t* hdr = (mca_pml_ob1_hdr_t*)segments->seg_addr.pval;
|
||||
bool complete;
|
||||
|
||||
@ -640,9 +637,12 @@ void mca_pml_ob1_recv_request_progress_match( mca_pml_ob1_recv_request_t* recvre
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
|
||||
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_bytes_received, bytes_received);
|
||||
complete = recv_request_pml_complete_check(recvreq);
|
||||
assert(complete);
|
||||
/*
|
||||
* No need for atomic here, as we know there is only one fragment
|
||||
* for this request.
|
||||
*/
|
||||
recvreq->req_bytes_received += bytes_received;
|
||||
recv_request_pml_complete(recvreq);
|
||||
}
|
||||
|
||||
|
||||
@ -793,7 +793,7 @@ int mca_pml_ob1_recv_request_schedule_once(
|
||||
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_PUT;
|
||||
hdr->hdr_common.hdr_flags =
|
||||
(!recvreq->req_ack_sent) ? MCA_PML_OB1_HDR_TYPE_ACK : 0;
|
||||
hdr->hdr_req = recvreq->req_send;
|
||||
hdr->hdr_req = recvreq->remote_req_send;
|
||||
hdr->hdr_des.pval = dst;
|
||||
hdr->hdr_rdma_offset = recvreq->req_rdma_offset;
|
||||
hdr->hdr_seg_cnt = dst->des_dst_cnt;
|
||||
@ -862,9 +862,9 @@ static inline void append_recv_req_to_queue(opal_list_t *queue,
|
||||
* it places the request in the appropriate matched receive list. This
|
||||
* function has to be called with the communicator matching lock held.
|
||||
*/
|
||||
static mca_pml_ob1_recv_frag_t *recv_req_match_specific_proc(
|
||||
const mca_pml_ob1_recv_request_t *req,
|
||||
mca_pml_ob1_comm_proc_t *proc)
|
||||
static mca_pml_ob1_recv_frag_t*
|
||||
recv_req_match_specific_proc( const mca_pml_ob1_recv_request_t *req,
|
||||
mca_pml_ob1_comm_proc_t *proc )
|
||||
{
|
||||
opal_list_t* unexpected_frags = &proc->unexpected_frags;
|
||||
opal_list_item_t *i;
|
||||
@ -874,15 +874,25 @@ static mca_pml_ob1_recv_frag_t *recv_req_match_specific_proc(
|
||||
if(opal_list_get_size(unexpected_frags) == 0)
|
||||
return NULL;
|
||||
|
||||
if( OMPI_ANY_TAG == tag ) {
|
||||
for (i = opal_list_get_first(unexpected_frags);
|
||||
i != opal_list_get_end(unexpected_frags);
|
||||
i = opal_list_get_next(i)) {
|
||||
frag = (mca_pml_ob1_recv_frag_t*)i;
|
||||
|
||||
if(frag->hdr.hdr_match.hdr_tag == tag ||
|
||||
(OMPI_ANY_TAG == tag && frag->hdr.hdr_match.hdr_tag >= 0))
|
||||
if( frag->hdr.hdr_match.hdr_tag >= 0 )
|
||||
return frag;
|
||||
}
|
||||
} else {
|
||||
for (i = opal_list_get_first(unexpected_frags);
|
||||
i != opal_list_get_end(unexpected_frags);
|
||||
i = opal_list_get_next(i)) {
|
||||
frag = (mca_pml_ob1_recv_frag_t*)i;
|
||||
|
||||
if( frag->hdr.hdr_match.hdr_tag == tag )
|
||||
return frag;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -891,14 +901,13 @@ static mca_pml_ob1_recv_frag_t *recv_req_match_specific_proc(
|
||||
* this routine is used to try and match a wild posted receive - where
|
||||
* wild is determined by the value assigned to the source process
|
||||
*/
|
||||
|
||||
static mca_pml_ob1_recv_frag_t *recv_req_match_wild(
|
||||
mca_pml_ob1_recv_request_t* req, mca_pml_ob1_comm_proc_t **p)
|
||||
static mca_pml_ob1_recv_frag_t*
|
||||
recv_req_match_wild( mca_pml_ob1_recv_request_t* req,
|
||||
mca_pml_ob1_comm_proc_t **p)
|
||||
{
|
||||
mca_pml_ob1_comm_t* comm = req->req_recv.req_base.req_comm->c_pml_comm;
|
||||
mca_pml_ob1_comm_proc_t* proc = comm->procs;
|
||||
size_t proc_count = comm->num_procs;
|
||||
size_t i;
|
||||
size_t proc_count = comm->num_procs, i;
|
||||
|
||||
/*
|
||||
* Loop over all the outstanding messages to find one that matches.
|
||||
@ -940,7 +949,6 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req)
|
||||
req->req_rdma_idx = 0;
|
||||
req->req_pending = false;
|
||||
req->req_ack_sent = false;
|
||||
req->req_match_received = false;
|
||||
|
||||
MCA_PML_BASE_RECV_START(&req->req_recv.req_base);
|
||||
|
||||
@ -955,7 +963,6 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req)
|
||||
/* assign sequence number */
|
||||
req->req_recv.req_base.req_sequence = comm->recv_sequence++;
|
||||
|
||||
|
||||
/* attempt to match posted recv */
|
||||
if(req->req_recv.req_base.req_peer == OMPI_ANY_SOURCE) {
|
||||
frag = recv_req_match_wild(req, &proc);
|
||||
@ -975,6 +982,7 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req)
|
||||
/* We didn't find any matches. Record this irecv so we can match
|
||||
it when the message comes in. */
|
||||
append_recv_req_to_queue(queue, req);
|
||||
req->req_match_received = false;
|
||||
OPAL_THREAD_UNLOCK(&comm->matching_lock);
|
||||
} else {
|
||||
if(OPAL_LIKELY(!IS_PROB_REQ(req))) {
|
||||
@ -1008,10 +1016,8 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req)
|
||||
mca_pml_ob1_recv_request_progress_rget(req, frag->btl, frag->segments,
|
||||
frag->num_segments);
|
||||
break;
|
||||
case MCA_PML_OB1_HDR_TYPE_FRAG:
|
||||
mca_pml_ob1_recv_request_progress_frag(req, frag->btl, frag->segments,
|
||||
frag->num_segments);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
|
||||
|
@ -35,7 +35,7 @@ BEGIN_C_DECLS
|
||||
|
||||
struct mca_pml_ob1_recv_request_t {
|
||||
mca_pml_base_recv_request_t req_recv;
|
||||
ompi_ptr_t req_send;
|
||||
ompi_ptr_t remote_req_send;
|
||||
int32_t req_lock;
|
||||
size_t req_pipeline_depth;
|
||||
size_t req_bytes_received; /**< amount of data transferred into the user buffer */
|
||||
@ -208,7 +208,7 @@ static inline void prepare_recv_req_converter(mca_pml_ob1_recv_request_t *req)
|
||||
ompi_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor,
|
||||
&req->req_bytes_delivered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MCA_PML_OB1_RECV_REQUEST_MATCHED(request, hdr) \
|
||||
recv_req_matched(request, hdr)
|
||||
@ -238,8 +238,7 @@ static inline void recv_req_matched(mca_pml_ob1_recv_request_t *req,
|
||||
*
|
||||
*/
|
||||
|
||||
#define MCA_PML_OB1_RECV_REQUEST_UNPACK( \
|
||||
request, \
|
||||
#define MCA_PML_OB1_RECV_REQUEST_UNPACK( request, \
|
||||
segments, \
|
||||
num_segments, \
|
||||
seg_offset, \
|
||||
@ -261,7 +260,8 @@ do {
|
||||
offset -= segment->seg_len; \
|
||||
} else { \
|
||||
iov[iov_count].iov_len = segment->seg_len - offset; \
|
||||
iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + offset); \
|
||||
iov[iov_count].iov_base = (IOVBASE_TYPE*) \
|
||||
((unsigned char*)segment->seg_addr.pval + offset); \
|
||||
iov_count++; \
|
||||
} \
|
||||
} \
|
||||
@ -280,52 +280,6 @@ do {
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
#define MCA_PML_OB1_RECV_REQUEST_UNPACK_ALL( \
|
||||
request, \
|
||||
segments, \
|
||||
num_segments, \
|
||||
seg_offset, \
|
||||
data_offset, \
|
||||
bytes_received, \
|
||||
bytes_delivered) \
|
||||
do { \
|
||||
bytes_delivered = 0; \
|
||||
if(request->req_recv.req_bytes_packed > 0) { \
|
||||
struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; \
|
||||
uint32_t iov_count = 0; \
|
||||
size_t max_data = bytes_received; \
|
||||
size_t n, offset = seg_offset; \
|
||||
mca_btl_base_segment_t* segment = segments; \
|
||||
\
|
||||
OPAL_THREAD_LOCK(&request->lock); \
|
||||
for( n = 0; n < num_segments; n++, segment++ ) { \
|
||||
if(offset >= segment->seg_len) { \
|
||||
offset -= segment->seg_len; \
|
||||
} else { \
|
||||
iov[iov_count].iov_len = segment->seg_len - offset; \
|
||||
iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + offset); \
|
||||
iov_count++; \
|
||||
} \
|
||||
} \
|
||||
PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \
|
||||
&(recvreq->req_recv.req_base), \
|
||||
bytes_received, \
|
||||
PERUSE_RECV); \
|
||||
ompi_convertor_set_position( &(request->req_recv.req_base.req_convertor), \
|
||||
&data_offset ); \
|
||||
ompi_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \
|
||||
iov, \
|
||||
&iov_count, \
|
||||
&max_data ); \
|
||||
bytes_delivered = max_data; \
|
||||
OPAL_THREAD_UNLOCK(&request->lock); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -559,7 +559,6 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq,
|
||||
des->des_cbdata = sendreq;
|
||||
des->des_cbfunc = mca_pml_ob1_match_completion_free;
|
||||
|
||||
|
||||
/* send */
|
||||
rc = mca_bml_base_send_status(bml_btl, des, MCA_PML_OB1_HDR_TYPE_MATCH);
|
||||
if( OPAL_LIKELY( rc >= 0 ) ) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user