2005-05-24 02:06:50 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* 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$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2005-06-17 22:25:44 +04:00
|
|
|
#include <sched.h>
|
2005-08-13 01:42:07 +04:00
|
|
|
#include "ompi/include/constants.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "mca/pml/pml.h"
|
2005-06-30 09:50:55 +04:00
|
|
|
#include "mca/btl/btl.h"
|
2005-06-10 00:16:33 +04:00
|
|
|
#include "mca/errmgr/errmgr.h"
|
2005-06-25 01:12:38 +04:00
|
|
|
#include "mca/mpool/mpool.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1.h"
|
|
|
|
#include "pml_ob1_hdr.h"
|
|
|
|
#include "pml_ob1_proc.h"
|
|
|
|
#include "pml_ob1_sendreq.h"
|
2005-06-10 00:16:33 +04:00
|
|
|
#include "pml_ob1_rdmafrag.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "pml_ob1_recvreq.h"
|
|
|
|
#include "pml_ob1_endpoint.h"
|
2005-08-12 06:41:14 +04:00
|
|
|
#include "mca/bml/base/base.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
static int mca_pml_ob1_send_request_fini(struct ompi_request_t** request)
|
|
|
|
{
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_FINI(request);
|
2005-05-24 02:06:50 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_pml_ob1_send_request_free(struct ompi_request_t** request)
|
|
|
|
{
|
2005-05-24 02:22:20 +04:00
|
|
|
MCA_PML_OB1_FREE(request);
|
2005-05-24 02:06:50 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_pml_ob1_send_request_cancel(struct ompi_request_t* request, int complete)
|
|
|
|
{
|
|
|
|
/* we dont cancel send requests by now */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_pml_ob1_send_request_construct(mca_pml_ob1_send_request_t* req)
|
|
|
|
{
|
|
|
|
req->req_send.req_base.req_type = MCA_PML_REQUEST_SEND;
|
|
|
|
req->req_send.req_base.req_ompi.req_fini = mca_pml_ob1_send_request_fini;
|
|
|
|
req->req_send.req_base.req_ompi.req_free = mca_pml_ob1_send_request_free;
|
|
|
|
req->req_send.req_base.req_ompi.req_cancel = mca_pml_ob1_send_request_cancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_pml_ob1_send_request_destruct(mca_pml_ob1_send_request_t* req)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_pml_ob1_send_request_t,
|
|
|
|
mca_pml_base_send_request_t,
|
|
|
|
mca_pml_ob1_send_request_construct,
|
|
|
|
mca_pml_ob1_send_request_destruct);
|
|
|
|
|
|
|
|
/**
|
2005-06-09 00:37:19 +04:00
|
|
|
* Completion of a short message - nothing left to schedule.
|
2005-05-24 02:06:50 +04:00
|
|
|
*/
|
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
void mca_pml_ob1_match_completion(
|
2005-08-12 06:41:14 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-30 09:50:55 +04:00
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
2005-05-24 02:06:50 +04:00
|
|
|
int status)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) descriptor->des_context;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
|
|
|
/* TSW - FIX */
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "%s:%d FATAL", __FILE__, __LINE__);
|
2005-06-10 00:16:33 +04:00
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
/* attempt to cache the descriptor */
|
2005-08-12 23:29:05 +04:00
|
|
|
MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor );
|
2005-06-02 23:51:51 +04:00
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
/* signal request completion */
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_bytes_delivered = sendreq->req_send.req_bytes_packed;
|
2005-06-10 00:16:33 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_COMPLETE(sendreq);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2005-06-09 00:37:19 +04:00
|
|
|
}
|
|
|
|
|
2005-07-18 22:54:25 +04:00
|
|
|
/*
|
|
|
|
* Completion of the first fragment of a long message that
|
|
|
|
* requires an acknowledgement
|
2005-06-09 00:37:19 +04:00
|
|
|
*/
|
2005-07-18 22:54:25 +04:00
|
|
|
static void mca_pml_ob1_rndv_completion(
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
2005-06-09 00:37:19 +04:00
|
|
|
int status)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) descriptor->des_context;
|
2005-06-10 00:16:33 +04:00
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
|
|
|
/* TSW - FIX */
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "%s:%d FATAL", __FILE__, __LINE__);
|
2005-06-10 00:16:33 +04:00
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
2005-06-09 00:37:19 +04:00
|
|
|
|
|
|
|
/* count bytes of user data actually delivered */
|
2005-08-12 23:29:05 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_SET_BYTES_DELIVERED(sendreq,descriptor,sizeof(mca_pml_ob1_rendezvous_hdr_t));
|
2005-07-18 22:54:25 +04:00
|
|
|
|
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
if(sendreq->req_pipeline_depth == 1) {
|
|
|
|
sendreq->t_send2 = get_profiler_timestamp();
|
2005-06-09 00:37:19 +04:00
|
|
|
}
|
2005-07-18 22:54:25 +04:00
|
|
|
#endif
|
2005-06-09 00:37:19 +04:00
|
|
|
|
2005-07-18 22:54:25 +04:00
|
|
|
/* return the descriptor */
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
2005-07-18 22:54:25 +04:00
|
|
|
|
|
|
|
/* advance the request */
|
|
|
|
MCA_PML_OB1_SEND_REQUEST_ADVANCE(sendreq);
|
2005-07-19 01:22:55 +04:00
|
|
|
|
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_OB1_SEND_REQUEST_PROCESS_PENDING();
|
2005-07-18 22:54:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Completion of additional fragments of a large message - may need
|
|
|
|
* to schedule additional fragments.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_pml_ob1_frag_completion(
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
int status)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) descriptor->des_context;
|
2005-07-18 22:54:25 +04:00
|
|
|
bool schedule;
|
|
|
|
|
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
|
|
|
/* TSW - FIX */
|
|
|
|
opal_output(0, "%s:%d FATAL", __FILE__, __LINE__);
|
|
|
|
orte_errmgr.abort();
|
2005-06-09 00:37:19 +04:00
|
|
|
}
|
|
|
|
|
2005-07-18 22:54:25 +04:00
|
|
|
/* count bytes of user data actually delivered */
|
2005-08-12 23:29:05 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_SET_BYTES_DELIVERED(sendreq,descriptor,sizeof(mca_pml_ob1_frag_hdr_t));
|
2005-07-18 22:54:25 +04:00
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
if(sendreq->req_pipeline_depth == 1) {
|
|
|
|
sendreq->t_send2 = get_profiler_timestamp();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-07-18 22:54:25 +04:00
|
|
|
/* return the descriptor */
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl, descriptor);
|
2005-07-18 22:54:25 +04:00
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
/* check for request completion */
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2005-08-02 21:36:01 +04:00
|
|
|
if (OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1) == 0 &&
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_bytes_delivered == sendreq->req_send.req_bytes_packed) {
|
2005-07-18 22:54:25 +04:00
|
|
|
MCA_PML_OB1_SEND_REQUEST_COMPLETE(sendreq);
|
|
|
|
schedule = false;
|
|
|
|
} else {
|
|
|
|
schedule = true;
|
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2005-07-18 22:54:25 +04:00
|
|
|
if(schedule) {
|
|
|
|
mca_pml_ob1_send_request_schedule(sendreq);
|
|
|
|
}
|
2005-06-10 00:16:33 +04:00
|
|
|
|
2005-07-19 01:22:55 +04:00
|
|
|
/* check for pending requests */
|
|
|
|
MCA_PML_OB1_SEND_REQUEST_PROCESS_PENDING();
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-30 09:50:55 +04:00
|
|
|
* BTL requires "specially" allocated memory. Request a segment that
|
2005-05-24 02:06:50 +04:00
|
|
|
* is used for initial hdr and any eager data.
|
|
|
|
*/
|
|
|
|
|
2005-08-13 01:33:01 +04:00
|
|
|
int mca_pml_ob1_send_request_start_copy(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl)
|
2005-05-24 02:06:50 +04:00
|
|
|
{
|
2005-08-12 18:40:06 +04:00
|
|
|
int rc;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_descriptor_t* descriptor;
|
|
|
|
mca_btl_base_segment_t* segment;
|
2005-05-24 02:06:50 +04:00
|
|
|
mca_pml_ob1_hdr_t* hdr;
|
2005-08-12 18:08:40 +04:00
|
|
|
size_t size = sendreq->req_send.req_bytes_packed;
|
2005-08-12 23:29:05 +04:00
|
|
|
struct iovec iov;
|
|
|
|
unsigned int iov_count;
|
|
|
|
size_t max_data;
|
|
|
|
bool ack = false;
|
|
|
|
|
|
|
|
/* determine first fragment size */
|
|
|
|
if(size > bml_btl->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t)) {
|
|
|
|
size = bml_btl->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t);
|
|
|
|
ack = true;
|
|
|
|
} else if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_SYNCHRONOUS) {
|
|
|
|
ack = true;
|
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* if an acknowledgment is not required - can get by w/ shorter hdr */
|
|
|
|
if (ack == false) {
|
|
|
|
int32_t free_after;
|
2005-08-12 06:41:14 +04:00
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* allocate descriptor */
|
|
|
|
mca_bml_base_alloc(bml_btl, &descriptor, sizeof(mca_pml_ob1_match_hdr_t) + size);
|
2005-06-07 18:12:47 +04:00
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2005-06-06 20:17:43 +04:00
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
segment = descriptor->des_src;
|
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* pack the data into the supplied buffer */
|
|
|
|
iov.iov_base = (void*)((unsigned char*)segment->seg_addr.pval + sizeof(mca_pml_ob1_match_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* build match header */
|
2005-05-24 02:06:50 +04:00
|
|
|
hdr = (mca_pml_ob1_hdr_t*)segment->seg_addr.pval;
|
2005-06-06 20:17:43 +04:00
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
2005-06-09 00:37:19 +04:00
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_MATCH;
|
2005-05-24 02:06:50 +04:00
|
|
|
hdr->hdr_match.hdr_contextid = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank;
|
|
|
|
hdr->hdr_match.hdr_dst = sendreq->req_send.req_base.req_peer;
|
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
2005-08-12 23:29:05 +04:00
|
|
|
hdr->hdr_match.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
2005-05-24 02:06:50 +04:00
|
|
|
hdr->hdr_match.hdr_msg_seq = sendreq->req_send.req_base.req_sequence;
|
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* update lengths */
|
|
|
|
segment->seg_len = sizeof(mca_pml_ob1_match_hdr_t) + max_data;
|
|
|
|
sendreq->req_send_offset = max_data;
|
|
|
|
sendreq->req_rdma_offset = max_data;
|
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
/* short message */
|
2005-07-18 22:54:25 +04:00
|
|
|
descriptor->des_cbfunc = mca_pml_ob1_match_completion;
|
2005-08-12 23:29:05 +04:00
|
|
|
|
2005-06-09 00:37:19 +04:00
|
|
|
/* request is complete at mpi level */
|
|
|
|
ompi_request_complete((ompi_request_t*)sendreq);
|
2005-08-12 23:29:05 +04:00
|
|
|
|
|
|
|
/* rendezvous header is required */
|
2005-05-24 02:06:50 +04:00
|
|
|
} else {
|
2005-08-12 23:29:05 +04:00
|
|
|
int32_t free_after;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* allocate space for hdr + first fragment */
|
|
|
|
mca_bml_base_alloc(bml_btl, &descriptor, sizeof(mca_pml_ob1_rendezvous_hdr_t) + size);
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2005-06-01 18:34:22 +04:00
|
|
|
}
|
2005-08-12 23:29:05 +04:00
|
|
|
segment = descriptor->des_src;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* check to see if memory is registered */
|
|
|
|
sendreq->req_chunk = mca_mpool_base_find(sendreq->req_send.req_addr);
|
2005-06-09 00:37:19 +04:00
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
|
|
|
|
/* if the buffer is not pinned and leave pinned is false we eagerly send
|
|
|
|
data to cover the cost of pinning the recv buffers on the peer */
|
|
|
|
if(size && NULL == sendreq->req_chunk && !mca_pml_ob1.leave_pinned) {
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
/* pack the data into the supplied buffer */
|
2005-08-12 23:29:05 +04:00
|
|
|
iov.iov_base = (void*)((unsigned char*)segment->seg_addr.pval +
|
|
|
|
sizeof(mca_pml_ob1_rendezvous_hdr_t));
|
2005-05-24 02:06:50 +04:00
|
|
|
iov.iov_len = size;
|
|
|
|
iov_count = 1;
|
|
|
|
max_data = size;
|
|
|
|
if((rc = ompi_convertor_pack(
|
2005-08-12 23:29:05 +04:00
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
&iov,
|
|
|
|
&iov_count,
|
|
|
|
&max_data,
|
|
|
|
&free_after)) < 0) {
|
|
|
|
mca_bml_base_free(bml_btl , descriptor);
|
2005-05-24 02:06:50 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2005-08-12 23:29:05 +04:00
|
|
|
if(max_data != size) {
|
|
|
|
opal_output(0, "[%s:%d] max_data (%lu) != size (%lu)\n", __FILE__,__LINE__,max_data,size);
|
2005-06-09 00:37:19 +04:00
|
|
|
}
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
2005-08-12 23:29:05 +04:00
|
|
|
/* if the buffer is pinned or leave pinned is true we do not eagerly send
|
|
|
|
any data */
|
|
|
|
else {
|
|
|
|
max_data = 0;
|
|
|
|
}
|
|
|
|
/* build hdr */
|
|
|
|
hdr = (mca_pml_ob1_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = (sendreq->req_chunk != NULL ? MCA_PML_OB1_HDR_FLAGS_PIN : 0);
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_RNDV;
|
|
|
|
hdr->hdr_match.hdr_contextid = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank;
|
|
|
|
hdr->hdr_match.hdr_dst = sendreq->req_send.req_base.req_peer;
|
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
|
|
|
hdr->hdr_match.hdr_msg_seq = sendreq->req_send.req_base.req_sequence;
|
|
|
|
hdr->hdr_rndv.hdr_src_req.lval = 0; /* for VALGRIND/PURIFY - REPLACE WITH MACRO */
|
|
|
|
hdr->hdr_rndv.hdr_src_req.pval = sendreq;
|
|
|
|
hdr->hdr_rndv.hdr_frag_length = max_data;
|
|
|
|
|
|
|
|
/* update lengths with number of bytes actually packed */
|
|
|
|
segment->seg_len = sizeof(mca_pml_ob1_rendezvous_hdr_t) + max_data;
|
|
|
|
sendreq->req_send_offset = max_data;
|
|
|
|
|
2005-08-13 01:33:01 +04:00
|
|
|
/* first fragment of a long message */
|
|
|
|
descriptor->des_cbfunc = mca_pml_ob1_rndv_completion;
|
|
|
|
}
|
|
|
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
|
|
|
descriptor->des_cbdata = sendreq;
|
|
|
|
|
|
|
|
/* send */
|
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
sendreq->t_start = get_profiler_timestamp();
|
|
|
|
#endif
|
|
|
|
rc = mca_bml_base_send(bml_btl,
|
|
|
|
descriptor,
|
|
|
|
MCA_BTL_TAG_PML);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
mca_bml_base_free(bml_btl, descriptor );
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BTL can send directly from user buffer so allow the BTL
|
|
|
|
* to prepare the segment list.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_pml_ob1_send_request_start_prepare(
|
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_bml_base_btl_t* bml_btl)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
mca_btl_base_descriptor_t* descriptor;
|
|
|
|
mca_btl_base_segment_t* segment;
|
|
|
|
mca_pml_ob1_hdr_t* hdr;
|
|
|
|
size_t size = sendreq->req_send.req_bytes_packed;
|
|
|
|
bool ack = false;
|
|
|
|
|
|
|
|
/* determine first fragment size */
|
|
|
|
if(size > bml_btl->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t)) {
|
|
|
|
size = bml_btl->btl_eager_limit - sizeof(mca_pml_ob1_hdr_t);
|
|
|
|
ack = true;
|
|
|
|
} else if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_SYNCHRONOUS) {
|
|
|
|
ack = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if an acknowledgment is not required - can get by w/ shorter hdr */
|
|
|
|
if (ack == false) {
|
|
|
|
|
|
|
|
/* prepare descriptor */
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_ob1_match_hdr_t),
|
|
|
|
&size,
|
|
|
|
&descriptor);
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
segment = descriptor->des_src;
|
|
|
|
|
|
|
|
/* build match header */
|
|
|
|
hdr = (mca_pml_ob1_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_MATCH;
|
|
|
|
hdr->hdr_match.hdr_contextid = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank;
|
|
|
|
hdr->hdr_match.hdr_dst = sendreq->req_send.req_base.req_peer;
|
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
|
|
|
hdr->hdr_match.hdr_msg_seq = sendreq->req_send.req_base.req_sequence;
|
|
|
|
|
2005-08-16 01:31:52 +04:00
|
|
|
/* short message */
|
|
|
|
descriptor->des_cbfunc = mca_pml_ob1_match_completion;
|
|
|
|
|
2005-08-13 01:33:01 +04:00
|
|
|
/* update lengths */
|
|
|
|
sendreq->req_send_offset = size;
|
|
|
|
sendreq->req_rdma_offset = size;
|
|
|
|
|
|
|
|
/* request is complete at mpi level */
|
|
|
|
ompi_request_complete((ompi_request_t*)sendreq);
|
|
|
|
|
|
|
|
/* rendezvous header is required */
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* check to see if memory is registered */
|
|
|
|
sendreq->req_chunk = mca_mpool_base_find(sendreq->req_send.req_addr);
|
|
|
|
|
|
|
|
/* if the buffer is not pinned and leave pinned is false we eagerly send
|
|
|
|
data to cover the cost of pinning the recv buffers on the peer */
|
|
|
|
if(size && NULL == sendreq->req_chunk && !mca_pml_ob1.leave_pinned) {
|
|
|
|
|
|
|
|
/* prepare descriptor */
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_ob1_rendezvous_hdr_t),
|
|
|
|
&size,
|
|
|
|
&descriptor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if the buffer is pinned or leave pinned is true we do not eagerly
|
|
|
|
* send any data
|
|
|
|
*/
|
|
|
|
else {
|
|
|
|
/* allocate space for hdr only */
|
|
|
|
mca_bml_base_alloc(bml_btl, &descriptor, sizeof(mca_pml_ob1_rendezvous_hdr_t));
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
if(NULL == descriptor) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
segment = descriptor->des_src;
|
|
|
|
|
|
|
|
/* build hdr */
|
|
|
|
hdr = (mca_pml_ob1_hdr_t*)segment->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = (sendreq->req_chunk != NULL ? MCA_PML_OB1_HDR_FLAGS_PIN : 0);
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_RNDV;
|
|
|
|
hdr->hdr_match.hdr_contextid = sendreq->req_send.req_base.req_comm->c_contextid;
|
|
|
|
hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank;
|
|
|
|
hdr->hdr_match.hdr_dst = sendreq->req_send.req_base.req_peer;
|
|
|
|
hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag;
|
|
|
|
hdr->hdr_match.hdr_msg_length = sendreq->req_send.req_bytes_packed;
|
|
|
|
hdr->hdr_match.hdr_msg_seq = sendreq->req_send.req_base.req_sequence;
|
|
|
|
hdr->hdr_rndv.hdr_src_req.lval = 0; /* for VALGRIND/PURIFY - REPLACE WITH MACRO */
|
|
|
|
hdr->hdr_rndv.hdr_src_req.pval = sendreq;
|
|
|
|
hdr->hdr_rndv.hdr_frag_length = size;
|
|
|
|
|
2005-08-12 23:29:05 +04:00
|
|
|
/* first fragment of a long message */
|
|
|
|
descriptor->des_cbfunc = mca_pml_ob1_rndv_completion;
|
2005-08-16 01:31:52 +04:00
|
|
|
sendreq->req_send_offset = size;
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
2005-06-30 09:50:55 +04:00
|
|
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2005-05-24 02:06:50 +04:00
|
|
|
descriptor->des_cbdata = sendreq;
|
|
|
|
|
|
|
|
/* send */
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
sendreq->t_start = get_profiler_timestamp();
|
|
|
|
#endif
|
2005-08-12 06:41:14 +04:00
|
|
|
rc = mca_bml_base_send(bml_btl,
|
|
|
|
descriptor,
|
|
|
|
MCA_BTL_TAG_PML);
|
2005-05-24 02:06:50 +04:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl, descriptor );
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-02 01:09:43 +04:00
|
|
|
int mca_pml_ob1_send_request_schedule(mca_pml_ob1_send_request_t* sendreq)
|
2005-06-01 18:34:22 +04:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
mca_bml_base_endpoint_t* bml_endpoint = sendreq->bml_endpoint;
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
if(OPAL_THREAD_ADD32(&sendreq->req_lock,1) == 1) {
|
2005-06-01 18:34:22 +04:00
|
|
|
do {
|
2005-06-30 09:50:55 +04:00
|
|
|
/* allocate remaining bytes to BTLs */
|
2005-06-09 00:37:19 +04:00
|
|
|
size_t bytes_remaining = sendreq->req_rdma_offset - sendreq->req_send_offset;
|
2005-07-08 00:58:57 +04:00
|
|
|
while(bytes_remaining > 0 &&
|
|
|
|
(sendreq->req_pipeline_depth < mca_pml_ob1.send_pipeline_depth ||
|
|
|
|
sendreq->req_rdma_offset < sendreq->req_send.req_bytes_packed)) {
|
2005-08-12 06:41:14 +04:00
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_frag_hdr_t* hdr;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_descriptor_t* des;
|
2005-06-01 18:34:22 +04:00
|
|
|
int rc;
|
2005-08-12 06:41:14 +04:00
|
|
|
size_t size;
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_send);
|
|
|
|
size_t num_btl_avail = bml_endpoint->btl_rdma.arr_size;
|
|
|
|
|
|
|
|
if(num_btl_avail == 1 || bytes_remaining < bml_btl->btl_min_send_size) {
|
2005-06-01 18:34:22 +04:00
|
|
|
size = bytes_remaining;
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
/* otherwise attempt to give the BTL a percentage of the message
|
2005-06-01 18:34:22 +04:00
|
|
|
* based on a weighting factor. for simplicity calculate this as
|
|
|
|
* a percentage of the overall message length (regardless of amount
|
|
|
|
* previously assigned)
|
|
|
|
*/
|
2005-06-02 01:09:43 +04:00
|
|
|
} else {
|
2005-08-12 06:41:14 +04:00
|
|
|
size = (bml_btl->btl_weight * bytes_remaining) / 100;
|
2005-06-09 07:11:51 +04:00
|
|
|
}
|
2005-06-01 18:34:22 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
/* makes sure that we don't exceed BTL max send size */
|
2005-08-12 06:41:14 +04:00
|
|
|
if (bml_btl->btl_max_send_size != 0 &&
|
|
|
|
size > bml_btl->btl_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t)) {
|
|
|
|
size = bml_btl->btl_max_send_size - sizeof(mca_pml_ob1_frag_hdr_t);
|
2005-06-02 21:42:53 +04:00
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/* pack into a descriptor */
|
2005-06-14 16:56:36 +04:00
|
|
|
ompi_convertor_set_position(&sendreq->req_send.req_convertor,
|
2005-08-12 06:41:14 +04:00
|
|
|
&sendreq->req_send_offset);
|
|
|
|
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
NULL,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
sizeof(mca_pml_ob1_frag_hdr_t),
|
|
|
|
&size,
|
|
|
|
&des
|
|
|
|
);
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
if(des == NULL) {
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.send_pending, (opal_list_item_t*)sendreq);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
2005-06-01 18:34:22 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-07-18 22:54:25 +04:00
|
|
|
des->des_cbfunc = mca_pml_ob1_frag_completion;
|
2005-06-02 01:09:43 +04:00
|
|
|
des->des_cbdata = sendreq;
|
2005-06-01 18:34:22 +04:00
|
|
|
|
2005-06-02 01:09:43 +04:00
|
|
|
/* setup header */
|
2005-06-01 18:34:22 +04:00
|
|
|
hdr = (mca_pml_ob1_frag_hdr_t*)des->des_src->seg_addr.pval;
|
2005-06-02 01:09:43 +04:00
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_FRAG;
|
2005-06-01 18:34:22 +04:00
|
|
|
hdr->hdr_frag_length = size;
|
2005-06-09 00:37:19 +04:00
|
|
|
hdr->hdr_frag_offset = sendreq->req_send_offset;
|
2005-06-01 18:34:22 +04:00
|
|
|
hdr->hdr_src_req.pval = sendreq;
|
2005-06-02 01:09:43 +04:00
|
|
|
hdr->hdr_dst_req = sendreq->req_recv;
|
2005-06-01 18:34:22 +04:00
|
|
|
|
|
|
|
/* update state */
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_send_offset += size;
|
2005-08-02 21:36:01 +04:00
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,1);
|
2005-06-01 18:34:22 +04:00
|
|
|
|
|
|
|
/* initiate send - note that this may complete before the call returns */
|
2005-08-12 06:41:14 +04:00
|
|
|
rc = mca_bml_base_send( bml_btl, des, MCA_BTL_TAG_PML);
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
if(rc == OMPI_SUCCESS) {
|
2005-06-10 00:16:33 +04:00
|
|
|
bytes_remaining -= size;
|
2005-06-01 18:34:22 +04:00
|
|
|
} else {
|
2005-06-09 00:37:19 +04:00
|
|
|
sendreq->req_send_offset -= size;
|
2005-08-02 21:36:01 +04:00
|
|
|
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth,-1);
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl,des);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.send_pending, (opal_list_item_t*)sendreq);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
2005-06-01 18:34:22 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
if(bytes_remaining == 0)
|
|
|
|
sendreq->t_scheduled = get_profiler_timestamp();
|
|
|
|
#endif
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_pml_ob1_progress();
|
2005-06-01 18:34:22 +04:00
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
} while (OPAL_THREAD_ADD32(&sendreq->req_lock,-1) > 0);
|
2005-06-01 18:34:22 +04:00
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-09 07:34:33 +04:00
|
|
|
/**
|
2005-06-10 00:16:33 +04:00
|
|
|
* Return resources used by the RDMA
|
2005-06-09 07:34:33 +04:00
|
|
|
*/
|
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
static void mca_pml_ob1_fin_completion(
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* des,
|
2005-06-10 00:16:33 +04:00
|
|
|
int status)
|
|
|
|
{
|
|
|
|
|
|
|
|
mca_pml_ob1_rdma_frag_t* frag = (mca_pml_ob1_rdma_frag_t*)des->des_cbdata;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context;
|
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
MCA_PML_OB1_RDMA_FRAG_RETURN(frag);
|
2005-08-12 06:41:14 +04:00
|
|
|
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
2005-06-10 00:16:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An RDMA put operation has completed:
|
|
|
|
* (1) Update request status and if required set completed
|
|
|
|
* (2) Send FIN control message to the destination
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_pml_ob1_put_completion(
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* ep,
|
|
|
|
struct mca_btl_base_descriptor_t* des,
|
2005-06-10 00:16:33 +04:00
|
|
|
int status)
|
|
|
|
{
|
|
|
|
mca_pml_ob1_rdma_frag_t* frag = (mca_pml_ob1_rdma_frag_t*)des->des_cbdata;
|
|
|
|
mca_pml_ob1_send_request_t* sendreq = frag->rdma_req;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_descriptor_t* fin;
|
2005-06-10 00:16:33 +04:00
|
|
|
mca_pml_ob1_fin_hdr_t* hdr;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context;
|
2005-06-10 00:16:33 +04:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* check completion status */
|
|
|
|
if(OMPI_SUCCESS != status) {
|
|
|
|
/* TSW - FIX */
|
|
|
|
ORTE_ERROR_LOG(status);
|
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
/* update statistics */
|
|
|
|
sendreq->t_fin[sendreq->t_fin_index++] = get_profiler_timestamp();
|
|
|
|
if(sendreq->t_fin_index >= MCA_PML_OB1_NUM_TSTAMPS)
|
|
|
|
sendreq->t_fin_index = 0;
|
|
|
|
#endif
|
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
/* check for request completion */
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
sendreq->req_bytes_delivered += frag->rdma_length;
|
|
|
|
if(sendreq->req_bytes_delivered >= sendreq->req_send.req_bytes_packed) {
|
|
|
|
MCA_PML_OB1_SEND_REQUEST_COMPLETE(sendreq);
|
|
|
|
}
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
|
|
|
|
/* allocate descriptor for fin control message - note that
|
|
|
|
* the rdma descriptor cannot be reused as it points directly
|
|
|
|
* at the user buffer
|
|
|
|
*/
|
|
|
|
frag->rdma_state = MCA_PML_OB1_RDMA_FIN;
|
2005-06-14 00:52:13 +04:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, fin, sizeof(mca_pml_ob1_fin_hdr_t));
|
2005-06-10 00:16:33 +04:00
|
|
|
if(NULL == fin) {
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-06-30 09:50:55 +04:00
|
|
|
fin->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
2005-06-10 00:16:33 +04:00
|
|
|
fin->des_cbfunc = mca_pml_ob1_fin_completion;
|
|
|
|
fin->des_cbdata = frag;
|
|
|
|
|
|
|
|
/* fill in header */
|
|
|
|
hdr = (mca_pml_ob1_fin_hdr_t*)fin->des_src->seg_addr.pval;
|
|
|
|
hdr->hdr_common.hdr_flags = 0;
|
|
|
|
hdr->hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_FIN;
|
|
|
|
hdr->hdr_src = frag->rdma_hdr.hdr_rdma.hdr_src;
|
|
|
|
hdr->hdr_dst = frag->rdma_hdr.hdr_rdma.hdr_dst;
|
|
|
|
hdr->hdr_rdma_offset = frag->rdma_hdr.hdr_rdma.hdr_rdma_offset;
|
|
|
|
hdr->hdr_rdma_length = frag->rdma_length;
|
|
|
|
|
|
|
|
/* queue request */
|
2005-08-12 06:41:14 +04:00
|
|
|
rc = mca_bml_base_send(
|
|
|
|
bml_btl,
|
|
|
|
fin,
|
|
|
|
MCA_BTL_TAG_PML
|
|
|
|
);
|
2005-06-10 00:16:33 +04:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl, fin);
|
2005-06-10 00:16:33 +04:00
|
|
|
if(rc == OMPI_ERR_OUT_OF_RESOURCE) {
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
} else {
|
|
|
|
/* TSW - FIX */
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
/* return rdma descriptor - do this after queuing the fin message - as
|
|
|
|
* release rdma resources (unpin memory) can take some time.
|
|
|
|
*/
|
2005-06-13 18:36:09 +04:00
|
|
|
des->des_dst = NULL;
|
|
|
|
des->des_dst_cnt = 0;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_free(bml_btl, des);
|
2005-06-10 00:16:33 +04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Receiver has scheduled an RDMA operation:
|
|
|
|
* (1) Allocate an RDMA fragment to maintain the state of the operation
|
2005-06-30 09:50:55 +04:00
|
|
|
* (2) Call BTL prepare_src to pin/prepare source buffers
|
2005-06-10 00:16:33 +04:00
|
|
|
* (3) Queue the RDMA put
|
|
|
|
*/
|
|
|
|
|
|
|
|
void mca_pml_ob1_send_request_put(
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_pml_ob1_send_request_t* sendreq,
|
|
|
|
mca_btl_base_module_t* btl,
|
|
|
|
mca_pml_ob1_rdma_hdr_t* hdr)
|
2005-06-09 07:34:33 +04:00
|
|
|
{
|
2005-06-25 01:12:38 +04:00
|
|
|
mca_mpool_base_registration_t* reg = NULL;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_descriptor_t* des;
|
2005-06-10 00:16:33 +04:00
|
|
|
mca_pml_ob1_rdma_frag_t* frag;
|
|
|
|
size_t offset = hdr->hdr_rdma_offset;
|
|
|
|
size_t i, size = 0;
|
|
|
|
int rc;
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
bml_btl = mca_bml_base_btl_array_find(&sendreq->bml_endpoint->btl_rdma, btl);
|
2005-06-10 00:16:33 +04:00
|
|
|
MCA_PML_OB1_RDMA_FRAG_ALLOC(frag, rc);
|
|
|
|
if(NULL == frag) {
|
|
|
|
/* TSW - FIX */
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup fragment */
|
|
|
|
for(i=0; i<hdr->hdr_seg_cnt; i++) {
|
|
|
|
size += hdr->hdr_segs[i].seg_len;
|
|
|
|
frag->rdma_segs[i] = hdr->hdr_segs[i];
|
|
|
|
}
|
|
|
|
frag->rdma_hdr.hdr_rdma = *hdr;
|
2005-06-14 00:52:13 +04:00
|
|
|
frag->rdma_req = sendreq;
|
2005-08-12 06:41:14 +04:00
|
|
|
frag->rdma_ep = sendreq->bml_endpoint;
|
2005-06-10 00:16:33 +04:00
|
|
|
frag->rdma_state = MCA_PML_OB1_RDMA_PREPARE;
|
|
|
|
|
2005-06-22 00:58:24 +04:00
|
|
|
/* look for a prior registration on this interface */
|
|
|
|
if(NULL != sendreq->req_chunk) {
|
|
|
|
mca_mpool_base_reg_mpool_t* mpool = sendreq->req_chunk->mpools;
|
|
|
|
while(mpool->mpool != NULL) {
|
2005-06-30 09:50:55 +04:00
|
|
|
if(mpool->user_data == (void*) btl) {
|
2005-06-23 19:53:51 +04:00
|
|
|
reg = mpool->mpool_registration;
|
2005-06-22 00:58:24 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-22 01:37:38 +04:00
|
|
|
mpool++;
|
2005-06-22 00:58:24 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
|
|
|
sendreq->t_pin[sendreq->t_pin_index++] = get_profiler_timestamp();
|
|
|
|
if(sendreq->t_pin_index >= MCA_PML_OB1_NUM_TSTAMPS)
|
|
|
|
sendreq->t_pin_index = 0;
|
|
|
|
#endif
|
|
|
|
|
2005-06-22 00:58:24 +04:00
|
|
|
/* setup descriptor */
|
2005-06-10 00:16:33 +04:00
|
|
|
ompi_convertor_set_position(&sendreq->req_send.req_convertor, &offset);
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
mca_bml_base_prepare_src(
|
|
|
|
bml_btl,
|
|
|
|
reg,
|
|
|
|
&sendreq->req_send.req_convertor,
|
|
|
|
0,
|
|
|
|
&size,
|
|
|
|
&des);
|
|
|
|
|
2005-06-10 00:16:33 +04:00
|
|
|
if(NULL == des) {
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
}
|
|
|
|
frag->rdma_state = MCA_PML_OB1_RDMA_PUT;
|
|
|
|
frag->rdma_length = size;
|
|
|
|
|
|
|
|
des->des_dst = frag->rdma_segs;
|
|
|
|
des->des_dst_cnt = hdr->hdr_seg_cnt;
|
|
|
|
des->des_cbfunc = mca_pml_ob1_put_completion;
|
|
|
|
des->des_cbdata = frag;
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
#if MCA_PML_OB1_TIMESTAMPS
|
2005-06-10 00:16:33 +04:00
|
|
|
/* queue put */
|
2005-06-17 22:25:44 +04:00
|
|
|
sendreq->t_put[sendreq->t_put_index++] = get_profiler_timestamp();
|
|
|
|
if(sendreq->t_put_index >= MCA_PML_OB1_NUM_TSTAMPS)
|
|
|
|
sendreq->t_put_index = 0;
|
|
|
|
#endif
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_bml_base_put(bml_btl, des))) {
|
2005-06-10 00:16:33 +04:00
|
|
|
if(rc == OMPI_ERR_OUT_OF_RESOURCE) {
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag);
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock);
|
2005-06-10 00:16:33 +04:00
|
|
|
} else {
|
|
|
|
/* TSW - FIX */
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
orte_errmgr.abort();
|
|
|
|
}
|
|
|
|
}
|
2005-07-28 03:07:14 +04:00
|
|
|
#ifdef HAVE_SCHED_YIELD
|
2005-06-17 22:25:44 +04:00
|
|
|
sched_yield();
|
2005-07-28 03:07:14 +04:00
|
|
|
#endif
|
2005-06-09 07:34:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|