static inline void mca_spml_yoda_bml_alloc( mca_bml_base_btl_t* bml_btl, mca_btl_base_descriptor_t** des, uint8_t order, size_t size, uint32_t flags, int use_send) { bool is_done; bool is_fence_complete; is_done = false; is_fence_complete = false; if (use_send) { size = (0 == size ? size : size + SPML_YODA_SEND_CONTEXT_SIZE); } do { mca_bml_base_alloc(bml_btl, des, MCA_BTL_NO_ORDER, size, flags); if (OPAL_UNLIKELY(!(*des) || !(*des)->des_segments ) && !is_fence_complete) { mca_spml_yoda_fence_internal(mca_spml_yoda.bml_alloc_threshold); is_fence_complete = true; } else { is_done = true; } } while (!is_done); }
static inline void mca_spml_yoda_bml_alloc( mca_bml_base_btl_t* bml_btl, mca_btl_base_descriptor_t** des, uint8_t order, size_t size, uint32_t flags, int use_send) { if (use_send) { size = (0 == size ? size : size + SPML_YODA_SEND_CONTEXT_SIZE); } mca_bml_base_alloc(bml_btl, des, MCA_BTL_NO_ORDER, size, flags); }
/** * Send an FIN to the peer. If we fail to send this ack (no more available * fragments or the send failed) this function automatically add the FIN * to the list of pending FIN, Which guarantee that the FIN will be sent * later. */ int mca_pml_ob1_send_fin( ompi_proc_t* proc, mca_bml_base_btl_t* bml_btl, ompi_ptr_t hdr_des, uint8_t order, uint32_t status ) { mca_btl_base_descriptor_t* fin; mca_pml_ob1_fin_hdr_t* hdr; int rc; mca_bml_base_alloc(bml_btl, &fin, order, sizeof(mca_pml_ob1_fin_hdr_t), MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); if(NULL == fin) { MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status); return OMPI_ERR_OUT_OF_RESOURCE; } fin->des_cbfunc = mca_pml_ob1_fin_completion; fin->des_cbdata = NULL; /* 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_des = hdr_des; hdr->hdr_fail = status; ob1_hdr_hton(hdr, MCA_PML_OB1_HDR_TYPE_FIN, proc); /* queue request */ rc = mca_bml_base_send( bml_btl, fin, MCA_PML_OB1_HDR_TYPE_FIN ); if( OPAL_LIKELY( rc >= 0 ) ) { if( OPAL_LIKELY( 1 == rc ) ) { MCA_PML_OB1_PROGRESS_PENDING(bml_btl); } return OMPI_SUCCESS; } mca_bml_base_free(bml_btl, fin); MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status); return OMPI_ERR_OUT_OF_RESOURCE; }
/** * Send an FIN to the peer. If we fail to send this ack (no more available * fragments or the send failed) this function automatically add the FIN * to the list of pending FIN, Which guarantee that the FIN will be sent * later. */ int mca_pml_ob1_send_fin( ompi_proc_t* proc, mca_bml_base_btl_t* bml_btl, opal_ptr_t hdr_frag, uint64_t rdma_size, uint8_t order, int status ) { mca_btl_base_descriptor_t* fin; int rc; mca_bml_base_alloc(bml_btl, &fin, order, sizeof(mca_pml_ob1_fin_hdr_t), MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_FLAGS_SIGNAL); if(NULL == fin) { MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_frag, rdma_size, bml_btl, order, status); return OMPI_ERR_OUT_OF_RESOURCE; } fin->des_cbfunc = mca_pml_ob1_fin_completion; fin->des_cbdata = NULL; /* fill in header */ mca_pml_ob1_fin_hdr_prepare ((mca_pml_ob1_fin_hdr_t *) fin->des_segments->seg_addr.pval, 0, hdr_frag.lval, status ? status : (int64_t) rdma_size); ob1_hdr_hton((mca_pml_ob1_hdr_t *) fin->des_segments->seg_addr.pval, MCA_PML_OB1_HDR_TYPE_FIN, proc); /* queue request */ rc = mca_bml_base_send( bml_btl, fin, MCA_PML_OB1_HDR_TYPE_FIN ); if( OPAL_LIKELY( rc >= 0 ) ) { if( OPAL_LIKELY( 1 == rc ) ) { MCA_PML_OB1_PROGRESS_PENDING(bml_btl); } return OMPI_SUCCESS; } mca_bml_base_free(bml_btl, fin); MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_frag, rdma_size, bml_btl, order, status); return OMPI_ERR_OUT_OF_RESOURCE; }