2005-11-22 20:24:47 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2006-03-28 02:44:26 +04:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
2005-11-22 20:24:47 +03:00
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2005-12-21 00:42:58 +03:00
|
|
|
#include "opal/util/crc.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
2006-03-23 20:02:17 +03:00
|
|
|
#include "ompi/class/ompi_seq_tracker.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "ompi/mca/mpool/mpool.h"
|
2005-11-22 20:24:47 +03:00
|
|
|
#include "pml_dr.h"
|
|
|
|
#include "pml_dr_hdr.h"
|
|
|
|
#include "pml_dr_proc.h"
|
|
|
|
#include "pml_dr_sendreq.h"
|
|
|
|
#include "pml_dr_recvreq.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/bml/base/base.h"
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
|
2006-03-16 01:53:41 +03:00
|
|
|
/*
|
|
|
|
* The free call mark the final stage in a request life-cycle. Starting from this
|
|
|
|
* point the request is completed at both PML and user level, and can be used
|
|
|
|
* for others p2p communications. Therefore, in the case of the DR PML it should
|
|
|
|
* be added to the free request list.
|
|
|
|
*/
|
|
|
|
static inline int mca_pml_dr_send_request_free(struct ompi_request_t** request)
|
2005-11-22 20:24:47 +03:00
|
|
|
{
|
2006-03-16 01:53:41 +03:00
|
|
|
mca_pml_dr_send_request_t* sendreq = *(mca_pml_dr_send_request_t**)request;
|
|
|
|
|
|
|
|
assert( false == sendreq->req_send.req_base.req_free_called );
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
sendreq->req_send.req_base.req_free_called = true;
|
|
|
|
if( true == sendreq->req_send.req_base.req_pml_complete ) {
|
|
|
|
MCA_PML_DR_SEND_REQUEST_RETURN( sendreq );
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
2006-03-16 01:53:41 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-16 01:53:41 +03:00
|
|
|
*request = MPI_REQUEST_NULL;
|
2005-11-22 20:24:47 +03:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_pml_dr_send_request_cancel(struct ompi_request_t* request, int complete)
|
|
|
|
{
|
|
|
|
/* we dont cancel send requests by now */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_pml_dr_send_request_construct(mca_pml_dr_send_request_t* req)
|
|
|
|
{
|
2006-02-16 19:15:16 +03:00
|
|
|
OBJ_CONSTRUCT(&req->req_vfrag0, mca_pml_dr_vfrag_t);
|
|
|
|
OBJ_CONSTRUCT(&req->req_retrans, opal_list_t);
|
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
req->req_vfrag0.vf_len = 1;
|
|
|
|
req->req_vfrag0.vf_mask = 1;
|
2006-03-04 03:36:16 +03:00
|
|
|
req->req_vfrag0.vf_send.pval = req;
|
2005-11-22 20:24:47 +03:00
|
|
|
req->req_send.req_base.req_type = MCA_PML_REQUEST_SEND;
|
|
|
|
req->req_send.req_base.req_ompi.req_free = mca_pml_dr_send_request_free;
|
|
|
|
req->req_send.req_base.req_ompi.req_cancel = mca_pml_dr_send_request_cancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_pml_dr_send_request_destruct(mca_pml_dr_send_request_t* req)
|
|
|
|
{
|
2005-12-21 00:42:58 +03:00
|
|
|
OBJ_DESTRUCT(&req->req_vfrag0);
|
|
|
|
OBJ_DESTRUCT(&req->req_retrans);
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_pml_dr_send_request_t,
|
|
|
|
mca_pml_base_send_request_t,
|
|
|
|
mca_pml_dr_send_request_construct,
|
|
|
|
mca_pml_dr_send_request_destruct);
|
|
|
|
|
2006-05-04 20:16:26 +04:00
|
|
|
/**
|
|
|
|
* Handle error status on local completion
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_pml_dr_error_completion(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
int status)
|
|
|
|
{
|
|
|
|
mca_pml_dr_vfrag_t* vfrag = descriptor->des_cbdata;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
|
|
|
|
|
|
|
switch(status) {
|
|
|
|
case OMPI_ERR_UNREACH:
|
|
|
|
case OMPI_ERR_CONNECTION_FAILED:
|
|
|
|
case OMPI_ERR_CONNECTION_REFUSED:
|
|
|
|
/**
|
|
|
|
* peer is no longer reachable through this btl
|
|
|
|
*/
|
|
|
|
mca_bml.bml_del_proc_btl(sendreq->req_proc->ompi_proc, btl);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OMPI_ERR_FATAL:
|
|
|
|
case OMPI_ERR_COMM_FAILURE:
|
|
|
|
/**
|
|
|
|
* btl is no longer available
|
|
|
|
*/
|
|
|
|
mca_bml.bml_del_btl(btl);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
orte_errmgr.abort();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update pending counts */
|
2006-06-01 22:58:38 +04:00
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
2006-05-04 20:16:26 +04:00
|
|
|
OPAL_THREAD_ADD64(&vfrag->vf_pending,-1);
|
|
|
|
|
|
|
|
/* reset vfrag state - select new BTL */
|
|
|
|
mca_pml_dr_vfrag_reset(vfrag);
|
|
|
|
|
|
|
|
/* reschedule vfrag */
|
|
|
|
mca_pml_dr_vfrag_reschedule(vfrag);
|
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/**
|
|
|
|
* Completion of a short message - nothing left to schedule.
|
|
|
|
*/
|
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
static void mca_pml_dr_match_completion(
|
2005-11-22 20:24:47 +03:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
int status)
|
|
|
|
{
|
2006-05-04 20:16:26 +04:00
|
|
|
mca_pml_dr_vfrag_t* vfrag = descriptor->des_cbdata;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
|
|
|
|
|
|
|
/* kill pending wdog timer */
|
|
|
|
MCA_PML_DR_VFRAG_WDOG_STOP(vfrag);
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* free any descriptor used to retransmit */
|
2006-05-04 20:16:26 +04:00
|
|
|
if(descriptor != sendreq->req_descriptor) {
|
2006-03-22 00:23:33 +03:00
|
|
|
mca_bml_base_free(descriptor->des_context, descriptor);
|
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
2006-05-04 20:16:26 +04:00
|
|
|
mca_pml_dr_error_completion(btl,ep,descriptor,status);
|
|
|
|
return;
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
2006-03-24 01:08:59 +03:00
|
|
|
/* wait for local completion */
|
2006-06-01 22:58:38 +04:00
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
2006-03-24 01:08:59 +03:00
|
|
|
if(OPAL_THREAD_ADD64(&vfrag->vf_pending,-1) > 0)
|
|
|
|
return;
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* wait for positive ack to complete request */
|
2006-03-24 01:08:59 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2006-03-04 03:36:16 +03:00
|
|
|
if(vfrag->vf_ack == vfrag->vf_mask) {
|
2006-03-21 17:30:54 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* return descriptor */
|
2006-05-04 20:16:26 +04:00
|
|
|
if(NULL != sendreq->req_descriptor) {
|
|
|
|
mca_bml_base_free(sendreq->req_descriptor->des_context, sendreq->req_descriptor);
|
|
|
|
sendreq->req_descriptor = NULL;
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-21 17:30:54 +03:00
|
|
|
/* update statistics and complete */
|
2006-03-04 03:36:16 +03:00
|
|
|
sendreq->req_bytes_delivered = sendreq->req_send.req_bytes_packed;
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1, (0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-03-04 03:36:16 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
2006-03-23 18:11:06 +03:00
|
|
|
|
|
|
|
/* on negative ack need to retransmit */
|
2006-03-24 01:08:59 +03:00
|
|
|
} else if(vfrag->vf_state & MCA_PML_DR_VFRAG_NACKED) {
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(vfrag);
|
2006-03-22 00:23:33 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_EAGER_RETRY(sendreq, vfrag);
|
2006-05-04 20:16:26 +04:00
|
|
|
|
|
|
|
/* start ack timer */
|
|
|
|
} else {
|
|
|
|
MCA_PML_DR_VFRAG_ACK_START(vfrag);
|
|
|
|
}
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
|
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_DR_SEND_REQUEST_PROCESS_PENDING();
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Completion of the first fragment of a long message that
|
|
|
|
* requires an acknowledgement
|
|
|
|
*/
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
static void mca_pml_dr_rndv_completion(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
int status)
|
|
|
|
{
|
2006-05-04 20:16:26 +04:00
|
|
|
mca_pml_dr_vfrag_t* vfrag = descriptor->des_cbdata;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
2006-03-04 03:36:16 +03:00
|
|
|
bool schedule = false;
|
|
|
|
|
2006-05-04 20:16:26 +04:00
|
|
|
/* kill pending wdog timer */
|
|
|
|
MCA_PML_DR_VFRAG_WDOG_STOP(vfrag);
|
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* free any descriptor used to retransmit */
|
2006-05-04 20:16:26 +04:00
|
|
|
if(descriptor != sendreq->req_descriptor) {
|
2006-03-22 00:23:33 +03:00
|
|
|
mca_bml_base_free(descriptor->des_context, descriptor);
|
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
2006-05-04 20:16:26 +04:00
|
|
|
mca_pml_dr_error_completion(btl,ep,descriptor,status);
|
|
|
|
return;
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* local completion */
|
2006-06-01 22:58:38 +04:00
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
2006-03-24 01:08:59 +03:00
|
|
|
if(OPAL_THREAD_ADD64(&vfrag->vf_pending,-1) > 0)
|
|
|
|
return;
|
2006-03-02 01:37:10 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* wait for positive ack to complete request */
|
2006-03-24 01:08:59 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2006-03-04 03:36:16 +03:00
|
|
|
if(vfrag->vf_ack == vfrag->vf_mask) {
|
2006-05-04 20:16:26 +04:00
|
|
|
if(sendreq->req_descriptor) {
|
|
|
|
mca_bml_base_free(sendreq->req_descriptor->des_context, sendreq->req_descriptor);
|
|
|
|
sendreq->req_descriptor = NULL;
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2006-03-21 17:30:54 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* update statistics and complete */
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1, (0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-03-23 18:11:06 +03:00
|
|
|
if(sendreq->req_bytes_delivered == sendreq->req_send.req_bytes_packed) {
|
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
|
|
|
} else {
|
|
|
|
schedule = true;
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2006-03-21 00:57:30 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
if(schedule) {
|
|
|
|
mca_pml_dr_send_request_schedule(sendreq);
|
|
|
|
}
|
2006-03-21 17:30:54 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* on negative ack need to retransmit */
|
2006-03-24 01:08:59 +03:00
|
|
|
} else if(vfrag->vf_state & MCA_PML_DR_VFRAG_NACKED) {
|
2006-03-24 09:49:45 +03:00
|
|
|
MCA_PML_DR_VFRAG_ACK_RESET(vfrag);
|
2006-03-22 00:23:33 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_RNDV_PROBE(sendreq, vfrag);
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2006-05-04 20:16:26 +04:00
|
|
|
|
|
|
|
/* setup ack timer */
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
MCA_PML_DR_VFRAG_ACK_START(vfrag);
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_DR_SEND_REQUEST_PROCESS_PENDING();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Completion of additional fragments of a large message - may need
|
|
|
|
* to schedule additional fragments.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_pml_dr_frag_completion(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
int status)
|
|
|
|
{
|
2006-03-04 03:36:16 +03:00
|
|
|
mca_pml_dr_vfrag_t* vfrag = descriptor->des_cbdata;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
2006-02-24 20:08:14 +03:00
|
|
|
mca_bml_base_btl_t* bml_btl = vfrag->bml_btl;
|
2006-03-04 03:36:16 +03:00
|
|
|
bool schedule = false;
|
2006-02-24 20:08:14 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
2006-05-04 20:16:26 +04:00
|
|
|
mca_pml_dr_error_completion(btl,ep,descriptor,status);
|
|
|
|
return;
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* have all pending frags completed for this vfrag? */
|
2006-03-24 01:08:59 +03:00
|
|
|
if(OPAL_THREAD_ADD64(&vfrag->vf_pending,-1) == 0) {
|
2006-02-24 20:08:14 +03:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_STOP(vfrag);
|
2006-03-24 01:08:59 +03:00
|
|
|
|
2006-03-14 21:25:25 +03:00
|
|
|
/* has the vfrag already been acked */
|
2006-03-24 01:08:59 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2006-03-23 18:11:06 +03:00
|
|
|
if (vfrag->vf_ack == vfrag->vf_mask) {
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-14 21:25:25 +03:00
|
|
|
sendreq->req_bytes_delivered += vfrag->vf_size;
|
2006-03-21 17:30:54 +03:00
|
|
|
assert(sendreq->req_bytes_delivered <= sendreq->req_send.req_bytes_packed);
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2006-03-23 02:06:18 +03:00
|
|
|
/* is this vfrag in the process of being retransmitted */
|
2006-05-04 21:30:58 +04:00
|
|
|
if(vfrag->vf_state & MCA_PML_DR_VFRAG_RETRANS) {
|
2006-03-23 02:06:18 +03:00
|
|
|
opal_list_remove_item(&sendreq->req_retrans, (opal_list_item_t*)vfrag);
|
2006-05-04 21:30:58 +04:00
|
|
|
vfrag->vf_state &= ~MCA_PML_DR_VFRAG_RETRANS;
|
2006-03-23 02:06:18 +03:00
|
|
|
}
|
2006-03-23 18:11:06 +03:00
|
|
|
|
|
|
|
/* record vfrag id to drop duplicate acks */
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1, (0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-06-27 02:29:29 +04:00
|
|
|
|
2006-03-14 21:25:25 +03:00
|
|
|
/* return this vfrag */
|
|
|
|
MCA_PML_DR_VFRAG_RETURN(vfrag);
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* waiting on ack */
|
2006-03-23 02:06:18 +03:00
|
|
|
} else if (vfrag->vf_idx == vfrag->vf_len) {
|
2006-03-17 01:33:08 +03:00
|
|
|
MCA_PML_DR_VFRAG_ACK_START(vfrag);
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2006-03-23 18:11:06 +03:00
|
|
|
|
|
|
|
/* if not reset the watchdog timer */
|
2006-03-14 21:25:25 +03:00
|
|
|
} else {
|
|
|
|
MCA_PML_DR_VFRAG_WDOG_RESET(vfrag);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* are we done with this request ? */
|
2006-03-23 02:06:18 +03:00
|
|
|
if(OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, -1) == 0 &&
|
|
|
|
sendreq->req_bytes_delivered == sendreq->req_send.req_bytes_packed) {
|
2006-03-14 21:25:25 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
|
|
|
} else if (sendreq->req_send_offset < sendreq->req_send.req_bytes_packed ||
|
2006-03-17 01:33:08 +03:00
|
|
|
opal_list_get_size(&sendreq->req_retrans)) {
|
2005-11-22 20:24:47 +03:00
|
|
|
schedule = true;
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2006-03-17 01:33:08 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* return the descriptor */
|
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* schedule remainder of message? */
|
|
|
|
if(schedule) {
|
|
|
|
mca_pml_dr_send_request_schedule(sendreq);
|
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_DR_SEND_REQUEST_PROCESS_PENDING();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Buffer the entire message and mark as complete.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_dr_send_request_start_buffered(
|
|
|
|
mca_pml_dr_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size)
|
|
|
|
{
|
|
|
|
mca_btl_base_descriptor_t* descriptor;
|
|
|
|
mca_btl_base_segment_t* segment;
|
|
|
|
mca_pml_dr_hdr_t* hdr;
|
|
|
|
struct iovec iov;
|
|
|
|
unsigned int iov_count;
|
|
|
|
size_t max_data;
|
|
|
|
int32_t free_after;
|
|
|
|
int rc;
|
2006-02-24 20:08:14 +03:00
|
|
|
uint32_t csum;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
2006-02-24 20:08:14 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* allocate descriptor */
|
|
|
|
mca_bml_base_alloc(bml_btl, &descriptor, sizeof(mca_pml_dr_rendezvous_hdr_t) + size);
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2006-05-04 20:16:26 +04:00
|
|
|
sendreq->req_descriptor = descriptor; /* hang on to this for later */
|
2005-11-22 20:24:47 +03:00
|
|
|
segment = descriptor->des_src;
|
2006-03-02 01:37:10 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* pack the data into the BTL supplied buffer */
|
|
|
|
iov.iov_base = (void*)((unsigned char*)segment->seg_addr.pval +
|
|
|
|
sizeof(mca_pml_dr_rendezvous_hdr_t));
|
|
|
|
iov.iov_len = size;
|
|
|
|
iov_count = 1;
|
|
|
|
max_data = size;
|
|
|
|
if((rc = ompi_convertor_pack(
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
&iov,
|
|
|
|
&iov_count,
|
|
|
|
&max_data,
|
|
|
|
&free_after)) < 0) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
|
|
|
return rc;
|
|
|
|
}
|
2006-03-06 22:30:37 +03:00
|
|
|
csum = sendreq->req_send.req_convertor.checksum;
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* update lengths */
|
|
|
|
segment->seg_len = sizeof(mca_pml_dr_rendezvous_hdr_t) + max_data;
|
2005-12-21 00:42:58 +03:00
|
|
|
sendreq->req_vfrag0.vf_size = max_data;
|
2006-02-24 20:08:14 +03:00
|
|
|
sendreq->req_vfrag0.bml_btl = bml_btl;
|
2006-03-24 01:08:59 +03:00
|
|
|
sendreq->req_vfrag0.vf_state |= MCA_PML_DR_VFRAG_RNDV;
|
|
|
|
sendreq->req_vfrag0.vf_pending = 1;
|
2006-02-24 20:08:14 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
descriptor->des_cbfunc = mca_pml_dr_rndv_completion;
|
|
|
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2006-05-04 20:16:26 +04:00
|
|
|
descriptor->des_cbdata = &sendreq->req_vfrag0;
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* buffer the remainder of the message */
|
|
|
|
rc = mca_pml_base_bsend_request_alloc((ompi_request_t*)sendreq);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-03-22 18:02:36 +03:00
|
|
|
iov.iov_base = (void*)(((unsigned char*)sendreq->req_send.req_addr) + max_data);
|
|
|
|
iov.iov_len = sendreq->req_send.req_bytes_packed - max_data;
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-22 18:02:36 +03:00
|
|
|
max_data = iov.iov_len;
|
2005-11-22 20:24:47 +03:00
|
|
|
if((rc = ompi_convertor_pack(
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
&iov,
|
|
|
|
&iov_count,
|
|
|
|
&max_data,
|
|
|
|
&free_after)) < 0) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
/* build rendezvous header */
|
|
|
|
hdr = (mca_pml_dr_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_RNDV;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_common.hdr_vid = sendreq->req_vfrag0.vf_id;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_seq = sendreq->req_send.req_base.req_sequence;
|
2006-02-24 20:08:14 +03:00
|
|
|
hdr->hdr_match.hdr_csum = csum;
|
2006-03-04 03:36:16 +03:00
|
|
|
hdr->hdr_match.hdr_src_ptr.pval = &sendreq->req_vfrag0;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_rendezvous_hdr_t)) :
|
|
|
|
OPAL_CSUM_ZERO);
|
2006-02-24 20:08:14 +03:00
|
|
|
|
2006-06-13 23:36:38 +04:00
|
|
|
/* re-init convertor for packed data (it keep the flags) */
|
|
|
|
ompi_convertor_prepare_for_send( &sendreq->req_send.req_convertor,
|
2006-07-06 21:58:25 +04:00
|
|
|
MPI_BYTE,
|
|
|
|
sendreq->req_send.req_bytes_packed,
|
2006-06-13 23:36:38 +04:00
|
|
|
sendreq->req_send.req_addr );
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* request is complete at mpi level */
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
MCA_PML_DR_SEND_REQUEST_MPI_COMPLETE(sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
|
|
|
|
/* send */
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(&sendreq->req_vfrag0);
|
2006-03-24 09:49:45 +03:00
|
|
|
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
2005-11-22 20:24:47 +03:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor );
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BTL requires "specially" allocated memory. Request a segment that
|
|
|
|
* is used for initial hdr and any eager data.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_dr_send_request_start_copy(
|
|
|
|
mca_pml_dr_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size)
|
|
|
|
{
|
|
|
|
mca_btl_base_descriptor_t* descriptor;
|
|
|
|
mca_btl_base_segment_t* segment;
|
|
|
|
mca_pml_dr_hdr_t* hdr;
|
|
|
|
struct iovec iov;
|
|
|
|
unsigned int iov_count;
|
|
|
|
size_t max_data;
|
|
|
|
int32_t free_after;
|
|
|
|
int rc;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* allocate descriptor */
|
|
|
|
mca_bml_base_alloc(bml_btl, &descriptor, sizeof(mca_pml_dr_match_hdr_t) + size);
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2006-03-02 01:37:10 +03:00
|
|
|
}
|
2006-05-04 20:16:26 +04:00
|
|
|
sendreq->req_descriptor = descriptor; /* hang on to this for later */
|
2005-11-22 20:24:47 +03:00
|
|
|
segment = descriptor->des_src;
|
|
|
|
|
|
|
|
/* pack the data into the supplied buffer */
|
|
|
|
iov.iov_base = (void*)((unsigned char*)segment->seg_addr.pval + sizeof(mca_pml_dr_match_hdr_t));
|
|
|
|
iov.iov_len = size;
|
|
|
|
iov_count = 1;
|
|
|
|
max_data = size;
|
2006-02-16 19:15:16 +03:00
|
|
|
if(size > 0) {
|
|
|
|
if((rc = ompi_convertor_pack(
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
&iov,
|
|
|
|
&iov_count,
|
|
|
|
&max_data,
|
|
|
|
&free_after)) < 0) {
|
2005-11-22 20:24:47 +03:00
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
|
|
|
return rc;
|
2006-02-16 19:15:16 +03:00
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
2006-03-21 02:08:14 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* build match header */
|
|
|
|
hdr = (mca_pml_dr_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_MATCH;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_seq = sendreq->req_send.req_base.req_sequence;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_match.hdr_csum = (size > 0 && do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
sendreq->req_send.req_convertor.checksum : OPAL_CSUM_ZERO);
|
2006-03-04 03:36:16 +03:00
|
|
|
hdr->hdr_match.hdr_src_ptr.pval = &sendreq->req_vfrag0;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_vid = sendreq->req_vfrag0.vf_id;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_match_hdr_t)) :
|
|
|
|
OPAL_CSUM_ZERO);
|
2006-02-24 20:08:14 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* vfrag status */
|
2005-12-21 00:42:58 +03:00
|
|
|
sendreq->req_vfrag0.vf_size = max_data;
|
2006-02-24 20:08:14 +03:00
|
|
|
sendreq->req_vfrag0.bml_btl = bml_btl;
|
2006-03-24 01:08:59 +03:00
|
|
|
sendreq->req_vfrag0.vf_pending = 1;
|
2006-03-22 18:02:36 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* short message */
|
2006-03-04 03:36:16 +03:00
|
|
|
descriptor->des_cbfunc = mca_pml_dr_match_completion;
|
2005-11-22 20:24:47 +03:00
|
|
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2006-05-04 20:16:26 +04:00
|
|
|
descriptor->des_cbdata = &sendreq->req_vfrag0;
|
2006-03-23 18:11:06 +03:00
|
|
|
segment->seg_len = sizeof(mca_pml_dr_match_hdr_t) + max_data;
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* signal request completion */
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
MCA_PML_DR_SEND_REQUEST_MPI_COMPLETE(sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
|
|
|
|
/* send */
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(&sendreq->req_vfrag0);
|
2006-03-24 09:49:45 +03:00
|
|
|
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
2005-11-22 20:24:47 +03:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor );
|
2006-03-02 01:37:10 +03:00
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BTL can send directly from user buffer so allow the BTL
|
|
|
|
* to prepare the segment list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_dr_send_request_start_prepare(
|
|
|
|
mca_pml_dr_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size)
|
|
|
|
{
|
|
|
|
mca_btl_base_descriptor_t* descriptor;
|
|
|
|
mca_btl_base_segment_t* segment;
|
|
|
|
mca_pml_dr_hdr_t* hdr;
|
|
|
|
int rc;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* prepare descriptor */
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_dr_match_hdr_t),
|
|
|
|
&size,
|
|
|
|
&descriptor);
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2006-05-04 20:16:26 +04:00
|
|
|
sendreq->req_descriptor = descriptor; /* hang on to this for later */
|
2005-11-22 20:24:47 +03:00
|
|
|
segment = descriptor->des_src;
|
|
|
|
|
|
|
|
/* build match header */
|
|
|
|
hdr = (mca_pml_dr_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_MATCH;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_seq = sendreq->req_send.req_base.req_sequence;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_match.hdr_csum = (size > 0 && do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
sendreq->req_send.req_convertor.checksum : OPAL_CSUM_ZERO);
|
2006-03-04 03:36:16 +03:00
|
|
|
hdr->hdr_match.hdr_src_ptr.pval = &sendreq->req_vfrag0;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_vid = sendreq->req_vfrag0.vf_id;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_match_hdr_t)) :
|
|
|
|
OPAL_CSUM_ZERO);
|
2005-11-22 20:24:47 +03:00
|
|
|
|
|
|
|
/* short message */
|
2006-03-04 03:36:16 +03:00
|
|
|
descriptor->des_cbfunc = mca_pml_dr_match_completion;
|
2005-11-22 20:24:47 +03:00
|
|
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2006-05-04 20:16:26 +04:00
|
|
|
descriptor->des_cbdata = &sendreq->req_vfrag0;
|
2005-11-22 20:24:47 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* vfrag state */
|
2005-12-21 00:42:58 +03:00
|
|
|
sendreq->req_vfrag0.vf_size = size;
|
2006-02-24 20:08:14 +03:00
|
|
|
sendreq->req_vfrag0.bml_btl = bml_btl;
|
2006-03-24 01:08:59 +03:00
|
|
|
sendreq->req_vfrag0.vf_pending = 1;
|
2006-03-22 18:02:36 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* send */
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(&sendreq->req_vfrag0);
|
2006-03-24 09:49:45 +03:00
|
|
|
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
2005-11-22 20:24:47 +03:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor );
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rendezvous is required. Eager send up to
|
|
|
|
* the btls eager limit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_dr_send_request_start_rndv(
|
|
|
|
mca_pml_dr_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl,
|
|
|
|
size_t size,
|
|
|
|
int flags)
|
|
|
|
{
|
|
|
|
mca_btl_base_descriptor_t* des;
|
|
|
|
mca_btl_base_segment_t* segment;
|
|
|
|
mca_pml_dr_hdr_t* hdr;
|
|
|
|
int rc;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
|
|
|
|
2006-03-02 01:37:10 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* prepare descriptor */
|
|
|
|
if(size == 0) {
|
|
|
|
mca_bml_base_alloc(
|
|
|
|
bml_btl,
|
|
|
|
&des,
|
|
|
|
sizeof(mca_pml_dr_rendezvous_hdr_t)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_dr_rendezvous_hdr_t),
|
|
|
|
&size,
|
|
|
|
&des);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(NULL == des) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2006-05-04 20:16:26 +04:00
|
|
|
sendreq->req_descriptor = des; /* hang on to this for later */
|
2005-11-22 20:24:47 +03:00
|
|
|
segment = des->des_src;
|
2006-03-02 01:37:10 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* build hdr */
|
|
|
|
hdr = (mca_pml_dr_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = flags;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_RNDV;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
2006-03-23 18:11:06 +03:00
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_common.hdr_vid = sendreq->req_vfrag0.vf_id;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_seq = sendreq->req_send.req_base.req_sequence;
|
2006-03-04 03:36:16 +03:00
|
|
|
hdr->hdr_match.hdr_src_ptr.pval = &sendreq->req_vfrag0;
|
2006-03-17 21:46:48 +03:00
|
|
|
hdr->hdr_match.hdr_csum = size > 0 ? sendreq->req_send.req_convertor.checksum : OPAL_CSUM_ZERO;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_rendezvous_hdr_t)) :
|
|
|
|
OPAL_CSUM_ZERO);
|
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* first fragment of a long message */
|
|
|
|
des->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2006-05-04 20:16:26 +04:00
|
|
|
des->des_cbdata = &sendreq->req_vfrag0;
|
2005-11-22 20:24:47 +03:00
|
|
|
des->des_cbfunc = mca_pml_dr_rndv_completion;
|
2006-03-23 18:11:06 +03:00
|
|
|
|
|
|
|
/* vfrag state */
|
2005-12-21 00:42:58 +03:00
|
|
|
sendreq->req_vfrag0.vf_size = size;
|
2006-02-24 20:08:14 +03:00
|
|
|
sendreq->req_vfrag0.bml_btl = bml_btl;
|
2006-03-24 01:08:59 +03:00
|
|
|
sendreq->req_vfrag0.vf_state |= MCA_PML_DR_VFRAG_RNDV;
|
|
|
|
sendreq->req_vfrag0.vf_pending = 1;
|
2006-03-22 18:02:36 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* send */
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(&sendreq->req_vfrag0);
|
2006-03-24 09:49:45 +03:00
|
|
|
rc = mca_bml_base_send(bml_btl, des, MCA_BTL_TAG_PML);
|
2005-11-22 20:24:47 +03:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, des );
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Schedule pipeline of send descriptors for the given request,
|
|
|
|
* using send protocol.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_dr_send_request_schedule(mca_pml_dr_send_request_t* sendreq)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Only allow one thread in this routine for a given request.
|
|
|
|
* However, we cannot block callers on a mutex, so simply keep track
|
|
|
|
* of the number of times the routine has been called and run through
|
|
|
|
* the scheduling logic once for every call.
|
|
|
|
*/
|
2006-03-25 01:28:43 +03:00
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
mca_pml_dr_endpoint_t* endpoint = sendreq->req_endpoint;
|
2006-03-25 01:28:43 +03:00
|
|
|
assert(sendreq->req_vfrag0.vf_recv.pval != NULL);
|
2005-11-22 20:24:47 +03:00
|
|
|
if(OPAL_THREAD_ADD32(&sendreq->req_lock,1) == 1) {
|
|
|
|
do {
|
2006-05-04 20:16:26 +04:00
|
|
|
size_t bytes_remaining;
|
|
|
|
/*
|
|
|
|
* VFrags w/ nacks or that timed out
|
|
|
|
*/
|
|
|
|
while(opal_list_get_size(&sendreq->req_retrans) &&
|
|
|
|
sendreq->req_pipeline_depth < mca_pml_dr.send_pipeline_depth) {
|
|
|
|
mca_pml_dr_vfrag_t* vfrag;
|
|
|
|
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
vfrag = (mca_pml_dr_vfrag_t*)opal_list_get_first(&sendreq->req_retrans);
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
if(NULL == vfrag) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Retransmit fragments that have not been acked.
|
|
|
|
*/
|
|
|
|
while(vfrag->vf_idx < vfrag->vf_len &&
|
|
|
|
sendreq->req_pipeline_depth < mca_pml_dr.send_pipeline_depth) {
|
|
|
|
if(((uint64_t)1 << vfrag->vf_idx) & ~vfrag->vf_ack) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = vfrag->bml_btl;
|
|
|
|
mca_pml_dr_frag_hdr_t* hdr;
|
|
|
|
mca_btl_base_descriptor_t* des;
|
|
|
|
size_t offset_in_vfrag = vfrag->vf_max_send_size * vfrag->vf_idx;
|
|
|
|
size_t offset_in_msg = vfrag->vf_offset + offset_in_vfrag;
|
|
|
|
size_t size;
|
|
|
|
int rc;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
|
|
|
|
2006-05-04 20:16:26 +04:00
|
|
|
if(vfrag->vf_idx == vfrag->vf_len - 1) {
|
|
|
|
size = vfrag->vf_size - offset_in_vfrag;
|
|
|
|
} else {
|
|
|
|
size = vfrag->vf_max_send_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pack into a descriptor */
|
|
|
|
ompi_convertor_set_position(&sendreq->req_send.req_convertor, &offset_in_msg);
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_dr_frag_hdr_t),
|
|
|
|
&size,
|
|
|
|
&des
|
|
|
|
);
|
|
|
|
if(des == NULL) {
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
opal_list_append(&mca_pml_dr.send_pending, (opal_list_item_t*)sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
des->des_cbfunc = mca_pml_dr_frag_completion;
|
|
|
|
des->des_cbdata = vfrag;
|
|
|
|
|
|
|
|
/* setup header */
|
|
|
|
hdr = (mca_pml_dr_frag_hdr_t*)des->des_src->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_FRAG;
|
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
|
|
|
hdr->hdr_common.hdr_vid = vfrag->vf_id;
|
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_vlen = vfrag->vf_len;
|
|
|
|
hdr->hdr_frag_idx = vfrag->vf_idx;
|
|
|
|
hdr->hdr_frag_csum = sendreq->req_send.req_convertor.checksum;
|
|
|
|
hdr->hdr_frag_offset = offset_in_msg;
|
|
|
|
hdr->hdr_src_ptr.pval = vfrag;
|
|
|
|
hdr->hdr_dst_ptr = sendreq->req_vfrag0.vf_recv;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-05-04 20:16:26 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_frag_hdr_t)) :
|
|
|
|
OPAL_CSUM_ZERO);
|
|
|
|
|
|
|
|
/* adjust number of outstanding operations */
|
|
|
|
if(OPAL_THREAD_ADD64(&vfrag->vf_pending, 1) == 1) {
|
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(vfrag);
|
|
|
|
}
|
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,1);
|
|
|
|
|
|
|
|
/* adjust send offset - may not have finished scheduling entire vfrag */
|
|
|
|
if(offset_in_msg + size > sendreq->req_send_offset) {
|
|
|
|
sendreq->req_send_offset = offset_in_msg + size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initiate send - note that this may complete before the call returns */
|
|
|
|
rc = mca_bml_base_send( bml_btl, des, MCA_BTL_TAG_PML);
|
|
|
|
|
|
|
|
if(rc == OMPI_SUCCESS) {
|
|
|
|
bytes_remaining -= size;
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
|
|
|
mca_bml_base_free(bml_btl,des);
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
opal_list_append(&mca_pml_dr.send_pending, (opal_list_item_t*)sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vfrag->vf_idx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove from retrans list */
|
|
|
|
if(vfrag->vf_idx == vfrag->vf_len) {
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
opal_list_remove_item(&sendreq->req_retrans, (opal_list_item_t*)vfrag);
|
2006-05-04 21:30:58 +04:00
|
|
|
vfrag->vf_state &= ~MCA_PML_DR_VFRAG_RETRANS;
|
2006-05-04 20:16:26 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* allocate remaining bytes to BTLs */
|
2006-05-04 20:16:26 +04:00
|
|
|
bytes_remaining = sendreq->req_send.req_bytes_packed - sendreq->req_send_offset;
|
2005-11-22 20:24:47 +03:00
|
|
|
while(bytes_remaining > 0 &&
|
|
|
|
sendreq->req_pipeline_depth < mca_pml_dr.send_pipeline_depth) {
|
|
|
|
|
|
|
|
mca_pml_dr_frag_hdr_t* hdr;
|
|
|
|
mca_btl_base_descriptor_t* des;
|
2006-02-24 20:08:14 +03:00
|
|
|
mca_bml_base_btl_t* bml_btl = NULL;
|
2005-12-21 00:42:58 +03:00
|
|
|
mca_pml_dr_vfrag_t* vfrag = sendreq->req_vfrag;
|
|
|
|
size_t size = bytes_remaining;
|
2006-06-28 00:23:47 +04:00
|
|
|
|
2006-02-16 19:15:16 +03:00
|
|
|
/* offset tells us how much of the vfrag has been scheduled */
|
2006-03-25 01:28:43 +03:00
|
|
|
size_t bytes_sent = sendreq->req_send_offset - vfrag->vf_offset;
|
2005-12-21 00:42:58 +03:00
|
|
|
int rc;
|
2006-06-28 00:23:47 +04:00
|
|
|
bool do_csum;
|
|
|
|
|
2006-02-16 19:15:16 +03:00
|
|
|
/* do we need to allocate a new vfrag
|
|
|
|
(we scheduled all the vfrag already) */
|
2006-03-25 01:28:43 +03:00
|
|
|
if(vfrag->vf_size == bytes_sent) {
|
2006-07-04 05:20:20 +04:00
|
|
|
bml_btl = mca_bml_base_btl_array_get_next(&endpoint->bml_endpoint->btl_send);
|
2005-12-21 00:42:58 +03:00
|
|
|
MCA_PML_DR_VFRAG_ALLOC(vfrag,rc);
|
|
|
|
if(NULL == vfrag) {
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_dr.lock);
|
|
|
|
opal_list_append(&mca_pml_dr.send_pending, (opal_list_item_t*)sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_dr.lock);
|
|
|
|
break;
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
2006-03-29 20:19:17 +04:00
|
|
|
MCA_PML_DR_SEND_REQUEST_VFRAG_INIT(sendreq,endpoint,bytes_remaining,vfrag);
|
2006-02-24 20:08:14 +03:00
|
|
|
vfrag->bml_btl = bml_btl;
|
2006-03-25 01:28:43 +03:00
|
|
|
bytes_sent = 0;
|
2006-03-02 01:37:10 +03:00
|
|
|
|
2006-02-24 20:08:14 +03:00
|
|
|
} else { /* always schedule the vfrag accross the same btl */
|
|
|
|
bml_btl = vfrag->bml_btl;
|
2005-11-22 20:24:47 +03:00
|
|
|
}
|
2005-12-21 00:42:58 +03:00
|
|
|
|
2006-06-28 00:23:47 +04:00
|
|
|
do_csum = mca_pml_dr.enable_csum &&
|
|
|
|
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
/* makes sure that we don't exceed vfrag size */
|
|
|
|
if (size > vfrag->vf_max_send_size) {
|
|
|
|
size = vfrag->vf_max_send_size;
|
|
|
|
}
|
2006-03-25 01:28:43 +03:00
|
|
|
if (size > vfrag->vf_size - bytes_sent) {
|
|
|
|
size = vfrag->vf_size - bytes_sent;
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* pack into a descriptor */
|
2005-12-21 00:42:58 +03:00
|
|
|
ompi_convertor_set_position(&sendreq->req_send.req_convertor, &sendreq->req_send_offset);
|
2005-11-22 20:24:47 +03:00
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_dr_frag_hdr_t),
|
|
|
|
&size,
|
|
|
|
&des
|
|
|
|
);
|
|
|
|
if(des == NULL) {
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_dr.lock);
|
|
|
|
opal_list_append(&mca_pml_dr.send_pending, (opal_list_item_t*)sendreq);
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_dr.lock);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
des->des_cbfunc = mca_pml_dr_frag_completion;
|
2006-02-24 20:08:14 +03:00
|
|
|
des->des_cbdata = vfrag;
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* setup header */
|
|
|
|
hdr = (mca_pml_dr_frag_hdr_t*)des->des_src->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_common.hdr_csum = 0;
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_DR_HDR_TYPE_FRAG;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_dst = sendreq->req_endpoint->dst;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_vid = vfrag->vf_id;
|
2006-03-29 20:19:17 +04:00
|
|
|
hdr->hdr_common.hdr_src = sendreq->req_endpoint->src;
|
2006-03-16 22:38:21 +03:00
|
|
|
hdr->hdr_common.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid;
|
2005-12-21 00:42:58 +03:00
|
|
|
hdr->hdr_vlen = vfrag->vf_len;
|
|
|
|
hdr->hdr_frag_idx = vfrag->vf_idx;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_frag_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
sendreq->req_send.req_convertor.checksum : OPAL_CSUM_ZERO);
|
2005-11-22 20:24:47 +03:00
|
|
|
hdr->hdr_frag_offset = sendreq->req_send_offset;
|
2006-03-04 03:36:16 +03:00
|
|
|
hdr->hdr_src_ptr.pval = vfrag;
|
|
|
|
hdr->hdr_dst_ptr = sendreq->req_vfrag0.vf_recv;
|
2006-06-28 00:23:47 +04:00
|
|
|
hdr->hdr_common.hdr_csum = (do_csum ?
|
2006-04-11 01:54:46 +04:00
|
|
|
opal_csum(hdr, sizeof(mca_pml_dr_frag_hdr_t)): OPAL_CSUM_ZERO);
|
2006-03-23 02:06:18 +03:00
|
|
|
|
|
|
|
assert(hdr->hdr_frag_offset < sendreq->req_send.req_bytes_packed);
|
|
|
|
|
2005-11-22 20:24:47 +03:00
|
|
|
/* update state */
|
2005-12-21 00:42:58 +03:00
|
|
|
vfrag->vf_idx++;
|
2006-05-04 20:16:26 +04:00
|
|
|
if(OPAL_THREAD_ADD64(&vfrag->vf_pending,1) == 1) {
|
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(vfrag);
|
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
sendreq->req_send_offset += size;
|
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,1);
|
|
|
|
|
|
|
|
/* initiate send - note that this may complete before the call returns */
|
|
|
|
rc = mca_bml_base_send( bml_btl, des, MCA_BTL_TAG_PML);
|
|
|
|
|
|
|
|
if(rc == OMPI_SUCCESS) {
|
|
|
|
bytes_remaining -= size;
|
|
|
|
} else {
|
|
|
|
sendreq->req_send_offset -= size;
|
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
|
|
|
mca_bml_base_free(bml_btl,des);
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2005-11-22 20:24:47 +03:00
|
|
|
opal_list_append(&mca_pml_dr.send_pending, (opal_list_item_t*)sendreq);
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2005-11-22 20:24:47 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
2005-11-22 20:24:47 +03:00
|
|
|
} while (OPAL_THREAD_ADD32(&sendreq->req_lock,-1) > 0);
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-12-21 00:42:58 +03:00
|
|
|
|
|
|
|
/**
|
2006-03-04 03:36:16 +03:00
|
|
|
* Acknowledgment of match vfrag.
|
2005-12-21 00:42:58 +03:00
|
|
|
*/
|
2006-03-04 03:36:16 +03:00
|
|
|
|
|
|
|
void mca_pml_dr_send_request_match_ack(
|
|
|
|
mca_btl_base_module_t* btl,
|
2005-12-21 00:42:58 +03:00
|
|
|
mca_pml_dr_ack_hdr_t* ack)
|
|
|
|
{
|
2006-03-04 03:36:16 +03:00
|
|
|
mca_pml_dr_vfrag_t* vfrag = ack->hdr_src_ptr.pval;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
2006-03-21 00:57:30 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
|
|
|
|
2006-03-21 17:30:54 +03:00
|
|
|
vfrag->vf_ack = ack->hdr_vmask & vfrag->vf_mask;
|
2006-03-24 01:08:59 +03:00
|
|
|
if (vfrag->vf_pending == 0) {
|
2006-03-21 00:57:30 +03:00
|
|
|
MCA_PML_DR_VFRAG_ACK_STOP(vfrag);
|
|
|
|
/* need to retransmit? */
|
2006-03-21 17:30:54 +03:00
|
|
|
if(vfrag->vf_ack != vfrag->vf_mask) {
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(vfrag);
|
2006-03-22 00:23:33 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_EAGER_RETRY(sendreq, vfrag);
|
2006-03-21 00:57:30 +03:00
|
|
|
} else {
|
|
|
|
/* if already have local completion free descriptor and complete message */
|
|
|
|
/* return descriptor */
|
2006-05-04 20:16:26 +04:00
|
|
|
if(NULL != sendreq->req_descriptor) {
|
|
|
|
mca_bml_base_free(sendreq->req_descriptor->des_context, sendreq->req_descriptor );
|
|
|
|
sendreq->req_descriptor = NULL;
|
2006-03-21 00:57:30 +03:00
|
|
|
}
|
|
|
|
|
2006-03-22 18:02:36 +03:00
|
|
|
/* update statistics */
|
|
|
|
sendreq->req_bytes_delivered = vfrag->vf_size;
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1, (0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-03-22 18:02:36 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
|
|
|
|
/* wait for local completion */
|
|
|
|
} else {
|
2006-03-21 00:57:30 +03:00
|
|
|
/* need to retransmit? */
|
2006-03-24 01:08:59 +03:00
|
|
|
if (vfrag->vf_ack != vfrag->vf_mask) {
|
|
|
|
vfrag->vf_state |= MCA_PML_DR_VFRAG_NACKED;
|
2006-03-22 18:02:36 +03:00
|
|
|
} else {
|
|
|
|
vfrag->vf_recv = ack->hdr_dst_ptr;
|
2006-03-06 22:30:37 +03:00
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-03-23 18:11:06 +03:00
|
|
|
* Acknowledgment of rendezvous vfrag.
|
2006-03-04 03:36:16 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
void mca_pml_dr_send_request_rndv_ack(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_pml_dr_ack_hdr_t* ack)
|
|
|
|
{
|
|
|
|
mca_pml_dr_vfrag_t* vfrag = ack->hdr_src_ptr.pval;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
2006-03-21 00:57:30 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2006-03-17 01:33:08 +03:00
|
|
|
|
2006-03-21 17:30:54 +03:00
|
|
|
/* set acked bits */
|
|
|
|
vfrag->vf_ack = ack->hdr_vmask & vfrag->vf_mask;
|
|
|
|
|
|
|
|
/* local completion? */
|
2006-03-24 01:08:59 +03:00
|
|
|
if (vfrag->vf_pending == 0) {
|
2006-03-06 22:30:37 +03:00
|
|
|
bool schedule = false;
|
2006-03-21 00:57:30 +03:00
|
|
|
MCA_PML_DR_VFRAG_ACK_STOP(vfrag);
|
2006-03-21 17:30:54 +03:00
|
|
|
|
2006-03-21 00:57:30 +03:00
|
|
|
/* need to retransmit? */
|
2006-03-21 17:30:54 +03:00
|
|
|
if(vfrag->vf_ack != vfrag->vf_mask) {
|
2006-03-22 00:23:33 +03:00
|
|
|
/* got a NACK, resend eager data! */
|
2006-05-04 20:16:26 +04:00
|
|
|
MCA_PML_DR_VFRAG_WDOG_START(vfrag);
|
2006-03-22 00:23:33 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_EAGER_RETRY(sendreq, vfrag);
|
2006-03-23 18:11:06 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2006-03-22 18:02:36 +03:00
|
|
|
} else {
|
2006-03-21 17:30:54 +03:00
|
|
|
/* return descriptor of first fragment */
|
2006-05-04 20:16:26 +04:00
|
|
|
if(NULL != sendreq->req_descriptor) {
|
|
|
|
mca_bml_base_free(sendreq->req_descriptor->des_context, sendreq->req_descriptor);
|
|
|
|
sendreq->req_descriptor = NULL;
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
2006-03-06 22:30:37 +03:00
|
|
|
|
2006-03-22 18:02:36 +03:00
|
|
|
/* done? */
|
2006-03-24 09:49:45 +03:00
|
|
|
sendreq->req_send_offset = ack->hdr_vlen;
|
2006-03-22 18:02:36 +03:00
|
|
|
sendreq->req_bytes_delivered = ack->hdr_vlen;
|
2006-03-24 02:04:20 +03:00
|
|
|
if(sendreq->req_bytes_delivered == sendreq->req_send.req_bytes_packed) {
|
2006-03-22 18:02:36 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
2006-03-24 09:49:45 +03:00
|
|
|
} else {
|
|
|
|
/* start scheduling with a new vfrag */
|
2006-03-22 18:02:36 +03:00
|
|
|
vfrag->vf_recv = ack->hdr_dst_ptr;
|
2006-03-25 01:28:43 +03:00
|
|
|
/* vfrag->vf_state = 0; */
|
|
|
|
/* sendreq->req_send_offset = ack->hdr_vlen; */
|
2006-03-24 02:36:07 +03:00
|
|
|
vfrag->vf_state = 0;
|
2006-03-24 09:49:45 +03:00
|
|
|
vfrag->vf_size = ack->hdr_vlen;
|
2006-03-22 18:02:36 +03:00
|
|
|
schedule = true;
|
2006-03-21 00:57:30 +03:00
|
|
|
}
|
2006-03-24 09:49:45 +03:00
|
|
|
|
2006-03-23 18:11:06 +03:00
|
|
|
/* stash the vfrag id for duplicate acks.. */
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1, (0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-03-23 02:06:18 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
|
2006-03-21 00:57:30 +03:00
|
|
|
if(schedule) {
|
|
|
|
mca_pml_dr_send_request_schedule(sendreq);
|
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
2006-03-21 17:30:54 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* wait for local completion */
|
|
|
|
} else {
|
2006-03-21 00:57:30 +03:00
|
|
|
/* need to retransmit? */
|
2006-03-21 17:30:54 +03:00
|
|
|
if(vfrag->vf_ack != vfrag->vf_mask) {
|
2006-03-24 01:08:59 +03:00
|
|
|
vfrag->vf_state |= MCA_PML_DR_VFRAG_NACKED;
|
2006-03-21 00:57:30 +03:00
|
|
|
} else {
|
2006-03-24 01:08:59 +03:00
|
|
|
/* will need this to schedule rest of the message */
|
2006-03-21 00:57:30 +03:00
|
|
|
vfrag->vf_recv = ack->hdr_dst_ptr;
|
2006-03-24 02:36:07 +03:00
|
|
|
vfrag->vf_state = 0;
|
2006-03-24 09:49:45 +03:00
|
|
|
vfrag->vf_size = ack->hdr_vlen;
|
2006-03-22 18:02:36 +03:00
|
|
|
sendreq->req_send_offset = ack->hdr_vlen;
|
2006-03-23 02:06:18 +03:00
|
|
|
sendreq->req_bytes_delivered = ack->hdr_vlen;
|
2006-03-04 03:36:16 +03:00
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Acknowledgment of vfrag.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void mca_pml_dr_send_request_frag_ack(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_pml_dr_ack_hdr_t* ack)
|
|
|
|
{
|
|
|
|
mca_pml_dr_vfrag_t* vfrag = ack->hdr_src_ptr.pval;
|
|
|
|
mca_pml_dr_send_request_t* sendreq = vfrag->vf_send.pval;
|
|
|
|
bool schedule = false;
|
2006-03-24 09:49:45 +03:00
|
|
|
|
2006-03-17 01:33:08 +03:00
|
|
|
MCA_PML_DR_VFRAG_ACK_STOP(vfrag);
|
2006-03-04 03:36:16 +03:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2006-03-17 01:33:08 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* add in acknowledged fragments */
|
2006-03-06 22:30:37 +03:00
|
|
|
vfrag->vf_ack |= (ack->hdr_vmask & vfrag->vf_mask);
|
2006-03-04 03:36:16 +03:00
|
|
|
|
|
|
|
/* need to retransmit? */
|
2006-03-23 18:11:06 +03:00
|
|
|
if(vfrag->vf_ack != vfrag->vf_mask) {
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(0,(0, "got a vfrag NACK, retransmitting %x\n", ~vfrag->vf_ack));
|
2006-03-24 09:49:45 +03:00
|
|
|
MCA_PML_DR_SEND_REQUEST_VFRAG_RETRANS(sendreq,vfrag);
|
2006-03-04 03:36:16 +03:00
|
|
|
schedule = true;
|
2006-03-24 01:08:59 +03:00
|
|
|
|
2006-03-04 03:36:16 +03:00
|
|
|
/* acked and local completion */
|
2006-03-24 01:08:59 +03:00
|
|
|
} else if (vfrag->vf_pending == 0 && vfrag->vf_idx == vfrag->vf_len) {
|
2006-03-04 03:36:16 +03:00
|
|
|
|
|
|
|
/* update statistics */
|
|
|
|
sendreq->req_bytes_delivered += vfrag->vf_size;
|
2006-03-21 17:30:54 +03:00
|
|
|
assert(sendreq->req_bytes_delivered <= sendreq->req_send.req_bytes_packed);
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2006-03-23 02:06:18 +03:00
|
|
|
/* stash the vfid for duplicate acks.. */
|
2006-06-27 02:29:29 +04:00
|
|
|
MCA_PML_DR_DEBUG(1,(0, "%s:%d: inserting vid %d into sequence tracker\n",
|
|
|
|
__FILE__, __LINE__, vfrag->vf_id));
|
|
|
|
|
2006-03-29 20:19:17 +04:00
|
|
|
ompi_seq_tracker_insert(&sendreq->req_endpoint->seq_sends, vfrag->vf_id);
|
2006-03-04 03:36:16 +03:00
|
|
|
/* return vfrag */
|
|
|
|
MCA_PML_DR_VFRAG_RETURN(vfrag);
|
|
|
|
|
|
|
|
/* are we done with this request ? */
|
|
|
|
if(sendreq->req_bytes_delivered == sendreq->req_send.req_bytes_packed) {
|
|
|
|
MCA_PML_DR_SEND_REQUEST_PML_COMPLETE(sendreq);
|
|
|
|
/* is there something left to schedule */
|
|
|
|
} else if (sendreq->req_send_offset < sendreq->req_send.req_bytes_packed) {
|
|
|
|
schedule = true;
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
|
|
|
if(schedule) {
|
|
|
|
mca_pml_dr_send_request_schedule(sendreq);
|
|
|
|
}
|
2005-12-21 00:42:58 +03:00
|
|
|
}
|
2006-03-04 03:36:16 +03:00
|
|
|
|
2006-03-28 02:44:26 +04:00
|
|
|
|