add matching logic that assumes in-order delivery with no
dropped packets (shared memory, for example). Reviewed by Tim W. This commit was SVN r2999.
Этот коммит содержится в:
родитель
6b48c878a1
Коммит
eaae910b5b
@ -600,3 +600,79 @@ static void mca_ptl_base_check_cantmatch_for_match(ompi_list_t *additional_match
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* RCS/CTS receive side matching
|
||||
*
|
||||
* @param frag_header list of parameters needed for matching
|
||||
* This list is also embeded in frag_desc,
|
||||
* but this allows to save a memory copy when
|
||||
* a match is made in this routine. (IN)
|
||||
* @param frag_desc pointer to receive fragment which we want
|
||||
* to match (IN/OUT). If a match is not made,
|
||||
* frag_header is copied to frag_desc.
|
||||
* @param match_made parameter indicating if we matched frag_desc/
|
||||
* frag_header (OUT)
|
||||
* @return indication if match was made or not.
|
||||
*
|
||||
* This routine is used to try and match a newly arrived message fragment
|
||||
* to pre-posted receives. The following assumptions are made
|
||||
* - fragments are received in order, so no explicit sequence
|
||||
* tracking is needed.
|
||||
* - for long messages, e.g. more than one fragment, a RTS/CTS algorithm
|
||||
* is used.
|
||||
* - 2nd and greater fragments include a receive descriptor pointer
|
||||
* - this routine may be called simoultaneously by more than one thread
|
||||
*/
|
||||
bool mca_ptl_base_match_in_order_network_delivery(
|
||||
mca_ptl_base_match_header_t *frag_header,
|
||||
struct mca_ptl_base_recv_frag_t *frag_desc)
|
||||
{
|
||||
/* local variables */
|
||||
mca_ptl_sequence_t frag_msg_seq,next_msg_seq_expected;
|
||||
ompi_communicator_t *comm_ptr;
|
||||
mca_pml_base_recv_request_t *matched_receive;
|
||||
mca_pml_ptl_comm_t *pml_comm;
|
||||
int frag_src;
|
||||
|
||||
bool match_made=false;
|
||||
|
||||
/* communicator pointer */
|
||||
comm_ptr=ompi_comm_lookup(frag_header->hdr_contextid);
|
||||
pml_comm=(mca_pml_ptl_comm_t *)comm_ptr->c_pml_comm;
|
||||
|
||||
/* source sequence number */
|
||||
frag_msg_seq = frag_header->hdr_msg_seq;
|
||||
|
||||
/* get fragment communicator source rank */
|
||||
frag_src = frag_header->hdr_src;
|
||||
|
||||
/* get next expected message sequence number - if threaded
|
||||
* run, lock to make sure that if another thread is processing
|
||||
* a frag from the same message a match is made only once.
|
||||
* Also, this prevents other posted receives (for a pair of
|
||||
* end points) from being processed, and potentially "loosing"
|
||||
* the fragment.
|
||||
*/
|
||||
OMPI_THREAD_LOCK(&pml_comm->c_matching_lock);
|
||||
|
||||
/* see if receive has already been posted */
|
||||
matched_receive = mca_ptl_base_check_receives_for_match(frag_header,
|
||||
pml_comm);
|
||||
|
||||
/* if match found, process data */
|
||||
if (matched_receive) {
|
||||
/* set flag indicating the input fragment was matched */
|
||||
match_made=true;
|
||||
|
||||
/* associate the receive descriptor with the fragment descriptor */
|
||||
frag_desc->frag_request=matched_receive;
|
||||
} else {
|
||||
/* if no match found, place on unexpected queue */
|
||||
ompi_list_append( ((pml_comm->c_unexpected_frags)+frag_src),
|
||||
(ompi_list_item_t *)frag_desc);
|
||||
}
|
||||
|
||||
|
||||
OMPI_THREAD_UNLOCK(&pml_comm->c_matching_lock);
|
||||
return match_made;
|
||||
}
|
||||
|
@ -10,7 +10,9 @@
|
||||
struct mca_ptl_base_recv_frag_t;
|
||||
|
||||
/**
|
||||
* Match incoming fragments against posted receives.
|
||||
* RCS/CTS receive side matching
|
||||
* Match incoming fragments against posted receives. Out of order
|
||||
* delivery.
|
||||
*
|
||||
* @param frag_header (IN) Header of received fragment.
|
||||
* @param frag_desc (IN) Received fragment descriptor.
|
||||
@ -21,5 +23,32 @@ struct mca_ptl_base_recv_frag_t;
|
||||
bool mca_ptl_base_match(mca_ptl_base_match_header_t *frag_header,
|
||||
struct mca_ptl_base_recv_frag_t *frag_desc, ompi_list_t *additional_matches);
|
||||
|
||||
/**
|
||||
* RCS/CTS receive side matching
|
||||
*
|
||||
* @param frag_header list of parameters needed for matching
|
||||
* This list is also embeded in frag_desc,
|
||||
* but this allows to save a memory copy when
|
||||
* a match is made in this routine. (IN)
|
||||
* @param frag_desc pointer to receive fragment which we want
|
||||
* to match (IN/OUT). If a match is not made,
|
||||
* frag_header is copied to frag_desc.
|
||||
* @param match_made parameter indicating if we matched frag_desc/
|
||||
* frag_header (OUT)
|
||||
* @return indication if match was made or not.
|
||||
*
|
||||
* This routine is used to try and match a newly arrived message fragment
|
||||
* to pre-posted receives. The following assumptions are made
|
||||
* - fragments are received in order, so no explicit sequence
|
||||
* tracking is needed.
|
||||
* - for long messages, e.g. more than one fragment, a RTS/CTS algorithm
|
||||
* is used.
|
||||
* - 2nd and greater fragments include a receive descriptor pointer
|
||||
* - this routine may be called simoultaneously by more than one thread
|
||||
*/
|
||||
bool mca_ptl_base_match_in_order_network_delivery(
|
||||
mca_ptl_base_match_header_t *frag_header,
|
||||
struct mca_ptl_base_recv_frag_t *frag_desc);
|
||||
|
||||
#endif /* MCA_PTL_BASE_MATCH_H */
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user