23 #ifndef OMPI_PML_BFO_RECV_REQUEST_H
24 #define OMPI_PML_BFO_RECV_REQUEST_H
34 #define RECVREQ_RECVERRSENT 0x01
35 #define RECVREQ_RNDVRESTART_RECVED 0x02
36 #define RECVREQ_RNDVRESTART_ACKED 0x04
47 int32_t req_restartseq;
51 size_t req_pipeline_depth;
54 size_t req_rdma_offset;
55 size_t req_send_offset;
56 uint32_t req_rdma_cnt;
57 uint32_t req_rdma_idx;
84 #define MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq, rc) \
86 ompi_free_list_item_t* item; \
88 OMPI_FREE_LIST_GET(&mca_pml_base_recv_requests, item, rc); \
89 recvreq = (mca_pml_bfo_recv_request_t*)item; \
105 #define MCA_PML_BFO_RECV_REQUEST_INIT( request, \
114 MCA_PML_BASE_RECV_REQUEST_INIT( &(request)->req_recv, \
129 #define MCA_PML_BFO_RECV_REQUEST_MPI_COMPLETE( recvreq ) \
131 PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
132 &(recvreq->req_recv.req_base), PERUSE_RECV ); \
133 ompi_request_complete( &(recvreq->req_recv.req_base.req_ompi), true ); \
139 #define MCA_PML_BFO_RECV_REQUEST_RETURN(recvreq) \
141 MCA_PML_BASE_RECV_REQUEST_FINI(&(recvreq)->req_recv); \
142 OMPI_FREE_LIST_RETURN( &mca_pml_base_recv_requests, \
143 (ompi_free_list_item_t*)(recvreq)); \
160 PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END,
161 &recvreq->req_recv.
req_base, PERUSE_RECV );
164 for(i = 0; i < recvreq->req_rdma_cnt; i++) {
166 if( NULL != btl_reg && btl_reg->mpool != NULL) {
170 recvreq->req_rdma_cnt = 0;
172 recvreq->req_msgseq -= 100;
177 MCA_PML_BFO_RECV_REQUEST_RETURN(recvreq);
197 #if OPAL_ENABLE_MULTI_THREADS
203 (0 == recvreq->req_events) && lock_recv_request(recvreq)) {
205 lock_recv_request(recvreq)) {
215 #define MCA_PML_BFO_RECV_REQUEST_START(r) mca_pml_bfo_recv_req_start(r)
220 opal_convertor_copy_and_prepare_for_recv(
232 #define MCA_PML_BFO_RECV_REQUEST_MATCHED(request, hdr) \
233 recv_req_matched(request, hdr)
242 req->req_msgseq = hdr->
hdr_seq;
244 #if OPAL_ENABLE_MULTI_THREADS
248 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
251 prepare_recv_req_converter(req);
254 PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_XFER_BEGIN,
255 &req->req_recv.
req_base, PERUSE_RECV);
264 #define MCA_PML_BFO_RECV_REQUEST_UNPACK( request, \
272 bytes_delivered = 0; \
273 if(request->req_recv.req_bytes_packed > 0) { \
274 struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; \
275 uint32_t iov_count = 0; \
276 size_t max_data = bytes_received; \
277 size_t n, offset = seg_offset; \
278 mca_btl_base_segment_t* segment = segments; \
280 OPAL_THREAD_LOCK(&request->lock); \
281 for( n = 0; n < num_segments; n++, segment++ ) { \
282 if(offset >= segment->seg_len) { \
283 offset -= segment->seg_len; \
285 iov[iov_count].iov_len = segment->seg_len - offset; \
286 iov[iov_count].iov_base = (IOVBASE_TYPE*) \
287 ((unsigned char*)segment->seg_addr.pval + offset); \
292 PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \
293 &(recvreq->req_recv.req_base), max_data, \
295 opal_convertor_set_position( &(request->req_recv.req_base.req_convertor), \
297 opal_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \
301 bytes_delivered = max_data; \
302 OPAL_THREAD_UNLOCK(&request->lock); \
311 void mca_pml_bfo_recv_request_progress_match(
315 size_t num_segments);
321 void mca_pml_bfo_recv_request_progress_frag(
325 size_t num_segments);
335 size_t num_segments);
341 void mca_pml_bfo_recv_request_progress_rget(
345 size_t num_segments);
355 size_t num_segments);
361 int mca_pml_bfo_recv_request_schedule_once(
364 static inline int mca_pml_bfo_recv_request_schedule_exclusive(
371 rc = mca_pml_bfo_recv_request_schedule_once(req, start_bml_btl);
372 if(OPAL_SOS_GET_ERROR_CODE(rc) == OMPI_ERR_OUT_OF_RESOURCE)
374 }
while(!unlock_recv_request(req));
376 if(OMPI_SUCCESS == rc)
377 recv_request_pml_complete_check(req);
382 static inline void mca_pml_bfo_recv_request_schedule(
386 if(!lock_recv_request(req))
389 (void)mca_pml_bfo_recv_request_schedule_exclusive(req, start_bml_btl);
392 #define MCA_PML_BFO_ADD_ACK_TO_PENDING(P, S, D, O) \
394 mca_pml_bfo_pckt_pending_t *_pckt; \
397 MCA_PML_BFO_PCKT_PENDING_ALLOC(_pckt,_rc); \
398 _pckt->hdr.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_ACK; \
399 _pckt->hdr.hdr_ack.hdr_src_req.lval = (S); \
400 _pckt->hdr.hdr_ack.hdr_dst_req.pval = (D); \
401 _pckt->hdr.hdr_ack.hdr_send_offset = (O); \
403 _pckt->bml_btl = NULL; \
404 OPAL_THREAD_LOCK(&mca_pml_bfo.lock); \
405 opal_list_append(&mca_pml_bfo.pckt_pending, \
406 (opal_list_item_t*)_pckt); \
407 OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); \
410 int mca_pml_bfo_recv_request_ack_send_btl(
ompi_proc_t* proc,
412 uint64_t hdr_rdma_offset,
bool nordma);
414 static inline int mca_pml_bfo_recv_request_ack_send(
ompi_proc_t* proc,
415 uint64_t hdr_src_req,
void *hdr_dst_req, uint64_t hdr_send_offset,
425 if(mca_pml_bfo_recv_request_ack_send_btl(proc, bml_btl, hdr_src_req,
426 hdr_dst_req, hdr_send_offset, nordma) == OMPI_SUCCESS)
430 MCA_PML_BFO_ADD_ACK_TO_PENDING(proc, hdr_src_req, hdr_dst_req,
433 return OMPI_ERR_OUT_OF_RESOURCE;
441 void mca_pml_bfo_recv_request_process_pending(
void);
#define OPAL_THREAD_ADD32(x, y)
Use an atomic operation for increment/decrement if opal_using_threads() indicates that threads are in...
Definition: mutex.h:367
void mca_pml_bfo_recv_request_matched_probe(mca_pml_bfo_recv_request_t *req, struct mca_btl_base_module_t *btl, mca_btl_base_segment_t *segments, size_t num_segments)
Handle completion of a probe request.
Definition: pml_bfo_recvreq.c:734
struct mca_bml_base_endpoint_t * proc_bml
BML specific proc data.
Definition: proc.h:64
Definition: pml_bfo.h:299
Definition: pml_bfo_recvreq.h:41
ompi_status_public_t req_status
Completion status.
Definition: request.h:103
void opal_atomic_rmb(void)
Read memory barrier.
Header definition for the first fragment, contains the attributes required to match the corresponding...
Definition: pml_bfo_hdr.h:77
size_t req_count
count of user datatype elements
Definition: pml_base_request.h:70
int32_t hdr_tag
user tag
Definition: pml_bfo_hdr.h:81
bool req_match_received
Prevent request to be completed prematurely.
Definition: pml_bfo_recvreq.h:60
mca_pml_base_request_t req_base
base request
Definition: pml_base_recvreq.h:37
Definition: mutex_unix.h:53
int32_t req_peer
peer process - rank w/in this communicator
Definition: pml_base_request.h:71
Process identification structure interface.
Remote Open MPI process structure.
Definition: proc.h:56
#define MCA_PML_BFO_RECV_REQUEST_MPI_COMPLETE(recvreq)
Mark the request as completed at MPI level for internal purposes.
Definition: pml_bfo_recvreq.h:129
#define OPAL_THREAD_LOCK(mutex)
Lock a mutex if opal_using_threads() says that multiple threads may be active in the process...
Definition: mutex.h:223
#define OPAL_THREAD_UNLOCK(mutex)
Unlock a mutex if opal_using_threads() says that multiple threads may be active in the process...
Definition: mutex.h:309
opal_convertor_t req_convertor
always need the convertor
Definition: pml_base_request.h:66
static void recv_request_pml_complete(mca_pml_bfo_recv_request_t *recvreq)
Complete receive request.
Definition: pml_bfo_recvreq.h:153
volatile bool req_pml_complete
flag indicating if the pt-2-pt layer is done with this request
Definition: pml_base_request.h:61
opal_datatype_t super
Base opal_datatype_t superclass.
Definition: ompi_datatype.h:69
struct ompi_proc_t * req_proc
peer process
Definition: pml_base_request.h:73
size_t size
total size in bytes of the memory used by the data if the data is put on a contiguous buffer ...
Definition: opal_datatype.h:108
int32_t hdr_src
source rank
Definition: pml_bfo_hdr.h:80
mca_bml_base_btl_array_t btl_eager
array of btls to use for first fragments
Definition: bml.h:228
mca_mpool_base_module_deregister_fn_t mpool_deregister
deregister memory
Definition: mpool.h:181
struct ompi_datatype_t * req_datatype
pointer to data type
Definition: pml_base_request.h:64
Structure associated w/ ompi_proc_t that contains the set of BTLs used to reach a destination...
Definition: bml.h:222
void * req_addr
pointer to application buffer
Definition: pml_base_request.h:69
Definition: pml_bfo_rdmafrag.h:36
void opal_atomic_wmb(void)
Write memory barrier.
struct opal_convertor_t * proc_convertor
Base convertor for the proc described by this process.
Definition: proc.h:70
Base type for receive requests.
Definition: pml_base_recvreq.h:36
size_t req_bytes_received
amount of data transferred into the user buffer
Definition: pml_bfo_recvreq.h:52
void mca_pml_bfo_recv_request_progress_rndv(mca_pml_bfo_recv_request_t *req, struct mca_btl_base_module_t *btl, mca_btl_base_segment_t *segments, size_t num_segments)
Definition: pml_bfo_recvreq.c:622
ompi_request_t req_ompi
base request
Definition: pml_base_request.h:60
bool req_ack_sent
whether ack was sent to the sender
Definition: pml_bfo_recvreq.h:59
static size_t mca_bml_base_btl_array_get_size(mca_bml_base_btl_array_t *array)
If required, reallocate (grow) the array to the indicate size.
Definition: bml.h:91
BTL module interface functions and attributes.
Definition: btl.h:786
uint16_t hdr_seq
message sequence number
Definition: pml_bfo_hdr.h:82
size_t req_bytes_expected
local size of the data as suggested by the user
Definition: pml_bfo_recvreq.h:53
void mca_pml_bfo_recv_req_start(mca_pml_bfo_recv_request_t *req)
Definition: pml_bfo_recvreq.c:1046
size_t req_bytes_packed
size of message being received
Definition: pml_base_recvreq.h:38
Describes a region/segment of memory that is addressable by an BTL.
Definition: btl.h:236
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
volatile bool req_free_called
flag indicating if the user has freed this request
Definition: pml_base_request.h:65
static mca_bml_base_btl_t * mca_bml_base_btl_array_get_next(mca_bml_base_btl_array_t *array)
Return the next LRU index in the array.
Definition: bml.h:179