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.
|
2006-08-24 20:38:08 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2007-08-23 11:09:43 +04:00
|
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
2005-05-24 02:06:50 +04:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-04 02:45:48 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
2007-07-01 20:19:53 +04:00
|
|
|
#include "opal/prefetch.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
2005-06-02 01:09:43 +04:00
|
|
|
#include "pml_ob1.h"
|
|
|
|
#include "pml_ob1_comm.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1_recvfrag.h"
|
|
|
|
#include "pml_ob1_recvreq.h"
|
2005-06-01 18:34:22 +04:00
|
|
|
#include "pml_ob1_sendreq.h"
|
2005-06-02 01:09:43 +04:00
|
|
|
#include "pml_ob1_hdr.h"
|
2006-03-31 21:09:09 +04:00
|
|
|
#include "ompi/peruse/peruse-internal.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
OBJ_CLASS_INSTANCE( mca_pml_ob1_buffer_t,
|
|
|
|
ompi_free_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL );
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE( mca_pml_ob1_recv_frag_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL );
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2006-07-13 20:52:40 +04:00
|
|
|
/**
|
|
|
|
* Static functions.
|
|
|
|
*/
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2006-07-13 20:52:40 +04:00
|
|
|
/**
|
|
|
|
* Match incoming recv_frags against posted receives.
|
|
|
|
* Supports out of order delivery.
|
|
|
|
*
|
|
|
|
* @param frag_header (IN) Header of received recv_frag.
|
|
|
|
* @param frag_desc (IN) Received recv_frag descriptor.
|
|
|
|
* @param match_made (OUT) Flag indicating wether a match was made.
|
|
|
|
* @param additional_matches (OUT) List of additional matches
|
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*/
|
|
|
|
static int mca_pml_ob1_recv_frag_match( mca_btl_base_module_t *btl,
|
|
|
|
mca_pml_ob1_match_hdr_t *hdr,
|
|
|
|
mca_btl_base_segment_t* segments,
|
|
|
|
size_t num_segments );
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-02 01:09:43 +04:00
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* Callback from BTL on receive.
|
2005-06-02 01:09:43 +04:00
|
|
|
*/
|
|
|
|
|
2007-07-11 03:45:23 +04:00
|
|
|
void mca_pml_ob1_recv_frag_callback( mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_descriptor_t* des,
|
|
|
|
void* cbdata )
|
2005-05-24 02:06:50 +04:00
|
|
|
{
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_segment_t* segments = des->des_dst;
|
2007-01-05 01:07:37 +03:00
|
|
|
mca_pml_ob1_hdr_t* hdr = (mca_pml_ob1_hdr_t*)segments->seg_addr.pval;
|
2007-07-11 03:45:23 +04:00
|
|
|
|
|
|
|
if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_ob1_common_hdr_t)) ) {
|
2005-05-24 02:06:50 +04:00
|
|
|
return;
|
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2006-02-26 03:45:54 +03:00
|
|
|
/* hdr_type and hdr_flags are uint8_t, so no endian problems */
|
2005-05-24 02:06:50 +04:00
|
|
|
switch(hdr->hdr_common.hdr_type) {
|
2005-08-12 06:41:14 +04:00
|
|
|
case MCA_PML_OB1_HDR_TYPE_MATCH:
|
2006-02-26 03:45:54 +03:00
|
|
|
{
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_MATCH);
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_pml_ob1_recv_frag_match(btl, &hdr->hdr_match, segments,des->des_dst_cnt);
|
|
|
|
break;
|
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
case MCA_PML_OB1_HDR_TYPE_RNDV:
|
2006-02-26 03:45:54 +03:00
|
|
|
{
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_RNDV);
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_pml_ob1_recv_frag_match(btl, &hdr->hdr_match, segments,des->des_dst_cnt);
|
|
|
|
break;
|
|
|
|
}
|
2005-08-17 22:23:38 +04:00
|
|
|
case MCA_PML_OB1_HDR_TYPE_RGET:
|
2005-08-12 06:41:14 +04:00
|
|
|
{
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_RGET);
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_pml_ob1_recv_frag_match(btl, &hdr->hdr_match, segments,des->des_dst_cnt);
|
2005-05-24 02:06:50 +04:00
|
|
|
break;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_ACK:
|
|
|
|
{
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_pml_ob1_send_request_t* sendreq;
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_ACK);
|
2007-01-05 01:07:37 +03:00
|
|
|
sendreq = (mca_pml_ob1_send_request_t*)hdr->hdr_ack.hdr_src_req.pval;
|
2005-06-02 01:09:43 +04:00
|
|
|
sendreq->req_recv = hdr->hdr_ack.hdr_dst_req;
|
2007-06-03 12:30:07 +04:00
|
|
|
|
|
|
|
/* if the request should be delivered entirely by copy in/out
|
|
|
|
* then throttle sends */
|
2008-03-27 11:56:43 +03:00
|
|
|
if(hdr->hdr_common.hdr_flags & MCA_PML_OB1_HDR_FLAGS_NORDMA)
|
2007-06-03 12:30:07 +04:00
|
|
|
sendreq->req_throttle_sends = true;
|
|
|
|
|
2007-07-11 02:16:38 +04:00
|
|
|
mca_pml_ob1_send_request_copy_in_out(sendreq,
|
2007-06-03 12:30:07 +04:00
|
|
|
hdr->hdr_ack.hdr_send_offset,
|
|
|
|
sendreq->req_send.req_bytes_packed -
|
|
|
|
hdr->hdr_ack.hdr_send_offset);
|
2007-08-30 16:08:33 +04:00
|
|
|
|
|
|
|
OPAL_THREAD_ADD32(&sendreq->req_state, -1);
|
|
|
|
|
|
|
|
if(send_request_pml_complete_check(sendreq) == false)
|
2007-01-03 15:37:11 +03:00
|
|
|
mca_pml_ob1_send_request_schedule(sendreq);
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
break;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_FRAG:
|
|
|
|
{
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_pml_ob1_recv_request_t* recvreq;
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_FRAG);
|
2007-01-05 01:07:37 +03:00
|
|
|
recvreq = (mca_pml_ob1_recv_request_t*)hdr->hdr_frag.hdr_dst_req.pval;
|
2005-08-17 22:23:38 +04:00
|
|
|
mca_pml_ob1_recv_request_progress(recvreq,btl,segments,des->des_dst_cnt);
|
2005-06-02 01:09:43 +04:00
|
|
|
break;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_PUT:
|
|
|
|
{
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_pml_ob1_send_request_t* sendreq;
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_PUT);
|
2007-01-05 01:07:37 +03:00
|
|
|
sendreq = (mca_pml_ob1_send_request_t*)hdr->hdr_rdma.hdr_req.pval;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_pml_ob1_send_request_put(sendreq,btl,&hdr->hdr_rdma);
|
2005-06-09 07:11:51 +04:00
|
|
|
break;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
case MCA_PML_OB1_HDR_TYPE_FIN:
|
|
|
|
{
|
2006-02-26 03:45:54 +03:00
|
|
|
mca_btl_base_descriptor_t* rdma;
|
2007-12-16 11:45:44 +03:00
|
|
|
ob1_hdr_ntoh(hdr, MCA_PML_OB1_HDR_TYPE_FIN);
|
2007-01-05 01:07:37 +03:00
|
|
|
rdma = (mca_btl_base_descriptor_t*)hdr->hdr_fin.hdr_des.pval;
|
2007-06-03 12:31:58 +04:00
|
|
|
rdma->des_cbfunc(btl, NULL, rdma,
|
|
|
|
hdr->hdr_fin.hdr_fail ? OMPI_ERROR : OMPI_SUCCESS);
|
2005-06-09 07:11:51 +04:00
|
|
|
break;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
}
|
2006-02-09 09:59:54 +03:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
#define PML_MAX_SEQ ~((mca_pml_sequence_t)0);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
static inline mca_pml_ob1_recv_request_t* get_posted_recv(opal_list_t *queue)
|
|
|
|
{
|
|
|
|
if(opal_list_get_size(queue) == 0)
|
|
|
|
return NULL;
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
return (mca_pml_ob1_recv_request_t*)opal_list_get_first(queue);
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
static inline mca_pml_ob1_recv_request_t* get_next_posted_recv(
|
|
|
|
opal_list_t *queue,
|
|
|
|
mca_pml_ob1_recv_request_t* req)
|
|
|
|
{
|
|
|
|
opal_list_item_t *i = opal_list_get_next((opal_list_item_t*)req);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
if(opal_list_get_end(queue) == i)
|
|
|
|
return NULL;
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
return (mca_pml_ob1_recv_request_t*)i;
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
static mca_pml_ob1_recv_request_t *match_incomming(
|
|
|
|
mca_pml_ob1_match_hdr_t *hdr, mca_pml_ob1_comm_t *comm,
|
|
|
|
mca_pml_ob1_comm_proc_t *proc)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_request_t *specific_recv, *wild_recv;
|
|
|
|
mca_pml_sequence_t wild_recv_seq, specific_recv_seq;
|
|
|
|
int tag = hdr->hdr_tag;
|
|
|
|
|
|
|
|
specific_recv = get_posted_recv(&proc->specific_receives);
|
|
|
|
wild_recv = get_posted_recv(&comm->wild_receives);
|
|
|
|
|
|
|
|
wild_recv_seq = wild_recv ?
|
|
|
|
wild_recv->req_recv.req_base.req_sequence : PML_MAX_SEQ;
|
|
|
|
specific_recv_seq = specific_recv ?
|
|
|
|
specific_recv->req_recv.req_base.req_sequence : PML_MAX_SEQ;
|
|
|
|
|
|
|
|
/* they are equal only if both are PML_MAX_SEQ */
|
|
|
|
while(wild_recv_seq != specific_recv_seq) {
|
|
|
|
mca_pml_ob1_recv_request_t **match;
|
|
|
|
opal_list_t *queue;
|
|
|
|
int req_tag;
|
|
|
|
mca_pml_sequence_t *seq;
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(wild_recv_seq < specific_recv_seq)) {
|
|
|
|
match = &wild_recv;
|
|
|
|
queue = &comm->wild_receives;
|
|
|
|
seq = &wild_recv_seq;
|
|
|
|
} else {
|
|
|
|
match = &specific_recv;
|
|
|
|
queue = &proc->specific_receives;
|
|
|
|
seq = &specific_recv_seq;
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
req_tag = (*match)->req_recv.req_base.req_tag;
|
|
|
|
if(req_tag == tag || (req_tag == OMPI_ANY_TAG && tag >= 0)) {
|
|
|
|
opal_list_remove_item(queue, (opal_list_item_t*)(*match));
|
|
|
|
PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_REMOVE_FROM_POSTED_Q,
|
|
|
|
&((*match)->req_recv.req_base), PERUSE_RECV);
|
|
|
|
return *match;
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
*match = get_next_posted_recv(queue, *match);
|
|
|
|
*seq = (*match) ? (*match)->req_recv.req_base.req_sequence : PML_MAX_SEQ;
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void append_frag_to_list(opal_list_t *queue, mca_btl_base_module_t *btl,
|
|
|
|
mca_pml_ob1_match_hdr_t *hdr, mca_btl_base_segment_t* segments,
|
|
|
|
size_t num_segments, mca_pml_ob1_recv_frag_t* frag)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if(NULL == frag) {
|
|
|
|
MCA_PML_OB1_RECV_FRAG_ALLOC(frag, rc);
|
|
|
|
MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl);
|
|
|
|
}
|
|
|
|
opal_list_append(queue, (opal_list_item_t*)frag);
|
|
|
|
}
|
|
|
|
|
|
|
|
static mca_pml_ob1_recv_request_t *match_one(mca_btl_base_module_t *btl,
|
|
|
|
mca_pml_ob1_match_hdr_t *hdr, mca_btl_base_segment_t* segments,
|
|
|
|
size_t num_segments, ompi_communicator_t *comm_ptr,
|
|
|
|
mca_pml_ob1_comm_proc_t *proc,
|
|
|
|
mca_pml_ob1_recv_frag_t* frag)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_recv_request_t *match;
|
|
|
|
mca_pml_ob1_comm_t *comm = (mca_pml_ob1_comm_t *)comm_ptr->c_pml_comm;
|
|
|
|
|
|
|
|
do {
|
|
|
|
match = match_incomming(hdr, comm, proc);
|
|
|
|
|
|
|
|
/* if match found, process data */
|
|
|
|
if(OPAL_UNLIKELY(NULL == match)) {
|
|
|
|
/* if no match found, place on unexpected queue */
|
|
|
|
append_frag_to_list(&proc->unexpected_frags, btl, hdr, segments,
|
|
|
|
num_segments, frag);
|
|
|
|
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_INSERT_IN_UNEX_Q, comm_ptr,
|
|
|
|
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
match->req_recv.req_base.req_proc = proc->ompi_proc;
|
|
|
|
|
|
|
|
if(MCA_PML_REQUEST_PROBE == match->req_recv.req_base.req_type) {
|
|
|
|
/* complete the probe */
|
|
|
|
mca_pml_ob1_recv_request_matched_probe(match, btl, segments,
|
|
|
|
num_segments);
|
|
|
|
/* attempt to match actual request */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_MSG_MATCH_POSTED_REQ,
|
|
|
|
&(match->req_recv.req_base), PERUSE_RECV);
|
|
|
|
break;
|
|
|
|
} while(true);
|
|
|
|
|
|
|
|
return match;
|
|
|
|
}
|
|
|
|
|
|
|
|
static mca_pml_ob1_recv_frag_t *check_cantmatch_for_match(
|
|
|
|
mca_pml_ob1_comm_proc_t *proc)
|
|
|
|
{
|
|
|
|
/* local parameters */
|
|
|
|
mca_pml_ob1_recv_frag_t *frag;
|
|
|
|
|
|
|
|
/* search the list for a fragment from the send with sequence
|
|
|
|
* number next_msg_seq_expected
|
|
|
|
*/
|
|
|
|
for(frag = (mca_pml_ob1_recv_frag_t *)
|
|
|
|
opal_list_get_first(&proc->frags_cant_match);
|
|
|
|
frag != (mca_pml_ob1_recv_frag_t *)
|
|
|
|
opal_list_get_end(&proc->frags_cant_match);
|
|
|
|
frag = (mca_pml_ob1_recv_frag_t *)
|
|
|
|
opal_list_get_next(frag))
|
|
|
|
{
|
|
|
|
mca_pml_ob1_match_hdr_t* hdr = &frag->hdr.hdr_match;
|
|
|
|
/*
|
|
|
|
* If the message has the next expected seq from that proc...
|
|
|
|
*/
|
2008-04-27 22:35:54 +04:00
|
|
|
if(hdr->hdr_seq != proc->expected_sequence)
|
2007-12-19 12:16:20 +03:00
|
|
|
continue;
|
|
|
|
|
|
|
|
opal_list_remove_item(&proc->frags_cant_match, (opal_list_item_t*)frag);
|
|
|
|
return frag;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* RCS/CTS receive side matching
|
|
|
|
*
|
|
|
|
* @param hdr list of parameters needed for matching
|
2005-06-07 18:12:47 +04:00
|
|
|
* This list is also embeded in frag,
|
2005-06-02 01:09:43 +04:00
|
|
|
* but this allows to save a memory copy when
|
|
|
|
* a match is made in this routine. (IN)
|
2005-06-07 18:12:47 +04:00
|
|
|
* @param frag pointer to receive fragment which we want
|
2005-06-02 01:09:43 +04:00
|
|
|
* to match (IN/OUT). If a match is not made,
|
2005-06-07 18:12:47 +04:00
|
|
|
* hdr is copied to frag.
|
|
|
|
* @param match_made parameter indicating if we matched frag/
|
2005-06-02 01:09:43 +04:00
|
|
|
* hdr (OUT)
|
2005-06-07 18:12:47 +04:00
|
|
|
* @param additional_matches if a match is made with frag, we
|
2005-06-02 01:09:43 +04:00
|
|
|
* may be able to match fragments that previously
|
|
|
|
* have arrived out-of-order. If this is the
|
|
|
|
* case, the associated fragment descriptors are
|
|
|
|
* put on this list for further processing. (OUT)
|
|
|
|
*
|
|
|
|
* @return OMPI error code
|
|
|
|
*
|
|
|
|
* 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 out of order
|
|
|
|
* - for long messages, e.g. more than one fragment, a RTS/CTS algorithm
|
|
|
|
* is used.
|
|
|
|
* - 2nd and greater fragments include a receive descriptor pointer
|
|
|
|
* - fragments may be dropped
|
|
|
|
* - fragments may be corrupt
|
|
|
|
* - this routine may be called simultaneously by more than one thread
|
|
|
|
*/
|
2006-07-13 20:52:40 +04:00
|
|
|
static int mca_pml_ob1_recv_frag_match( mca_btl_base_module_t *btl,
|
|
|
|
mca_pml_ob1_match_hdr_t *hdr,
|
|
|
|
mca_btl_base_segment_t* segments,
|
|
|
|
size_t num_segments )
|
2005-06-02 01:09:43 +04:00
|
|
|
{
|
|
|
|
/* local variables */
|
|
|
|
uint16_t next_msg_seq_expected, frag_msg_seq;
|
|
|
|
ompi_communicator_t *comm_ptr;
|
|
|
|
mca_pml_ob1_recv_request_t *match = NULL;
|
|
|
|
mca_pml_ob1_comm_t *comm;
|
|
|
|
mca_pml_ob1_comm_proc_t *proc;
|
2007-12-19 12:16:20 +03:00
|
|
|
mca_pml_ob1_recv_frag_t* frag = NULL;
|
2005-06-02 01:09:43 +04:00
|
|
|
|
|
|
|
/* communicator pointer */
|
2007-09-12 21:52:02 +04:00
|
|
|
comm_ptr = ompi_comm_lookup(hdr->hdr_ctx);
|
2007-12-19 12:16:20 +03:00
|
|
|
if(OPAL_UNLIKELY(NULL == comm_ptr)) {
|
2007-09-12 21:52:02 +04:00
|
|
|
/* This is a special case. A message for a not yet exiting 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 commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_output( 0, "Dropped message for the non-existing communicator %d\n",
|
2007-09-12 21:52:02 +04:00
|
|
|
(int)hdr->hdr_ctx );
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
comm = (mca_pml_ob1_comm_t *)comm_ptr->c_pml_comm;
|
2005-06-02 01:09:43 +04:00
|
|
|
|
|
|
|
/* source sequence number */
|
2005-08-17 22:23:38 +04:00
|
|
|
frag_msg_seq = hdr->hdr_seq;
|
2007-12-19 12:16:20 +03:00
|
|
|
proc = &comm->procs[hdr->hdr_src];
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2006-03-31 21:09:09 +04:00
|
|
|
/**
|
|
|
|
* 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).
|
|
|
|
*/
|
2007-12-19 12:16:20 +03:00
|
|
|
PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm_ptr,
|
2008-01-15 08:32:53 +03:00
|
|
|
hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV);
|
2006-03-31 21:09:09 +04:00
|
|
|
|
2005-06-02 01:09:43 +04:00
|
|
|
/* 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.
|
|
|
|
*/
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&comm->matching_lock);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
|
|
|
/* get sequence number of next message that can be processed */
|
|
|
|
next_msg_seq_expected = (uint16_t)proc->expected_sequence;
|
2007-12-19 12:16:20 +03:00
|
|
|
if(OPAL_UNLIKELY(frag_msg_seq != next_msg_seq_expected))
|
|
|
|
goto wrong_seq;
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
/*
|
|
|
|
* This is the sequence number we were expecting,
|
|
|
|
* so we can try matching it to already posted
|
|
|
|
* receives.
|
|
|
|
*/
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
out_of_order_match:
|
|
|
|
/* We're now expecting the next sequence number. */
|
|
|
|
proc->expected_sequence++;
|
2006-03-31 21:09:09 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
/**
|
|
|
|
* 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);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
match = match_one(btl, hdr, segments, num_segments, comm_ptr, proc, frag);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
/**
|
|
|
|
* 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);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2005-12-11 02:25:29 +03:00
|
|
|
/* release matching lock before processing fragment */
|
2005-08-02 21:36:01 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&comm->matching_lock);
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
if(OPAL_LIKELY(match)) {
|
|
|
|
mca_pml_ob1_recv_request_progress(match, btl, segments, num_segments);
|
|
|
|
if(OPAL_UNLIKELY(frag))
|
2005-06-10 00:16:33 +04:00
|
|
|
MCA_PML_OB1_RECV_FRAG_RETURN(frag);
|
2005-06-02 01:09:43 +04:00
|
|
|
}
|
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
/*
|
|
|
|
* Now that new message has arrived, check to see if
|
|
|
|
* any fragments on the c_c_frags_cant_match list
|
|
|
|
* may now be used to form new matchs
|
|
|
|
*/
|
|
|
|
if(OPAL_UNLIKELY(opal_list_get_size(&proc->frags_cant_match) > 0)) {
|
|
|
|
OPAL_THREAD_LOCK(&comm->matching_lock);
|
|
|
|
if((frag = check_cantmatch_for_match(proc))) {
|
|
|
|
hdr = &frag->hdr.hdr_match;
|
|
|
|
segments = frag->segments;
|
|
|
|
num_segments = frag->num_segments;
|
|
|
|
btl = frag->btl;
|
|
|
|
goto out_of_order_match;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&comm->matching_lock);
|
|
|
|
}
|
2005-06-02 01:09:43 +04:00
|
|
|
|
2007-12-19 12:16:20 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
wrong_seq:
|
2005-06-02 01:09:43 +04:00
|
|
|
/*
|
2007-12-19 12:16:20 +03:00
|
|
|
* This message comes after the next expected, so it
|
|
|
|
* is ahead of sequence. Save it for later.
|
2005-06-02 01:09:43 +04:00
|
|
|
*/
|
2007-12-19 12:16:20 +03:00
|
|
|
append_frag_to_list(&proc->frags_cant_match, btl, hdr, segments,
|
2008-01-15 08:32:53 +03:00
|
|
|
num_segments, NULL);
|
2007-12-19 12:16:20 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&comm->matching_lock);
|
|
|
|
return OMPI_SUCCESS;
|
2005-06-02 01:09:43 +04:00
|
|
|
}
|