rename get_comm_ptr to lam_comm_lookup
This commit was SVN r303.
Этот коммит содержится в:
родитель
1549ebfb19
Коммит
9e5bb8c380
@ -51,61 +51,61 @@ int mca_ptl_base_match(mca_pml_base_reliable_hdr_t *frag_header,
|
|||||||
mca_pml_base_recv_frag_t *frag_desc, int *match_made,
|
mca_pml_base_recv_frag_t *frag_desc, int *match_made,
|
||||||
lam_list_t *additional_matches)
|
lam_list_t *additional_matches)
|
||||||
{
|
{
|
||||||
/* local variables */
|
/* local variables */
|
||||||
mca_pml_base_sequence_t frag_msg_seq_num,next_msg_seq_num_expected;
|
mca_pml_base_sequence_t frag_msg_seq_num,next_msg_seq_num_expected;
|
||||||
lam_communicator_t *comm_ptr;
|
lam_communicator_t *comm_ptr;
|
||||||
mca_pml_base_recv_request_t *matched_receive;
|
mca_pml_base_recv_request_t *matched_receive;
|
||||||
mca_pml_comm_t *pml_comm;
|
mca_pml_comm_t *pml_comm;
|
||||||
int frag_src;
|
int frag_src;
|
||||||
|
|
||||||
/* initialization */
|
/* initialization */
|
||||||
*match_made=0;
|
*match_made=0;
|
||||||
|
|
||||||
/* communicator pointer */
|
/* communicator pointer */
|
||||||
comm_ptr=get_comm_ptr(frag_header->hdr_base.hdr_contextid);
|
comm_ptr=lam_comm_lookup(frag_header->hdr_base.hdr_contextid);
|
||||||
pml_comm=(mca_pml_comm_t *)comm_ptr->c_pml_comm;
|
pml_comm=(mca_pml_comm_t *)comm_ptr->c_pml_comm;
|
||||||
|
|
||||||
/* source sequence number */
|
/* source sequence number */
|
||||||
frag_msg_seq_num = frag_header->hdr_msg_seq_num;
|
frag_msg_seq_num = frag_header->hdr_msg_seq_num;
|
||||||
|
|
||||||
/* get fragment communicator source rank */
|
/* get fragment communicator source rank */
|
||||||
frag_src = frag_header->hdr_frag_seq_num;
|
frag_src = frag_header->hdr_frag_seq_num;
|
||||||
|
|
||||||
/* get next expected message sequence number - if threaded
|
/* get next expected message sequence number - if threaded
|
||||||
* run, lock to make sure that if another thread is processing
|
* run, lock to make sure that if another thread is processing
|
||||||
* a frag from the same message a match is made only once.
|
* a frag from the same message a match is made only once.
|
||||||
* Also, this prevents other posted receives (for a pair of
|
* Also, this prevents other posted receives (for a pair of
|
||||||
* end points) from being processed, and potentially "loosing"
|
* end points) from being processed, and potentially "loosing"
|
||||||
* the fragment.
|
* the fragment.
|
||||||
*/
|
*/
|
||||||
THREAD_LOCK((pml_comm->c_matching_lock)+frag_src);
|
THREAD_LOCK((pml_comm->c_matching_lock)+frag_src);
|
||||||
|
|
||||||
/* get sequence number of next message that can be processed */
|
/* get sequence number of next message that can be processed */
|
||||||
next_msg_seq_num_expected = *((pml_comm->c_next_msg_seq_num)+frag_src);
|
next_msg_seq_num_expected = *((pml_comm->c_next_msg_seq_num)+frag_src);
|
||||||
|
|
||||||
if (frag_msg_seq_num == next_msg_seq_num_expected) {
|
if (frag_msg_seq_num == next_msg_seq_num_expected) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the sequence number we were expecting,
|
* This is the sequence number we were expecting,
|
||||||
* so we can try matching it to already posted
|
* so we can try matching it to already posted
|
||||||
* receives.
|
* receives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We're now expecting the next sequence number. */
|
/* We're now expecting the next sequence number. */
|
||||||
(pml_comm->c_next_msg_seq_num[frag_src])++;
|
(pml_comm->c_next_msg_seq_num[frag_src])++;
|
||||||
|
|
||||||
/* see if receive has already been posted */
|
/* see if receive has already been posted */
|
||||||
matched_receive = lam_check_recieves_for_match(frag_header);
|
matched_receive = lam_check_recieves_for_match(frag_header);
|
||||||
|
|
||||||
/* if match found, process data */
|
/* if match found, process data */
|
||||||
if (matched_receive) {
|
if (matched_receive) {
|
||||||
/*
|
/*
|
||||||
* if threaded, ok to release lock, since the posted
|
* if threaded, ok to release lock, since the posted
|
||||||
* receive is not on any queue, so it won't be
|
* receive is not on any queue, so it won't be
|
||||||
* matched again, and the fragment can be processed
|
* matched again, and the fragment can be processed
|
||||||
* w/o any conflict from other threads - locks will
|
* w/o any conflict from other threads - locks will
|
||||||
* be used where concurent access needs to be managed.
|
* be used where concurent access needs to be managed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* set flag indicating the input fragment was matched */
|
/* set flag indicating the input fragment was matched */
|
||||||
*match_made=1;
|
*match_made=1;
|
||||||
@ -113,13 +113,13 @@ int mca_ptl_base_match(mca_pml_base_reliable_hdr_t *frag_header,
|
|||||||
* descriptor */
|
* descriptor */
|
||||||
frag_desc->matched_recv=matched_receive;
|
frag_desc->matched_recv=matched_receive;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update deliverd sequence number information,
|
* update deliverd sequence number information,
|
||||||
* if need be.
|
* if need be.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* if no match found, place on unexpected queue - need to
|
/* if no match found, place on unexpected queue - need to
|
||||||
* lock to prevent probe from interfering with updating
|
* lock to prevent probe from interfering with updating
|
||||||
* the list */
|
* the list */
|
||||||
THREAD_LOCK((pml_comm->unexpected_frags_lock)+frag_src);
|
THREAD_LOCK((pml_comm->unexpected_frags_lock)+frag_src);
|
||||||
@ -127,30 +127,30 @@ int mca_ptl_base_match(mca_pml_base_reliable_hdr_t *frag_header,
|
|||||||
(lam_list_item_t *)frag_desc);
|
(lam_list_item_t *)frag_desc);
|
||||||
THREAD_UNLOCK((pml_comm->unexpected_frags_lock)+frag_src);
|
THREAD_UNLOCK((pml_comm->unexpected_frags_lock)+frag_src);
|
||||||
|
|
||||||
/* now that the fragment is on the list, ok to
|
/* now that the fragment is on the list, ok to
|
||||||
* release match - other matches may be attempted */
|
* release match - other matches may be attempted */
|
||||||
THREAD_UNLOCK((pml_comm->c_matching_lock)+frag_src);
|
THREAD_UNLOCK((pml_comm->c_matching_lock)+frag_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that new message has arrived, check to see if
|
* Now that new message has arrived, check to see if
|
||||||
* any fragments on the c_frags_cant_match list
|
* any fragments on the c_frags_cant_match list
|
||||||
* may now be used to form new matchs
|
* may now be used to form new matchs
|
||||||
*/
|
*/
|
||||||
if (lam_list_get_size((pml_comm->frags_cant_match)+frag_src)) {
|
if (lam_list_get_size((pml_comm->frags_cant_match)+frag_src)) {
|
||||||
/* initialize list to empty */
|
/* initialize list to empty */
|
||||||
lam_list_set_size(additional_matches,0);
|
lam_list_set_size(additional_matches,0);
|
||||||
/* need to handle this -- lam_check_cantmatch_for_match();
|
/* need to handle this -- lam_check_cantmatch_for_match();
|
||||||
* */
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mark message as done, if it has completed - need to mark
|
* mark message as done, if it has completed - need to mark
|
||||||
* it this late to avoid a race condition with another thread
|
* it this late to avoid a race condition with another thread
|
||||||
* waiting to complete a recv, completing, and try to free the
|
* waiting to complete a recv, completing, and try to free the
|
||||||
* communicator before the current thread is done referencing
|
* communicator before the current thread is done referencing
|
||||||
* this communicator - is this true ?
|
* this communicator - is this true ?
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* This message comes after the next expected, so it
|
* This message comes after the next expected, so it
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user