23 #ifndef OMPI_PML_CSUM_SEND_REQUEST_H
24 #define OMPI_PML_CSUM_SEND_REQUEST_H
33 #include "opal/datatype/opal_convertor.h"
39 MCA_PML_CSUM_SEND_PENDING_NONE,
40 MCA_PML_CSUM_SEND_PENDING_SCHEDULE,
41 MCA_PML_CSUM_SEND_PENDING_START
42 } mca_pml_csum_send_pending_t;
50 bool req_throttle_sends;
51 size_t req_pipeline_depth;
52 size_t req_bytes_delivered;
53 uint32_t req_rdma_cnt;
54 mca_pml_csum_send_pending_t req_pending;
65 uint64_t range_send_offset;
66 uint64_t range_send_length;
86 const mca_pml_csum_send_pending_t type,
92 sendreq->req_pending = type;
102 get_request_from_send_pending(mca_pml_csum_send_pending_t *type)
110 *type = sendreq->req_pending;
111 sendreq->req_pending = MCA_PML_CSUM_SEND_PENDING_NONE;
118 #define MCA_PML_CSUM_SEND_REQUEST_ALLOC( comm, \
123 ompi_proc_t *proc = ompi_comm_peer_lookup( comm, dst ); \
124 ompi_free_list_item_t* item; \
126 rc = OMPI_ERR_OUT_OF_RESOURCE; \
127 if( OPAL_LIKELY(NULL != proc) ) { \
129 OMPI_FREE_LIST_WAIT(&mca_pml_base_send_requests, item, rc); \
130 sendreq = (mca_pml_csum_send_request_t*)item; \
131 sendreq->req_send.req_base.req_proc = proc; \
136 #define MCA_PML_CSUM_SEND_REQUEST_INIT(sendreq, \
146 MCA_PML_BASE_SEND_REQUEST_INIT(&sendreq->req_send, \
156 (sendreq)->req_recv.pval = NULL; \
165 for(r = 0; r < sendreq->req_rdma_cnt; r++) {
167 if( NULL != reg && reg->mpool != NULL ) {
171 sendreq->req_rdma_cnt = 0;
179 #define MCA_PML_CSUM_SEND_REQUEST_START(sendreq, rc) \
181 rc = mca_pml_csum_send_request_start(sendreq); \
189 #define MCA_PML_CSUM_SEND_REQUEST_MPI_COMPLETE(sendreq, with_signal) \
191 (sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \
192 (sendreq)->req_send.req_base.req_comm->c_my_rank; \
193 (sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \
194 (sendreq)->req_send.req_base.req_tag; \
195 (sendreq)->req_send.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; \
196 (sendreq)->req_send.req_base.req_ompi.req_status._ucount = \
197 (sendreq)->req_send.req_bytes_packed; \
198 ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), (with_signal) ); \
200 PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
201 &(sendreq->req_send.req_base), PERUSE_SEND); \
208 #define MCA_PML_CSUM_SEND_REQUEST_RETURN(sendreq) \
211 MCA_PML_BASE_SEND_REQUEST_FINI((&(sendreq)->req_send)); \
212 OMPI_FREE_LIST_RETURN( &mca_pml_base_send_requests, \
213 (ompi_free_list_item_t*)sendreq); \
231 PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END,
232 &(sendreq->req_send.
req_base), PERUSE_SEND);
236 mca_pml_csum_free_rdma_resources(sendreq);
238 if (sendreq->req_send.
req_send_mode == MCA_PML_BASE_SEND_BUFFERED &&
246 MCA_PML_CSUM_SEND_REQUEST_MPI_COMPLETE(sendreq,
true);
251 MCA_PML_CSUM_SEND_REQUEST_RETURN(sendreq);
260 #if OPAL_ENABLE_MULTI_THREADS
268 if(sendreq->req_state == 0 &&
270 && lock_send_request(sendreq)) {
271 send_request_pml_complete(sendreq);
289 rc = mca_pml_csum_send_request_schedule_once(sendreq);
290 if(OPAL_SOS_GET_ERROR_CODE(rc) == OMPI_ERR_OUT_OF_RESOURCE)
292 }
while(!unlock_send_request(sendreq));
294 if(OMPI_SUCCESS == rc)
295 send_request_pml_complete_check(sendreq);
310 if(!lock_send_request(sendreq))
313 mca_pml_csum_send_request_schedule_exclusive(sendreq);
320 int mca_pml_csum_send_request_start_buffered(
325 int mca_pml_csum_send_request_start_copy(
330 int mca_pml_csum_send_request_start_prepare(
335 int mca_pml_csum_send_request_start_rdma(
340 int mca_pml_csum_send_request_start_rndv(
355 if( OPAL_LIKELY(size <= eager_limit) ) {
357 case MCA_PML_BASE_SEND_SYNCHRONOUS:
358 rc = mca_pml_csum_send_request_start_rndv(sendreq, bml_btl, size, 0);
360 case MCA_PML_BASE_SEND_BUFFERED:
361 rc = mca_pml_csum_send_request_start_copy(sendreq, bml_btl, size);
363 case MCA_PML_BASE_SEND_COMPLETE:
364 rc = mca_pml_csum_send_request_start_prepare(sendreq, bml_btl, size);
367 if (size != 0 && bml_btl->
btl_flags & MCA_BTL_FLAGS_SEND_INPLACE) {
368 rc = mca_pml_csum_send_request_start_prepare(sendreq, bml_btl, size);
370 rc = mca_pml_csum_send_request_start_copy(sendreq, bml_btl, size);
378 if(sendreq->req_send.
req_send_mode == MCA_PML_BASE_SEND_BUFFERED) {
379 rc = mca_pml_csum_send_request_start_buffered(sendreq, bml_btl, size);
385 if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_csum_rdma_btls(
386 sendreq->req_endpoint,
389 sendreq->req_rdma))) {
390 rc = mca_pml_csum_send_request_start_rdma(sendreq, bml_btl,
392 if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {
393 mca_pml_csum_free_rdma_resources(sendreq);
396 rc = mca_pml_csum_send_request_start_rndv(sendreq, bml_btl, size,
397 MCA_PML_CSUM_HDR_FLAGS_CONTIG);
400 rc = mca_pml_csum_send_request_start_rndv(sendreq, bml_btl, size, 0);
415 if( OPAL_UNLIKELY(endpoint == NULL) ) {
416 return OMPI_ERR_UNREACH;
419 sendreq->req_endpoint = endpoint;
420 sendreq->req_state = 0;
421 sendreq->req_lock = 0;
422 sendreq->req_pipeline_depth = 0;
423 sendreq->req_bytes_delivered = 0;
424 sendreq->req_pending = MCA_PML_CSUM_SEND_PENDING_NONE;
436 rc = mca_pml_csum_send_request_start_btl(sendreq, bml_btl);
437 if( OPAL_LIKELY(OMPI_ERR_OUT_OF_RESOURCE != OPAL_SOS_GET_ERROR_CODE(rc)) )
440 add_request_to_send_pending(sendreq, MCA_PML_CSUM_SEND_PENDING_START,
true);
466 uint64_t send_offset, uint64_t send_length);
Header used to initiate an RDMA operation.
Definition: pml_csum_hdr.h:245
#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
struct mca_bml_base_endpoint_t * proc_bml
BML specific proc data.
Definition: proc.h:64
uint32_t btl_flags
support for put/get?
Definition: bml.h:59
void opal_atomic_rmb(void)
Read memory barrier.
Definition: pml_csum_sendreq.h:63
Definition: pml_csum.h:297
struct ompi_communicator_t * req_comm
communicator pointer
Definition: pml_base_request.h:63
Union of defined hdr types.
Definition: pml_csum_hdr.h:298
Cached on ompi_communicator_t to hold queues/state used by the PML<->PTL interface for matching logic...
Definition: pml_bfo_comm.h:51
Definition: mutex_unix.h:53
size_t btl_rndv_eager_limit
the size of a data sent in a first fragment of rendezvous protocol
Definition: btl.h:791
int32_t send_sequence
send side sequence number
Definition: pml_bfo_comm.h:38
int32_t req_peer
peer process - rank w/in this communicator
Definition: pml_base_request.h:71
BML Management Layer (BML)
Definition: opal_list.h:98
#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
void * req_addr
pointer to send buffer - may not be application buffer
Definition: pml_base_sendreq.h:39
#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
Definition: pml_csum_sendreq.h:44
mca_pml_base_request_t req_base
base request type - common data structure for use by wait/test
Definition: pml_base_sendreq.h:38
#define opal_list_append(l, i)
Append an item to the end of the list.
Definition: opal_list.h:410
volatile bool req_pml_complete
flag indicating if the pt-2-pt layer is done with this request
Definition: pml_base_request.h:61
Byte Transfer Layer (BTL)
struct ompi_proc_t * req_proc
peer process
Definition: pml_base_request.h:73
mca_bml_base_btl_array_t btl_eager
array of btls to use for first fragments
Definition: bml.h:228
Definition: pml_csum_rdmafrag.h:35
volatile bool req_complete
Flag indicating wether request has completed.
Definition: request.h:104
mca_mpool_base_module_deregister_fn_t mpool_deregister
deregister memory
Definition: mpool.h:181
Base type for send requests.
Definition: pml_base_sendreq.h:37
Definition: ompi_free_list.h:62
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
#define MCA_PML_BASE_SEND_START(request)
Mark the request as started from the PML base point of view.
Definition: pml_base_sendreq.h:120
Definition: opal_list.h:147
static opal_list_item_t * opal_list_remove_first(opal_list_t *list)
Remove the first item from the list and return it.
Definition: opal_list.h:522
static void opal_list_prepend(opal_list_t *list, opal_list_item_t *item)
Prepend an item to the beginning of the list.
Definition: opal_list.h:469
struct mca_btl_base_module_t * btl
BTL module.
Definition: bml.h:61
ompi_request_t req_ompi
base request
Definition: pml_base_request.h:60
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
size_t req_bytes_packed
packed size of a message given the datatype and count
Definition: pml_base_sendreq.h:40
mca_pml_base_send_mode_t req_send_mode
type of send
Definition: pml_base_sendreq.h:41
Main top-level request struct definition.
Definition: request.h:100
size_t btl_eager_limit
maximum size of first fragment – eager send
Definition: btl.h:790
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
uint64_t req_sequence
sequence number for MPI pt-2-pt ordering
Definition: pml_base_request.h:74
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