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-05-08 01:03:12 +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.
|
2005-05-24 02:06:50 +04:00
|
|
|
* 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$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2005-05-24 02:22:20 +04:00
|
|
|
#ifndef OMPI_PML_OB1_RECV_REQUEST_H
|
|
|
|
#define OMPI_PML_OB1_RECV_REQUEST_H
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
#include "pml_ob1.h"
|
2005-09-13 02:28:23 +04:00
|
|
|
#include "pml_ob1_rdma.h"
|
2006-07-20 18:44:35 +04:00
|
|
|
#include "pml_ob1_rdmafrag.h"
|
2006-05-08 01:03:12 +04:00
|
|
|
#include "ompi/proc/proc.h"
|
|
|
|
#include "ompi/mca/pml/ob1/pml_ob1_comm.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_recvreq.h"
|
2006-05-08 01:03:12 +04:00
|
|
|
#include "ompi/datatype/datatype.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-06-17 22:25:44 +04:00
|
|
|
|
2006-01-26 14:55:00 +03:00
|
|
|
struct mca_pml_ob1_recv_request_t {
|
2005-05-24 02:06:50 +04:00
|
|
|
mca_pml_base_recv_request_t req_recv;
|
2005-06-09 07:11:51 +04:00
|
|
|
ompi_ptr_t req_send;
|
2005-09-14 21:08:08 +04:00
|
|
|
#if OMPI_HAVE_THREAD_SUPPORT
|
2005-09-12 00:48:37 +04:00
|
|
|
volatile int32_t req_lock;
|
2005-09-14 21:08:08 +04:00
|
|
|
#else
|
|
|
|
int32_t req_lock;
|
|
|
|
#endif
|
2005-06-09 07:11:51 +04:00
|
|
|
size_t req_pipeline_depth;
|
|
|
|
size_t req_bytes_received;
|
|
|
|
size_t req_bytes_delivered;
|
|
|
|
size_t req_rdma_offset;
|
2005-09-13 02:28:23 +04:00
|
|
|
mca_pml_ob1_rdma_btl_t req_rdma[MCA_PML_OB1_MAX_RDMA_PER_REQUEST];
|
|
|
|
uint32_t req_rdma_cnt;
|
|
|
|
uint32_t req_rdma_idx;
|
2006-07-20 18:44:35 +04:00
|
|
|
bool req_pending;
|
Fix hang in receiving into MPI_alloced area.
This code hangs with openib BTL:
int size = 4000000;
sbuf = malloc(size);
MPI_Alloc_mem(size, MPI_INFO_NULL, &rbuf);
if (rank == 0)
{
MPI_Recv(rbuf, size, MPI_CHAR, 1, 1, MPI_COMM_WORLD, &stat);
}else{
MPI_Send(sbuf, size, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
}
This commit was SVN r11613.
2006-09-11 16:18:59 +04:00
|
|
|
bool req_ack_sent; /**< whether ack was sent to the sender */
|
2005-05-24 02:06:50 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_pml_ob1_recv_request_t mca_pml_ob1_recv_request_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_pml_ob1_recv_request_t);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a recv request from the modules free list.
|
|
|
|
*
|
|
|
|
* @param rc (OUT) OMPI_SUCCESS or error status on failure.
|
|
|
|
* @return Receive request.
|
|
|
|
*/
|
2005-06-07 18:12:47 +04:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq, rc) \
|
|
|
|
do { \
|
2006-06-12 20:44:00 +04:00
|
|
|
ompi_free_list_item_t* item; \
|
2005-06-07 18:12:47 +04:00
|
|
|
rc = OMPI_SUCCESS; \
|
|
|
|
OMPI_FREE_LIST_GET(&mca_pml_ob1.recv_requests, item, rc); \
|
|
|
|
recvreq = (mca_pml_ob1_recv_request_t*)item; \
|
|
|
|
} while(0)
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize a receive request with call parameters.
|
|
|
|
*
|
|
|
|
* @param request (IN) Receive request.
|
|
|
|
* @param addr (IN) User buffer.
|
|
|
|
* @param count (IN) Number of elements of indicated datatype.
|
|
|
|
* @param datatype (IN) User defined datatype.
|
|
|
|
* @param src (IN) Source rank w/in the communicator.
|
|
|
|
* @param tag (IN) User defined tag.
|
|
|
|
* @param comm (IN) Communicator.
|
|
|
|
* @param persistent (IN) Is this a ersistent request.
|
|
|
|
*/
|
2006-03-16 01:53:41 +03:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_INIT( request, \
|
|
|
|
addr, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
src, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
persistent) \
|
|
|
|
do { \
|
|
|
|
MCA_PML_BASE_RECV_REQUEST_INIT( &(request)->req_recv, \
|
|
|
|
addr, \
|
|
|
|
count, \
|
|
|
|
datatype, \
|
|
|
|
src, \
|
|
|
|
tag, \
|
|
|
|
comm, \
|
|
|
|
persistent); \
|
2005-06-07 18:12:47 +04:00
|
|
|
} while(0)
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2006-03-31 21:09:09 +04:00
|
|
|
/**
|
|
|
|
* Mark the request as completed at MPI level for internal purposes.
|
|
|
|
*
|
|
|
|
* @param recvreq (IN) Receive request.
|
|
|
|
*/
|
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_MPI_COMPLETE( recvreq ) \
|
|
|
|
do { \
|
|
|
|
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
|
|
|
|
&(recvreq->req_recv.req_base), PERUSE_RECV ); \
|
|
|
|
MCA_PML_BASE_REQUEST_MPI_COMPLETE( &(recvreq->req_recv.req_base.req_ompi) ); \
|
|
|
|
} while (0)
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Return a recv request to the modules free list.
|
|
|
|
*
|
2006-03-31 21:09:09 +04:00
|
|
|
* @param recvreq (IN) Receive request.
|
2005-05-24 02:06:50 +04:00
|
|
|
*/
|
2006-03-31 21:09:09 +04:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_PML_COMPLETE(recvreq) \
|
|
|
|
do { \
|
|
|
|
size_t r; \
|
|
|
|
\
|
|
|
|
assert( false == recvreq->req_recv.req_base.req_pml_complete ); \
|
|
|
|
\
|
2006-07-06 03:39:13 +04:00
|
|
|
if((recvreq)->req_recv.req_bytes_packed > 0) { \
|
|
|
|
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END, \
|
|
|
|
&(recvreq->req_recv.req_base), PERUSE_RECV ); \
|
|
|
|
} \
|
2006-03-31 21:09:09 +04:00
|
|
|
\
|
|
|
|
for( r = 0; r < recvreq->req_rdma_cnt; r++ ) { \
|
|
|
|
mca_mpool_base_registration_t* btl_reg = recvreq->req_rdma[r].btl_reg; \
|
|
|
|
if( NULL != btl_reg ) { \
|
2006-12-17 15:26:41 +03:00
|
|
|
btl_reg->mpool->mpool_deregister( btl_reg->mpool, btl_reg ); \
|
2006-03-31 21:09:09 +04:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
recvreq->req_rdma_cnt = 0; \
|
|
|
|
\
|
|
|
|
OPAL_THREAD_LOCK(&ompi_request_lock); \
|
|
|
|
\
|
|
|
|
if( true == recvreq->req_recv.req_base.req_free_called ) { \
|
|
|
|
MCA_PML_OB1_RECV_REQUEST_RETURN( recvreq ); \
|
|
|
|
} else { \
|
|
|
|
/* initialize request status */ \
|
|
|
|
recvreq->req_recv.req_base.req_pml_complete = true; \
|
2006-09-29 03:59:24 +04:00
|
|
|
recvreq->req_recv.req_base.req_ompi.req_status._count = \
|
2006-11-08 20:02:46 +03:00
|
|
|
(int)recvreq->req_bytes_received; \
|
2006-07-14 23:36:56 +04:00
|
|
|
if (recvreq->req_bytes_received > recvreq->req_bytes_delivered) { \
|
2006-09-29 03:59:24 +04:00
|
|
|
recvreq->req_recv.req_base.req_ompi.req_status._count = \
|
2006-11-08 20:02:46 +03:00
|
|
|
(int)recvreq->req_bytes_delivered; \
|
2006-09-29 03:59:24 +04:00
|
|
|
recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR = \
|
|
|
|
MPI_ERR_TRUNCATE; \
|
|
|
|
} \
|
2006-03-31 21:09:09 +04:00
|
|
|
MCA_PML_OB1_RECV_REQUEST_MPI_COMPLETE( recvreq ); \
|
|
|
|
} \
|
|
|
|
OPAL_THREAD_UNLOCK(&ompi_request_lock); \
|
2005-06-07 18:12:47 +04:00
|
|
|
} while(0)
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2006-02-09 01:42:00 +03:00
|
|
|
/*
|
|
|
|
* Free the PML receive request
|
|
|
|
*/
|
2006-03-16 01:53:41 +03:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_RETURN(recvreq) \
|
2006-02-09 01:42:00 +03:00
|
|
|
{ \
|
2006-03-16 01:53:41 +03:00
|
|
|
MCA_PML_BASE_RECV_REQUEST_FINI(&(recvreq)->req_recv); \
|
|
|
|
OMPI_FREE_LIST_RETURN( &mca_pml_ob1.recv_requests, \
|
2006-06-13 02:09:03 +04:00
|
|
|
(ompi_free_list_item_t*)(recvreq)); \
|
2006-02-09 01:42:00 +03:00
|
|
|
}
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Attempt to match the request against the unexpected fragment list
|
|
|
|
* for all source ranks w/in the communicator.
|
|
|
|
*
|
|
|
|
* @param request (IN) Request to match.
|
|
|
|
*/
|
|
|
|
void mca_pml_ob1_recv_request_match_wild(mca_pml_ob1_recv_request_t* request);
|
2006-03-16 01:53:41 +03:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Attempt to match the request against the unexpected fragment list
|
|
|
|
* for a specific source rank.
|
|
|
|
*
|
|
|
|
* @param request (IN) Request to match.
|
|
|
|
*/
|
|
|
|
void mca_pml_ob1_recv_request_match_specific(mca_pml_ob1_recv_request_t* request);
|
2005-06-17 22:25:44 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize diagnostic code for tracing rdma protocol timing
|
|
|
|
*/
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
* Start an initialized request.
|
|
|
|
*
|
|
|
|
* @param request Receive request.
|
|
|
|
* @return OMPI_SUCESS or error status on failure.
|
|
|
|
*/
|
2005-06-01 18:34:22 +04:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_START(request) \
|
2005-07-01 21:00:59 +04:00
|
|
|
do { \
|
2005-05-24 02:06:50 +04:00
|
|
|
/* init/re-init the request */ \
|
2005-06-09 07:11:51 +04:00
|
|
|
(request)->req_lock = 0; \
|
2006-11-08 08:42:29 +03:00
|
|
|
(request)->req_pipeline_depth = 0; \
|
|
|
|
(request)->req_bytes_received = 0; \
|
2006-10-18 20:11:50 +04:00
|
|
|
(request)->req_bytes_delivered = 0; \
|
|
|
|
/* What about req_rdma_cnt ? */ \
|
2005-09-13 02:28:23 +04:00
|
|
|
(request)->req_rdma_idx = 0; \
|
2006-07-20 18:44:35 +04:00
|
|
|
(request)->req_pending = false; \
|
Fix hang in receiving into MPI_alloced area.
This code hangs with openib BTL:
int size = 4000000;
sbuf = malloc(size);
MPI_Alloc_mem(size, MPI_INFO_NULL, &rbuf);
if (rank == 0)
{
MPI_Recv(rbuf, size, MPI_CHAR, 1, 1, MPI_COMM_WORLD, &stat);
}else{
MPI_Send(sbuf, size, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
}
This commit was SVN r11613.
2006-09-11 16:18:59 +04:00
|
|
|
(request)->req_ack_sent = false; \
|
2005-05-24 02:06:50 +04:00
|
|
|
\
|
2006-03-31 21:09:09 +04:00
|
|
|
MCA_PML_BASE_RECV_START( &(request)->req_recv.req_base ); \
|
2005-05-24 02:06:50 +04:00
|
|
|
\
|
|
|
|
/* attempt to match posted recv */ \
|
|
|
|
if((request)->req_recv.req_base.req_peer == OMPI_ANY_SOURCE) { \
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_recv_request_match_wild(request); \
|
2005-05-24 02:06:50 +04:00
|
|
|
} else { \
|
2006-11-08 08:42:29 +03:00
|
|
|
(request)->req_recv.req_base.req_proc = \
|
|
|
|
(request)->req_recv.req_base.req_comm->c_pml_comm->procs \
|
|
|
|
[(request)->req_recv.req_base.req_peer].ompi_proc; \
|
|
|
|
if( (0 != (request)->req_recv.req_base.req_datatype->size) && \
|
|
|
|
(0 != (request)->req_recv.req_base.req_count) ) { \
|
|
|
|
ompi_convertor_copy_and_prepare_for_recv( \
|
|
|
|
(request)->req_recv.req_base.req_proc->proc_convertor, \
|
|
|
|
(request)->req_recv.req_base.req_datatype, \
|
|
|
|
(request)->req_recv.req_base.req_count, \
|
|
|
|
(request)->req_recv.req_base.req_addr, \
|
|
|
|
0, \
|
|
|
|
&(request)->req_recv.req_convertor ); \
|
|
|
|
ompi_convertor_get_unpacked_size( &(request)->req_recv.req_convertor, \
|
|
|
|
&(request)->req_bytes_delivered ); \
|
|
|
|
} \
|
2005-06-01 18:34:22 +04:00
|
|
|
mca_pml_ob1_recv_request_match_specific(request); \
|
2005-05-24 02:06:50 +04:00
|
|
|
} \
|
2005-07-01 21:00:59 +04:00
|
|
|
} while (0)
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
|
2005-06-06 20:17:43 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-02-11 00:14:08 +03:00
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_MATCHED( request, hdr ) \
|
|
|
|
do { \
|
|
|
|
(request)->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = (hdr)->hdr_src; \
|
2006-10-18 20:11:50 +04:00
|
|
|
(request)->req_recv.req_base.req_ompi.req_status.MPI_TAG = (hdr)->hdr_tag; \
|
2006-03-31 21:09:09 +04:00
|
|
|
\
|
|
|
|
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_MSG_MATCH_POSTED_REQ, \
|
|
|
|
&((request)->req_recv.req_base), PERUSE_RECV ); \
|
|
|
|
\
|
2006-06-20 18:14:04 +04:00
|
|
|
if((request)->req_recv.req_bytes_packed > 0) { \
|
2006-11-08 08:42:29 +03:00
|
|
|
if( MPI_ANY_SOURCE == (request)->req_recv.req_base.req_peer ) { \
|
2006-05-08 01:03:12 +04:00
|
|
|
ompi_convertor_copy_and_prepare_for_recv( \
|
2006-02-11 00:14:08 +03:00
|
|
|
(request)->req_recv.req_base.req_proc->proc_convertor, \
|
|
|
|
(request)->req_recv.req_base.req_datatype, \
|
|
|
|
(request)->req_recv.req_base.req_count, \
|
|
|
|
(request)->req_recv.req_base.req_addr, \
|
2006-03-17 21:46:48 +03:00
|
|
|
0, \
|
2006-02-11 00:14:08 +03:00
|
|
|
&(request)->req_recv.req_convertor ); \
|
2006-09-29 03:42:56 +04:00
|
|
|
ompi_convertor_get_unpacked_size( &(request)->req_recv.req_convertor, \
|
|
|
|
&(request)->req_bytes_delivered ); \
|
2006-05-08 01:03:12 +04:00
|
|
|
} \
|
2006-06-26 22:57:55 +04:00
|
|
|
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_XFER_BEGIN, \
|
|
|
|
&((request)->req_recv.req_base), PERUSE_RECV); \
|
2006-02-11 00:14:08 +03:00
|
|
|
} \
|
2005-06-07 18:12:47 +04:00
|
|
|
} while (0)
|
2005-06-06 20:17:43 +04:00
|
|
|
|
|
|
|
|
2005-06-01 18:34:22 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MCA_PML_OB1_RECV_REQUEST_UNPACK( \
|
|
|
|
request, \
|
|
|
|
segments, \
|
|
|
|
num_segments, \
|
|
|
|
seg_offset, \
|
|
|
|
data_offset, \
|
|
|
|
bytes_received, \
|
|
|
|
bytes_delivered) \
|
2005-06-07 18:12:47 +04:00
|
|
|
do { \
|
2006-07-13 20:52:40 +04:00
|
|
|
bytes_delivered = 0; \
|
2005-07-15 20:17:33 +04:00
|
|
|
if(request->req_recv.req_bytes_packed > 0) { \
|
2005-06-30 09:50:55 +04:00
|
|
|
struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; \
|
2005-06-07 18:12:47 +04:00
|
|
|
uint32_t iov_count = 0; \
|
2005-06-08 23:10:15 +04:00
|
|
|
size_t max_data = bytes_received; \
|
2005-06-07 18:12:47 +04:00
|
|
|
size_t n, offset = seg_offset; \
|
2006-05-23 07:21:15 +04:00
|
|
|
mca_btl_base_segment_t* segment = segments; \
|
2005-06-07 18:12:47 +04:00
|
|
|
\
|
2006-05-23 07:21:15 +04:00
|
|
|
for( n = 0; n < num_segments; n++, segment++ ) { \
|
2005-06-07 18:12:47 +04:00
|
|
|
if(offset >= segment->seg_len) { \
|
|
|
|
offset -= segment->seg_len; \
|
|
|
|
} else { \
|
2007-02-13 12:34:04 +03:00
|
|
|
iov[iov_count].iov_len = segment->seg_len - offset; \
|
|
|
|
iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + offset); \
|
2005-06-07 18:12:47 +04:00
|
|
|
iov_count++; \
|
2005-06-07 01:52:20 +04:00
|
|
|
} \
|
2005-06-06 20:17:43 +04:00
|
|
|
} \
|
2006-06-27 00:08:33 +04:00
|
|
|
PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \
|
|
|
|
&(recvreq->req_recv.req_base), max_data, \
|
|
|
|
PERUSE_RECV); \
|
2006-07-05 23:45:00 +04:00
|
|
|
ompi_convertor_set_position( &(request->req_recv.req_convertor), \
|
|
|
|
&data_offset ); \
|
|
|
|
ompi_convertor_unpack( &(request)->req_recv.req_convertor, \
|
|
|
|
iov, \
|
|
|
|
&iov_count, \
|
2006-10-27 03:11:26 +04:00
|
|
|
&max_data ); \
|
2006-07-05 23:45:00 +04:00
|
|
|
bytes_delivered = max_data; \
|
2005-06-06 20:17:43 +04:00
|
|
|
} \
|
2005-06-07 18:12:47 +04:00
|
|
|
} while (0)
|
2005-06-01 18:34:22 +04:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
void mca_pml_ob1_recv_request_progress(
|
|
|
|
mca_pml_ob1_recv_request_t* req,
|
2005-08-17 22:23:38 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_segment_t* segments,
|
2005-05-24 02:06:50 +04:00
|
|
|
size_t num_segments);
|
|
|
|
|
2005-06-09 07:11:51 +04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-09-13 20:45:41 +04:00
|
|
|
void mca_pml_ob1_recv_request_matched_probe(
|
|
|
|
mca_pml_ob1_recv_request_t* req,
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_segment_t* segments,
|
|
|
|
size_t num_segments);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
int mca_pml_ob1_recv_request_schedule_exclusive(
|
2005-06-09 07:11:51 +04:00
|
|
|
mca_pml_ob1_recv_request_t* req);
|
|
|
|
|
2006-07-20 18:44:35 +04:00
|
|
|
static inline void mca_pml_ob1_recv_request_schedule(
|
|
|
|
mca_pml_ob1_recv_request_t* req)
|
|
|
|
{
|
|
|
|
if(OPAL_THREAD_ADD32(&req->req_lock,1) == 1)
|
|
|
|
mca_pml_ob1_recv_request_schedule_exclusive(req);
|
|
|
|
}
|
|
|
|
|
2006-12-29 10:38:24 +03:00
|
|
|
#define MCA_PML_OB1_ADD_ACK_TO_PENDING(P, S, D, O) \
|
|
|
|
do { \
|
|
|
|
mca_pml_ob1_pckt_pending_t *_pckt; \
|
|
|
|
int _rc; \
|
|
|
|
\
|
|
|
|
MCA_PML_OB1_PCKT_PENDING_ALLOC(_pckt,_rc); \
|
|
|
|
_pckt->hdr.hdr_common.hdr_type = MCA_PML_OB1_HDR_TYPE_ACK; \
|
2007-01-05 01:07:37 +03:00
|
|
|
_pckt->hdr.hdr_ack.hdr_src_req.lval = (S); \
|
|
|
|
_pckt->hdr.hdr_ack.hdr_dst_req.pval = (D); \
|
2006-12-29 10:38:24 +03:00
|
|
|
_pckt->hdr.hdr_ack.hdr_rdma_offset = (O); \
|
|
|
|
_pckt->proc = (P); \
|
|
|
|
_pckt->bml_btl = NULL; \
|
|
|
|
OPAL_THREAD_LOCK(&mca_pml_ob1.lock); \
|
|
|
|
opal_list_append(&mca_pml_ob1.pckt_pending, \
|
|
|
|
(opal_list_item_t*)_pckt); \
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock); \
|
2006-07-20 18:44:35 +04:00
|
|
|
} while(0)
|
|
|
|
|
|
|
|
int mca_pml_ob1_recv_request_ack_send_btl(ompi_proc_t* proc,
|
2006-12-04 23:11:42 +03:00
|
|
|
mca_bml_base_btl_t* bml_btl, uint64_t hdr_src_req, void *hdr_dst_req,
|
2006-07-20 18:44:35 +04:00
|
|
|
uint64_t hdr_rdma_offset);
|
|
|
|
|
|
|
|
static inline int mca_pml_ob1_recv_request_ack_send(ompi_proc_t* proc,
|
2006-12-04 23:11:42 +03:00
|
|
|
uint64_t hdr_src_req, void *hdr_dst_req, uint64_t hdr_rdma_offset)
|
2006-07-20 18:44:35 +04:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
mca_bml_base_btl_t* bml_btl;
|
|
|
|
mca_bml_base_endpoint_t* endpoint =
|
|
|
|
(mca_bml_base_endpoint_t*)proc->proc_bml;
|
|
|
|
|
|
|
|
for(i = 0; i < mca_bml_base_btl_array_get_size(&endpoint->btl_eager); i++) {
|
|
|
|
bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager);
|
|
|
|
if(mca_pml_ob1_recv_request_ack_send_btl(proc, bml_btl, hdr_src_req,
|
|
|
|
hdr_dst_req, hdr_rdma_offset) == OMPI_SUCCESS)
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCA_PML_OB1_ADD_ACK_TO_PENDING(proc, hdr_src_req, hdr_dst_req,
|
|
|
|
hdr_rdma_offset);
|
|
|
|
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2006-10-29 12:12:24 +03:00
|
|
|
int mca_pml_ob1_recv_request_get_frag(mca_pml_ob1_rdma_frag_t* frag);
|
2006-07-20 18:44:35 +04:00
|
|
|
|
2006-10-29 12:12:24 +03:00
|
|
|
/* This function tries to continue recvreq that stuck due to resource
|
|
|
|
* unavailability. Recvreq is added to recv_pending list if scheduling of put
|
|
|
|
* operation cannot be accomplished for some reason. */
|
2006-07-20 18:44:35 +04:00
|
|
|
void mca_pml_ob1_recv_request_process_pending(void);
|
2006-10-29 12:12:24 +03:00
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|