Consolidate receive buffers prepost code for HP/LP QPs.
This commit was SVN r11552.
Этот коммит содержится в:
родитель
e7650ff48a
Коммит
d0caffa0aa
@ -148,12 +148,14 @@ int mca_btl_openib_size_queues( struct mca_btl_openib_module_t* openib_btl, size
|
|||||||
if(!first_time) {
|
if(!first_time) {
|
||||||
struct ibv_srq_attr srq_attr;
|
struct ibv_srq_attr srq_attr;
|
||||||
srq_attr.max_wr = openib_btl->rd_num;
|
srq_attr.max_wr = openib_btl->rd_num;
|
||||||
rc = ibv_modify_srq( openib_btl->srq_hp, &srq_attr, IBV_SRQ_MAX_WR);
|
rc = ibv_modify_srq(openib_btl->srq[BTL_OPENIB_HP_QP],
|
||||||
|
&srq_attr, IBV_SRQ_MAX_WR);
|
||||||
if(rc) {
|
if(rc) {
|
||||||
BTL_ERROR(("cannot resize high priority shared receive queue, error: %d", rc));
|
BTL_ERROR(("cannot resize high priority shared receive queue, error: %d", rc));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
rc = ibv_modify_srq(openib_btl->srq_lp, &srq_attr, IBV_SRQ_MAX_WR);
|
rc = ibv_modify_srq(openib_btl->srq[BTL_OPENIB_LP_QP],
|
||||||
|
&srq_attr, IBV_SRQ_MAX_WR);
|
||||||
if(rc) {
|
if(rc) {
|
||||||
BTL_ERROR(("cannot resize low priority shared receive queue, error: %d", rc));
|
BTL_ERROR(("cannot resize low priority shared receive queue, error: %d", rc));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
@ -673,7 +675,7 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl,
|
|||||||
frag->sg_entry.addr = (unsigned long) frag->base.des_src->seg_addr.pval;
|
frag->sg_entry.addr = (unsigned long) frag->base.des_src->seg_addr.pval;
|
||||||
frag->sg_entry.length = frag->base.des_src->seg_len;
|
frag->sg_entry.length = frag->base.des_src->seg_len;
|
||||||
|
|
||||||
if(ibv_post_send(endpoint->lcl_qp_lp,
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
||||||
&frag->wr_desc.sr_desc,
|
&frag->wr_desc.sr_desc,
|
||||||
&bad_wr)){
|
&bad_wr)){
|
||||||
rc = OMPI_ERROR;
|
rc = OMPI_ERROR;
|
||||||
@ -682,11 +684,11 @@ int mca_btl_openib_put( mca_btl_base_module_t* btl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
||||||
} else {
|
} else {
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -735,7 +737,7 @@ int mca_btl_openib_get( mca_btl_base_module_t* btl,
|
|||||||
frag->sg_entry.addr = (unsigned long) frag->base.des_dst->seg_addr.pval;
|
frag->sg_entry.addr = (unsigned long) frag->base.des_dst->seg_addr.pval;
|
||||||
frag->sg_entry.length = frag->base.des_dst->seg_len;
|
frag->sg_entry.length = frag->base.des_dst->seg_len;
|
||||||
|
|
||||||
if(ibv_post_send(endpoint->lcl_qp_lp,
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
||||||
&frag->wr_desc.sr_desc,
|
&frag->wr_desc.sr_desc,
|
||||||
&bad_wr)){
|
&bad_wr)){
|
||||||
BTL_ERROR(("error posting send request errno (%d) says %s", errno, strerror(errno)));
|
BTL_ERROR(("error posting send request errno (%d) says %s", errno, strerror(errno)));
|
||||||
@ -745,11 +747,11 @@ int mca_btl_openib_get( mca_btl_base_module_t* btl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
||||||
} else {
|
} else {
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -770,25 +772,27 @@ int mca_btl_openib_create_cq_srq(mca_btl_openib_module_t *openib_btl)
|
|||||||
attr.attr.max_wr = mca_btl_openib_component.srq_rd_max;
|
attr.attr.max_wr = mca_btl_openib_component.srq_rd_max;
|
||||||
attr.attr.max_sge = mca_btl_openib_component.ib_sg_list_size;
|
attr.attr.max_sge = mca_btl_openib_component.ib_sg_list_size;
|
||||||
|
|
||||||
openib_btl->srd_posted_hp = 0;
|
openib_btl->srd_posted[BTL_OPENIB_HP_QP] = 0;
|
||||||
openib_btl->srd_posted_lp = 0;
|
openib_btl->srd_posted[BTL_OPENIB_LP_QP] = 0;
|
||||||
|
|
||||||
openib_btl->srq_hp = ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
openib_btl->srq[BTL_OPENIB_HP_QP] =
|
||||||
if(NULL == openib_btl->srq_hp) {
|
ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
||||||
|
if(NULL == openib_btl->srq[BTL_OPENIB_HP_QP]) {
|
||||||
BTL_ERROR(("error in ibv_create_srq\n"));
|
BTL_ERROR(("error in ibv_create_srq\n"));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
openib_btl->srq_lp = ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
openib_btl->srq[BTL_OPENIB_LP_QP] =
|
||||||
if(NULL == openib_btl->srq_hp) {
|
ibv_create_srq(openib_btl->hca->ib_pd, &attr);
|
||||||
|
if(NULL == openib_btl->srq[BTL_OPENIB_LP_QP]) {
|
||||||
BTL_ERROR(("error in ibv_create_srq\n"));
|
BTL_ERROR(("error in ibv_create_srq\n"));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
openib_btl->srq_hp = NULL;
|
openib_btl->srq[BTL_OPENIB_HP_QP] = NULL;
|
||||||
openib_btl->srq_lp = NULL;
|
openib_btl->srq[BTL_OPENIB_LP_QP] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the low and high priority queue pairs */
|
/* Create the low and high priority queue pairs */
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
|
|
||||||
#include "ompi/mca/btl/btl.h"
|
#include "ompi/mca/btl/btl.h"
|
||||||
#include "ompi/mca/btl/base/base.h"
|
#include "ompi/mca/btl/base/base.h"
|
||||||
#include "btl_openib_endpoint.h"
|
|
||||||
|
#include "btl_openib_frag.h"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -138,6 +139,11 @@ extern mca_btl_openib_component_t mca_btl_openib_component;
|
|||||||
|
|
||||||
typedef mca_btl_base_recv_reg_t mca_btl_openib_recv_reg_t;
|
typedef mca_btl_base_recv_reg_t mca_btl_openib_recv_reg_t;
|
||||||
|
|
||||||
|
struct mca_btl_openib_port_info_t {
|
||||||
|
uint32_t mtu;
|
||||||
|
uint16_t subnet;
|
||||||
|
};
|
||||||
|
typedef struct mca_btl_openib_port_info_t mca_btl_openib_port_info_t;
|
||||||
|
|
||||||
struct mca_btl_openib_hca_t {
|
struct mca_btl_openib_hca_t {
|
||||||
struct ibv_device *ib_dev; /* the ib device */
|
struct ibv_device *ib_dev; /* the ib device */
|
||||||
@ -181,11 +187,8 @@ struct mca_btl_openib_module_t {
|
|||||||
size_t ib_inline_max; /**< max size of inline send*/
|
size_t ib_inline_max; /**< max size of inline send*/
|
||||||
bool poll_cq;
|
bool poll_cq;
|
||||||
|
|
||||||
|
struct ibv_srq *srq[2];
|
||||||
struct ibv_srq *srq_hp;
|
int32_t srd_posted[2];
|
||||||
struct ibv_srq *srq_lp;
|
|
||||||
int32_t srd_posted_hp;
|
|
||||||
int32_t srd_posted_lp;
|
|
||||||
int32_t num_peers;
|
int32_t num_peers;
|
||||||
int32_t rd_num;
|
int32_t rd_num;
|
||||||
int32_t rd_low;
|
int32_t rd_low;
|
||||||
@ -205,7 +208,6 @@ struct mca_btl_openib_module_t {
|
|||||||
orte_pointer_array_t *endpoints;
|
orte_pointer_array_t *endpoints;
|
||||||
}; typedef struct mca_btl_openib_module_t mca_btl_openib_module_t;
|
}; typedef struct mca_btl_openib_module_t mca_btl_openib_module_t;
|
||||||
|
|
||||||
struct mca_btl_openib_frag_t;
|
|
||||||
extern mca_btl_openib_module_t mca_btl_openib_module;
|
extern mca_btl_openib_module_t mca_btl_openib_module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,75 +409,45 @@ extern void mca_btl_openib_send_frag_return(
|
|||||||
|
|
||||||
int mca_btl_openib_create_cq_srq(mca_btl_openib_module_t* openib_btl);
|
int mca_btl_openib_create_cq_srq(mca_btl_openib_module_t* openib_btl);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, additional) \
|
|
||||||
{ \
|
|
||||||
do{ \
|
|
||||||
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
|
||||||
if(openib_btl->srd_posted_hp <= openib_btl->rd_low+additional && \
|
|
||||||
openib_btl->srd_posted_hp < openib_btl->rd_num){ \
|
|
||||||
MCA_BTL_OPENIB_POST_SRR_SUB(openib_btl->rd_num - \
|
|
||||||
openib_btl->srd_posted_hp, \
|
|
||||||
openib_btl, \
|
|
||||||
&openib_btl->recv_free_eager, \
|
|
||||||
&openib_btl->srd_posted_hp, \
|
|
||||||
openib_btl->srq_hp); \
|
|
||||||
} \
|
|
||||||
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
|
||||||
} while(0); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, additional) \
|
|
||||||
{ \
|
|
||||||
do { \
|
|
||||||
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
|
||||||
if(openib_btl->srd_posted_lp <= openib_btl->rd_low+additional && \
|
|
||||||
openib_btl->srd_posted_lp < openib_btl->rd_num){ \
|
|
||||||
MCA_BTL_OPENIB_POST_SRR_SUB(openib_btl->rd_num - \
|
|
||||||
openib_btl->srd_posted_lp, \
|
|
||||||
openib_btl, \
|
|
||||||
&openib_btl->recv_free_max, \
|
|
||||||
&openib_btl->srd_posted_lp, \
|
|
||||||
openib_btl->srq_lp); \
|
|
||||||
} \
|
|
||||||
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
|
||||||
} while(0); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_POST_SRR_SUB(cnt, \
|
|
||||||
openib_btl, \
|
|
||||||
frag_list, \
|
|
||||||
srd_posted, \
|
|
||||||
srq) \
|
|
||||||
{\
|
|
||||||
do { \
|
|
||||||
int32_t i; \
|
|
||||||
int32_t num_post = cnt; \
|
|
||||||
ompi_free_list_item_t* item = NULL; \
|
|
||||||
mca_btl_openib_frag_t* frag = NULL; \
|
|
||||||
struct ibv_recv_wr *bad_wr; \
|
|
||||||
int32_t rc; \
|
|
||||||
for(i = 0; i < num_post; i++) { \
|
|
||||||
OMPI_FREE_LIST_WAIT(frag_list, item, rc); \
|
|
||||||
frag = (mca_btl_openib_frag_t*) item; \
|
|
||||||
frag->sg_entry.length = frag->size + \
|
|
||||||
((unsigned char*) frag->segment.seg_addr.pval- \
|
|
||||||
(unsigned char*) frag->hdr); \
|
|
||||||
if(ibv_post_srq_recv(srq, &frag->wr_desc.rd_desc, &bad_wr)) { \
|
|
||||||
BTL_ERROR(("error posting receive descriptors to shared receive queue: %s",\
|
|
||||||
strerror(errno))); \
|
|
||||||
return OMPI_ERROR; \
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
OPAL_THREAD_ADD32(srd_posted, num_post); \
|
|
||||||
} while(0);\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define BTL_OPENIB_HP_QP 0
|
#define BTL_OPENIB_HP_QP 0
|
||||||
#define BTL_OPENIB_LP_QP 1
|
#define BTL_OPENIB_LP_QP 1
|
||||||
|
|
||||||
|
static inline mca_btl_openib_post_srr(mca_btl_openib_module_t* openib_btl,
|
||||||
|
const int additional, const int prio)
|
||||||
|
{
|
||||||
|
OPAL_THREAD_LOCK(&openib_btl->ib_lock);
|
||||||
|
if(openib_btl->srd_posted[prio] <= openib_btl->rd_low + additional &&
|
||||||
|
openib_btl->srd_posted[prio] < openib_btl->rd_num) {
|
||||||
|
int32_t i, rc;
|
||||||
|
int32_t num_post = openib_btl->rd_num - openib_btl->srd_posted[prio];
|
||||||
|
ompi_free_list_item_t* item;
|
||||||
|
mca_btl_openib_frag_t* frag;
|
||||||
|
struct ibv_recv_wr *bad_wr;
|
||||||
|
ompi_free_list_t *free_list;
|
||||||
|
|
||||||
|
if(BTL_OPENIB_HP_QP == prio)
|
||||||
|
free_list = &openib_btl->recv_free_eager;
|
||||||
|
else
|
||||||
|
free_list = &openib_btl->recv_free_max;
|
||||||
|
|
||||||
|
for(i = 0; i < num_post; i++) {
|
||||||
|
OMPI_FREE_LIST_WAIT(free_list, item, rc);
|
||||||
|
frag = (mca_btl_openib_frag_t*)item;
|
||||||
|
frag->sg_entry.length = frag->size +
|
||||||
|
((unsigned char*)frag->segment.seg_addr.pval -
|
||||||
|
(unsigned char*)frag->hdr);
|
||||||
|
if(ibv_post_srq_recv(openib_btl->srq[prio], &frag->wr_desc.rd_desc,
|
||||||
|
&bad_wr)) {
|
||||||
|
BTL_ERROR(("error posting receive descriptors to shared "
|
||||||
|
"receive queue: %s", strerror(errno)));
|
||||||
|
return OMPI_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OPAL_THREAD_ADD32(&openib_btl->srd_posted[prio], num_post);
|
||||||
|
}
|
||||||
|
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -203,10 +203,10 @@ static void btl_openib_control(struct mca_btl_base_module_t* btl,
|
|||||||
/* if not sent via rdma */
|
/* if not sent via rdma */
|
||||||
if(!MCA_BTL_OPENIB_RDMA_FRAG(frag) &&
|
if(!MCA_BTL_OPENIB_RDMA_FRAG(frag) &&
|
||||||
ctl_hdr->type == MCA_BTL_OPENIB_CONTROL_CREDITS) {
|
ctl_hdr->type == MCA_BTL_OPENIB_CONTROL_CREDITS) {
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, -1);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_HP_QP], -1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_lp, -1);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_LP_QP], -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ctl_hdr->type) {
|
switch (ctl_hdr->type) {
|
||||||
@ -745,21 +745,23 @@ static int btl_openib_handle_incoming_hp(mca_btl_openib_module_t *openib_btl,
|
|||||||
|
|
||||||
|
|
||||||
/* check to see if we need to return credits */
|
/* check to see if we need to return credits */
|
||||||
if((endpoint->rd_credits_hp >= mca_btl_openib_component.rd_win ||
|
if((endpoint->rd_credits[BTL_OPENIB_HP_QP] >=
|
||||||
|
mca_btl_openib_component.rd_win ||
|
||||||
endpoint->eager_rdma_local.credits >=
|
endpoint->eager_rdma_local.credits >=
|
||||||
mca_btl_openib_component.rd_win) &&
|
mca_btl_openib_component.rd_win) &&
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_hp, 1) == 1) {
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP],1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* repost receive descriptors if receive not by RDMA */
|
/* repost receive descriptors if receive not by RDMA */
|
||||||
if(!MCA_BTL_OPENIB_RDMA_FRAG(frag)) {
|
if(!MCA_BTL_OPENIB_RDMA_FRAG(frag)) {
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
OPAL_THREAD_ADD32((int32_t*) &openib_btl->srd_posted_hp, -1);
|
OPAL_THREAD_ADD32((int32_t*)&openib_btl->srd_posted[BTL_OPENIB_HP_QP], -1);
|
||||||
MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, 0);
|
mca_btl_openib_post_srr(openib_btl, 0, BTL_OPENIB_HP_QP);
|
||||||
} else {
|
} else {
|
||||||
OPAL_THREAD_ADD32((int32_t*) &endpoint->rd_posted_hp, -1);
|
OPAL_THREAD_ADD32((int32_t*)&endpoint->rd_posted[BTL_OPENIB_HP_QP],
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 0);
|
-1);
|
||||||
|
btl_openib_endpoint_post_rr(endpoint, 0, BTL_OPENIB_HP_QP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,8 +1020,11 @@ static int btl_openib_component_progress(void)
|
|||||||
|
|
||||||
if(!mca_btl_openib_component.use_srq) {
|
if(!mca_btl_openib_component.use_srq) {
|
||||||
/* check to see if we need to return credits */
|
/* check to see if we need to return credits */
|
||||||
if((endpoint->rd_credits_hp >= mca_btl_openib_component.rd_win || endpoint->eager_rdma_local.credits >= mca_btl_openib_component.rd_win) &&
|
if((endpoint->rd_credits[BTL_OPENIB_HP_QP] >=
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_hp, 1) == 1) {
|
mca_btl_openib_component.rd_win ||
|
||||||
|
endpoint->eager_rdma_local.credits >=
|
||||||
|
mca_btl_openib_component.rd_win) &&
|
||||||
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP], 1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1075,8 +1080,9 @@ static int btl_openib_component_progress(void)
|
|||||||
|
|
||||||
if(!mca_btl_openib_component.use_srq) {
|
if(!mca_btl_openib_component.use_srq) {
|
||||||
/* check to see if we need to return credits */
|
/* check to see if we need to return credits */
|
||||||
if( endpoint->rd_credits_lp >= mca_btl_openib_component.rd_win &&
|
if( endpoint->rd_credits[BTL_OPENIB_LP_QP] >=
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_lp, 1) == 1) {
|
mca_btl_openib_component.rd_win &&
|
||||||
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP], 1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1119,13 +1125,13 @@ static int btl_openib_component_progress(void)
|
|||||||
|
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
/* repost receive descriptors */
|
/* repost receive descriptors */
|
||||||
OPAL_THREAD_ADD32((int32_t*) &openib_btl->srd_posted_lp, -1);
|
OPAL_THREAD_ADD32((int32_t*)&openib_btl->srd_posted[BTL_OPENIB_LP_QP], -1);
|
||||||
MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, 0);
|
mca_btl_openib_post_srr(openib_btl, 0, BTL_OPENIB_LP_QP);
|
||||||
} else {
|
} else {
|
||||||
/* repost receive descriptors */
|
/* repost receive descriptors */
|
||||||
OPAL_THREAD_ADD32((int32_t*) &endpoint->rd_posted_lp, -1);
|
OPAL_THREAD_ADD32((int32_t*)
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 0);
|
&endpoint->rd_posted[BTL_OPENIB_LP_QP], -1);
|
||||||
|
btl_openib_endpoint_post_rr(endpoint, 0, BTL_OPENIB_LP_QP);
|
||||||
|
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_tokens[BTL_OPENIB_LP_QP],
|
OPAL_THREAD_ADD32(&endpoint->sd_tokens[BTL_OPENIB_LP_QP],
|
||||||
credits);
|
credits);
|
||||||
@ -1135,8 +1141,9 @@ static int btl_openib_component_progress(void)
|
|||||||
BTL_OPENIB_LP_QP);
|
BTL_OPENIB_LP_QP);
|
||||||
|
|
||||||
/* check to see if we need to return credits */
|
/* check to see if we need to return credits */
|
||||||
if(endpoint->rd_credits_lp >= mca_btl_openib_component.rd_win &&
|
if(endpoint->rd_credits[BTL_OPENIB_LP_QP] >=
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_lp, 1) == 1) {
|
mca_btl_openib_component.rd_win &&
|
||||||
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP], 1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include "btl_openib.h"
|
#include "btl_openib.h"
|
||||||
#include "btl_openib_endpoint.h"
|
|
||||||
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
|
@ -62,7 +62,6 @@ int mca_btl_openib_endpoint_qp_init_query(
|
|||||||
uint32_t port_num
|
uint32_t port_num
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* post a send to the work queue
|
* post a send to the work queue
|
||||||
*/
|
*/
|
||||||
@ -131,25 +130,27 @@ static inline int mca_btl_openib_endpoint_post_send(mca_btl_openib_module_t* ope
|
|||||||
OPAL_THREAD_ADD32(&endpoint->eager_rdma_local.credits,
|
OPAL_THREAD_ADD32(&endpoint->eager_rdma_local.credits,
|
||||||
-frag->hdr->credits);
|
-frag->hdr->credits);
|
||||||
frag->hdr->credits |= BTL_OPENIB_RDMA_CREDITS_FLAG;
|
frag->hdr->credits |= BTL_OPENIB_RDMA_CREDITS_FLAG;
|
||||||
} else if(endpoint->rd_credits_hp > 0) {
|
} else if(endpoint->rd_credits[BTL_OPENIB_HP_QP] > 0) {
|
||||||
frag->hdr->credits = endpoint->rd_credits_hp;
|
frag->hdr->credits = endpoint->rd_credits[BTL_OPENIB_HP_QP];
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, -frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_HP_QP],
|
||||||
|
-frag->hdr->credits);
|
||||||
} else {
|
} else {
|
||||||
frag->hdr->credits = 0;
|
frag->hdr->credits = 0;
|
||||||
}
|
}
|
||||||
ib_qp = endpoint->lcl_qp_hp;
|
ib_qp = endpoint->lcl_qp[BTL_OPENIB_HP_QP];
|
||||||
} else {
|
} else {
|
||||||
if(btl_openib_acquire_send_resources(openib_btl, endpoint, frag,
|
if(btl_openib_acquire_send_resources(openib_btl, endpoint, frag,
|
||||||
BTL_OPENIB_LP_QP, NULL) == OMPI_ERR_OUT_OF_RESOURCE)
|
BTL_OPENIB_LP_QP, NULL) == OMPI_ERR_OUT_OF_RESOURCE)
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
|
|
||||||
if(endpoint->rd_credits_lp > 0) {
|
if(endpoint->rd_credits[BTL_OPENIB_LP_QP] > 0) {
|
||||||
frag->hdr->credits = endpoint->rd_credits_lp;
|
frag->hdr->credits = endpoint->rd_credits[BTL_OPENIB_LP_QP];
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_lp, -frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_LP_QP],
|
||||||
|
-frag->hdr->credits);
|
||||||
} else {
|
} else {
|
||||||
frag->hdr->credits = 0;
|
frag->hdr->credits = 0;
|
||||||
}
|
}
|
||||||
ib_qp = endpoint->lcl_qp_lp;
|
ib_qp = endpoint->lcl_qp[BTL_OPENIB_LP_QP];
|
||||||
}
|
}
|
||||||
|
|
||||||
frag->sg_entry.length =
|
frag->sg_entry.length =
|
||||||
@ -202,11 +203,11 @@ static inline int mca_btl_openib_endpoint_post_send(mca_btl_openib_module_t* ope
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
||||||
} else {
|
} else {
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
@ -240,8 +241,8 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
|
|||||||
memset(endpoint->lcl_qp_attr_hp, 0, sizeof(struct ibv_qp_attr));
|
memset(endpoint->lcl_qp_attr_hp, 0, sizeof(struct ibv_qp_attr));
|
||||||
memset(endpoint->lcl_qp_attr_lp, 0, sizeof(struct ibv_qp_attr));
|
memset(endpoint->lcl_qp_attr_lp, 0, sizeof(struct ibv_qp_attr));
|
||||||
|
|
||||||
endpoint->rd_posted_hp = 0;
|
endpoint->rd_posted[BTL_OPENIB_HP_QP] = 0;
|
||||||
endpoint->rd_posted_lp = 0;
|
endpoint->rd_posted[BTL_OPENIB_LP_QP] = 0;
|
||||||
|
|
||||||
/* number of available send wqes */
|
/* number of available send wqes */
|
||||||
endpoint->sd_wqe[BTL_OPENIB_HP_QP] = mca_btl_openib_component.rd_num;
|
endpoint->sd_wqe[BTL_OPENIB_HP_QP] = mca_btl_openib_component.rd_num;
|
||||||
@ -250,10 +251,10 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
|
|||||||
/* zero these out w/ initial posting, so that we start out w/
|
/* zero these out w/ initial posting, so that we start out w/
|
||||||
* zero credits to return to peer
|
* zero credits to return to peer
|
||||||
*/
|
*/
|
||||||
endpoint->rd_credits_hp = -(mca_btl_openib_component.rd_num + mca_btl_openib_component.rd_rsv);
|
endpoint->rd_credits[BTL_OPENIB_HP_QP] = -(mca_btl_openib_component.rd_num + mca_btl_openib_component.rd_rsv);
|
||||||
endpoint->rd_credits_lp = -(mca_btl_openib_component.rd_num + mca_btl_openib_component.rd_rsv);
|
endpoint->rd_credits[BTL_OPENIB_LP_QP] = -(mca_btl_openib_component.rd_num + mca_btl_openib_component.rd_rsv);
|
||||||
endpoint->sd_credits_hp = 0;
|
endpoint->sd_credits[BTL_OPENIB_HP_QP] = 0;
|
||||||
endpoint->sd_credits_lp = 0;
|
endpoint->sd_credits[BTL_OPENIB_LP_QP] = 0;
|
||||||
|
|
||||||
/* initialize the high and low priority tokens */
|
/* initialize the high and low priority tokens */
|
||||||
endpoint->sd_tokens[BTL_OPENIB_HP_QP] = mca_btl_openib_component.rd_num;
|
endpoint->sd_tokens[BTL_OPENIB_HP_QP] = mca_btl_openib_component.rd_num;
|
||||||
@ -313,13 +314,13 @@ static int mca_btl_openib_endpoint_send_connect_data(mca_btl_base_endpoint_t* en
|
|||||||
|
|
||||||
/* pack the info in the send buffer */
|
/* pack the info in the send buffer */
|
||||||
|
|
||||||
rc = orte_dss.pack(buffer, &endpoint->lcl_qp_hp->qp_num, 1, ORTE_UINT32);
|
rc = orte_dss.pack(buffer, &endpoint->lcl_qp[BTL_OPENIB_HP_QP]->qp_num, 1, ORTE_UINT32);
|
||||||
if(rc != ORTE_SUCCESS) {
|
if(rc != ORTE_SUCCESS) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = orte_dss.pack(buffer, &endpoint->lcl_qp_lp->qp_num, 1, ORTE_UINT32);
|
rc = orte_dss.pack(buffer, &endpoint->lcl_qp[BTL_OPENIB_LP_QP]->qp_num, 1, ORTE_UINT32);
|
||||||
if(rc != ORTE_SUCCESS) {
|
if(rc != ORTE_SUCCESS) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
return rc;
|
return rc;
|
||||||
@ -367,8 +368,8 @@ static int mca_btl_openib_endpoint_send_connect_data(mca_btl_base_endpoint_t* en
|
|||||||
|
|
||||||
|
|
||||||
BTL_VERBOSE(("Sending High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
BTL_VERBOSE(("Sending High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
||||||
endpoint->lcl_qp_hp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_HP_QP]->qp_num,
|
||||||
endpoint->lcl_qp_lp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_LP_QP]->qp_num,
|
||||||
endpoint->endpoint_btl->lid));
|
endpoint->endpoint_btl->lid));
|
||||||
|
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
@ -418,9 +419,9 @@ static int mca_btl_openib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoi
|
|||||||
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
||||||
openib_btl->hca->ib_pd,
|
openib_btl->hca->ib_pd,
|
||||||
openib_btl->ib_cq_hp,
|
openib_btl->ib_cq_hp,
|
||||||
openib_btl->srq_hp,
|
openib_btl->srq[BTL_OPENIB_HP_QP],
|
||||||
endpoint->lcl_qp_attr_hp,
|
endpoint->lcl_qp_attr_hp,
|
||||||
&endpoint->lcl_qp_hp))) {
|
&endpoint->lcl_qp[BTL_OPENIB_HP_QP]))) {
|
||||||
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -431,17 +432,17 @@ static int mca_btl_openib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoi
|
|||||||
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
||||||
openib_btl->hca->ib_pd,
|
openib_btl->hca->ib_pd,
|
||||||
openib_btl->ib_cq_lp,
|
openib_btl->ib_cq_lp,
|
||||||
openib_btl->srq_lp,
|
openib_btl->srq[BTL_OPENIB_LP_QP],
|
||||||
endpoint->lcl_qp_attr_lp,
|
endpoint->lcl_qp_attr_lp,
|
||||||
&endpoint->lcl_qp_lp))) {
|
&endpoint->lcl_qp[BTL_OPENIB_LP_QP]))) {
|
||||||
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
endpoint->lcl_psn_lp = lrand48() & 0xffffff;
|
endpoint->lcl_psn_lp = lrand48() & 0xffffff;
|
||||||
|
|
||||||
BTL_VERBOSE(("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
BTL_VERBOSE(("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
||||||
endpoint->lcl_qp_hp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_HP_QP]->qp_num,
|
||||||
endpoint->lcl_qp_lp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_LP_QP]->qp_num,
|
||||||
openib_btl->lid));
|
openib_btl->lid));
|
||||||
|
|
||||||
/* Send connection info over to remote endpoint */
|
/* Send connection info over to remote endpoint */
|
||||||
@ -468,10 +469,10 @@ static int mca_btl_openib_endpoint_reply_start_connect(mca_btl_openib_endpoint_t
|
|||||||
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
||||||
openib_btl->hca->ib_pd,
|
openib_btl->hca->ib_pd,
|
||||||
openib_btl->ib_cq_hp,
|
openib_btl->ib_cq_hp,
|
||||||
openib_btl->srq_hp,
|
openib_btl->srq[BTL_OPENIB_HP_QP],
|
||||||
|
|
||||||
endpoint->lcl_qp_attr_hp,
|
endpoint->lcl_qp_attr_hp,
|
||||||
&endpoint->lcl_qp_hp))) {
|
&endpoint->lcl_qp[BTL_OPENIB_HP_QP]))) {
|
||||||
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -482,18 +483,18 @@ static int mca_btl_openib_endpoint_reply_start_connect(mca_btl_openib_endpoint_t
|
|||||||
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
||||||
openib_btl->hca->ib_pd,
|
openib_btl->hca->ib_pd,
|
||||||
openib_btl->ib_cq_lp,
|
openib_btl->ib_cq_lp,
|
||||||
openib_btl->srq_lp,
|
openib_btl->srq[BTL_OPENIB_LP_QP],
|
||||||
|
|
||||||
endpoint->lcl_qp_attr_lp,
|
endpoint->lcl_qp_attr_lp,
|
||||||
&endpoint->lcl_qp_lp))) {
|
&endpoint->lcl_qp[BTL_OPENIB_LP_QP]))) {
|
||||||
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
BTL_ERROR(("error creating queue pair, error code %d", rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
endpoint->lcl_psn_lp = lrand48() & 0xffffff;
|
endpoint->lcl_psn_lp = lrand48() & 0xffffff;
|
||||||
|
|
||||||
BTL_VERBOSE(("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
BTL_VERBOSE(("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
||||||
endpoint->lcl_qp_hp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_HP_QP]->qp_num,
|
||||||
endpoint->lcl_qp_lp->qp_num,
|
endpoint->lcl_qp[BTL_OPENIB_LP_QP]->qp_num,
|
||||||
openib_btl->lid));
|
openib_btl->lid));
|
||||||
|
|
||||||
|
|
||||||
@ -871,7 +872,7 @@ int mca_btl_openib_endpoint_connect(
|
|||||||
/* Connection establishment RC */
|
/* Connection establishment RC */
|
||||||
rc = mca_btl_openib_endpoint_qp_init_query(
|
rc = mca_btl_openib_endpoint_qp_init_query(
|
||||||
openib_btl,
|
openib_btl,
|
||||||
endpoint->lcl_qp_hp,
|
endpoint->lcl_qp[BTL_OPENIB_HP_QP],
|
||||||
endpoint->lcl_qp_attr_hp,
|
endpoint->lcl_qp_attr_hp,
|
||||||
endpoint->lcl_psn_hp,
|
endpoint->lcl_psn_hp,
|
||||||
endpoint->rem_info.rem_qp_num_hp,
|
endpoint->rem_info.rem_qp_num_hp,
|
||||||
@ -888,7 +889,7 @@ int mca_btl_openib_endpoint_connect(
|
|||||||
}
|
}
|
||||||
rc = mca_btl_openib_endpoint_qp_init_query(
|
rc = mca_btl_openib_endpoint_qp_init_query(
|
||||||
openib_btl,
|
openib_btl,
|
||||||
endpoint->lcl_qp_lp,
|
endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
||||||
endpoint->lcl_qp_attr_lp,
|
endpoint->lcl_qp_attr_lp,
|
||||||
endpoint->lcl_psn_lp,
|
endpoint->lcl_psn_lp,
|
||||||
endpoint->rem_info.rem_qp_num_lp,
|
endpoint->rem_info.rem_qp_num_lp,
|
||||||
@ -908,11 +909,11 @@ int mca_btl_openib_endpoint_connect(
|
|||||||
MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(openib_btl, endpoint->lp_credit_frag, rc);
|
MCA_BTL_IB_FRAG_ALLOC_CREDIT_WAIT(openib_btl, endpoint->lp_credit_frag, rc);
|
||||||
|
|
||||||
if(mca_btl_openib_component.use_srq) {
|
if(mca_btl_openib_component.use_srq) {
|
||||||
MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, 1);
|
mca_btl_openib_post_srr(openib_btl, 1, BTL_OPENIB_LP_QP);
|
||||||
} else {
|
} else {
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_HP_QP);
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 1);
|
btl_openib_endpoint_post_rr(endpoint, 1, BTL_OPENIB_LP_QP);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
@ -1066,10 +1067,11 @@ static void mca_btl_openib_endpoint_credits_lp(
|
|||||||
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],-1);
|
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_LP_QP],-1);
|
||||||
|
|
||||||
/* check to see if there are addditional credits to return */
|
/* check to see if there are addditional credits to return */
|
||||||
if ((credits = OPAL_THREAD_ADD32(&endpoint->sd_credits_lp,-1)) > 0) {
|
if ((credits = OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP],-1)) > 0) {
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_lp,-credits);
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP],-credits);
|
||||||
if (endpoint->rd_credits_lp >= mca_btl_openib_component.rd_win &&
|
if (endpoint->rd_credits[BTL_OPENIB_LP_QP] >=
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_lp,1) == 1) {
|
mca_btl_openib_component.rd_win &&
|
||||||
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP],1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
mca_btl_openib_endpoint_send_credits_lp(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1095,9 +1097,10 @@ void mca_btl_openib_endpoint_send_credits_lp(
|
|||||||
frag->endpoint = endpoint;
|
frag->endpoint = endpoint;
|
||||||
|
|
||||||
frag->hdr->tag = MCA_BTL_TAG_BTL;
|
frag->hdr->tag = MCA_BTL_TAG_BTL;
|
||||||
if(endpoint->rd_credits_lp > 0) {
|
if(endpoint->rd_credits[BTL_OPENIB_LP_QP] > 0) {
|
||||||
frag->hdr->credits = endpoint->rd_credits_lp;
|
frag->hdr->credits = endpoint->rd_credits[BTL_OPENIB_LP_QP];
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_lp, -frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_LP_QP],
|
||||||
|
-frag->hdr->credits);
|
||||||
} else {
|
} else {
|
||||||
frag->hdr->credits = 0;
|
frag->hdr->credits = 0;
|
||||||
}
|
}
|
||||||
@ -1120,11 +1123,12 @@ void mca_btl_openib_endpoint_send_credits_lp(
|
|||||||
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ibv_post_send(endpoint->lcl_qp_lp,
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_LP_QP],
|
||||||
&frag->wr_desc.sr_desc,
|
&frag->wr_desc.sr_desc,
|
||||||
&bad_wr)) {
|
&bad_wr)) {
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_lp, -1);
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_LP_QP], -1);
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_lp, frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_LP_QP],
|
||||||
|
frag->hdr->credits);
|
||||||
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
||||||
BTL_ERROR(("error posting send request errno %d says %s", strerror(errno)));
|
BTL_ERROR(("error posting send request errno %d says %s", strerror(errno)));
|
||||||
return;
|
return;
|
||||||
@ -1148,11 +1152,11 @@ static void mca_btl_openib_endpoint_credits_hp(
|
|||||||
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_HP_QP],-1);
|
OPAL_THREAD_ADD32(&endpoint->sd_wqe[BTL_OPENIB_HP_QP],-1);
|
||||||
|
|
||||||
/* check to see if there are addditional credits to return */
|
/* check to see if there are addditional credits to return */
|
||||||
if ((credits = OPAL_THREAD_ADD32(&endpoint->sd_credits_hp,-1)) > 0) {
|
if ((credits = OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP],-1)) > 0) {
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_hp,-credits);
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP],-credits);
|
||||||
if ((endpoint->rd_credits_hp >= mca_btl_openib_component.rd_win ||
|
if ((endpoint->rd_credits[BTL_OPENIB_HP_QP] >= mca_btl_openib_component.rd_win ||
|
||||||
endpoint->eager_rdma_local.credits >= mca_btl_openib_component.rd_win) &&
|
endpoint->eager_rdma_local.credits >= mca_btl_openib_component.rd_win) &&
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_hp,1) == 1) {
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP],1) == 1) {
|
||||||
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
mca_btl_openib_endpoint_send_credits_hp(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1178,9 +1182,10 @@ void mca_btl_openib_endpoint_send_credits_hp(
|
|||||||
frag->endpoint = endpoint;
|
frag->endpoint = endpoint;
|
||||||
|
|
||||||
frag->hdr->tag = MCA_BTL_TAG_BTL;
|
frag->hdr->tag = MCA_BTL_TAG_BTL;
|
||||||
if(endpoint->rd_credits_hp > 0) {
|
if(endpoint->rd_credits[BTL_OPENIB_HP_QP] > 0) {
|
||||||
frag->hdr->credits = endpoint->rd_credits_hp;
|
frag->hdr->credits = endpoint->rd_credits[BTL_OPENIB_HP_QP];
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, -frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_HP_QP],
|
||||||
|
-frag->hdr->credits);
|
||||||
} else
|
} else
|
||||||
frag->hdr->credits = 0;
|
frag->hdr->credits = 0;
|
||||||
if(endpoint->eager_rdma_local.credits > 0) {
|
if(endpoint->eager_rdma_local.credits > 0) {
|
||||||
@ -1208,11 +1213,12 @@ void mca_btl_openib_endpoint_send_credits_hp(
|
|||||||
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
frag->wr_desc.sr_desc.send_flags = IBV_SEND_SIGNALED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ibv_post_send(endpoint->lcl_qp_hp,
|
if(ibv_post_send(endpoint->lcl_qp[BTL_OPENIB_HP_QP],
|
||||||
&frag->wr_desc.sr_desc,
|
&frag->wr_desc.sr_desc,
|
||||||
&bad_wr)) {
|
&bad_wr)) {
|
||||||
OPAL_THREAD_ADD32(&endpoint->sd_credits_hp, -1);
|
OPAL_THREAD_ADD32(&endpoint->sd_credits[BTL_OPENIB_HP_QP], -1);
|
||||||
OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, frag->hdr->credits);
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[BTL_OPENIB_HP_QP],
|
||||||
|
frag->hdr->credits);
|
||||||
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
MCA_BTL_IB_FRAG_RETURN(openib_btl, frag);
|
||||||
BTL_ERROR(("error posting send request errno %d says %s", errno,
|
BTL_ERROR(("error posting send request errno %d says %s", errno,
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
|
@ -37,13 +37,6 @@ extern "C" {
|
|||||||
|
|
||||||
struct mca_btl_openib_frag_t;
|
struct mca_btl_openib_frag_t;
|
||||||
|
|
||||||
struct mca_btl_openib_port_info_t {
|
|
||||||
uint32_t mtu;
|
|
||||||
uint16_t subnet;
|
|
||||||
};
|
|
||||||
typedef struct mca_btl_openib_port_info_t mca_btl_openib_port_info_t;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of IB endpoint connection.
|
* State of IB endpoint connection.
|
||||||
*/
|
*/
|
||||||
@ -138,9 +131,7 @@ struct mca_btl_base_endpoint_t {
|
|||||||
uint32_t lcl_psn_lp;
|
uint32_t lcl_psn_lp;
|
||||||
/* Local processes port sequence number (Low and High) */
|
/* Local processes port sequence number (Low and High) */
|
||||||
|
|
||||||
struct ibv_qp* lcl_qp_hp;
|
struct ibv_qp* lcl_qp[2]; /* Local QP (Low and High) */
|
||||||
struct ibv_qp* lcl_qp_lp;
|
|
||||||
/* Local QP (Low and High) */
|
|
||||||
|
|
||||||
struct ibv_qp_attr* lcl_qp_attr_hp;
|
struct ibv_qp_attr* lcl_qp_attr_hp;
|
||||||
struct ibv_qp_attr* lcl_qp_attr_lp;
|
struct ibv_qp_attr* lcl_qp_attr_lp;
|
||||||
@ -149,12 +140,9 @@ struct mca_btl_base_endpoint_t {
|
|||||||
int32_t sd_tokens[2]; /**< number of send tokens */
|
int32_t sd_tokens[2]; /**< number of send tokens */
|
||||||
int32_t get_tokens; /**< number of available get tokens */
|
int32_t get_tokens; /**< number of available get tokens */
|
||||||
|
|
||||||
int32_t rd_posted_hp; /**< number of high priority descriptors posted to the nic*/
|
int32_t rd_posted[2]; /**< number of descriptors posted to the nic*/
|
||||||
int32_t rd_posted_lp; /**< number of low priority descriptors posted to the nic*/
|
int32_t rd_credits[2]; /**< number of credits to return to peer */
|
||||||
int32_t rd_credits_hp; /**< number of high priority credits to return to peer */
|
int32_t sd_credits[2]; /**< number of send wqe entries being used to return credits */
|
||||||
int32_t rd_credits_lp; /**< number of low priority credits to return to peer */
|
|
||||||
int32_t sd_credits_hp; /**< number of send wqe entries being used to return credits */
|
|
||||||
int32_t sd_credits_lp; /**< number of send wqe entries being used to return credits */
|
|
||||||
int32_t sd_wqe[2]; /**< number of available send wqe entries */
|
int32_t sd_wqe[2]; /**< number of available send wqe entries */
|
||||||
|
|
||||||
uint16_t subnet; /**< subnet of this endpoint*/
|
uint16_t subnet; /**< subnet of this endpoint*/
|
||||||
@ -182,75 +170,46 @@ void mca_btl_openib_endpoint_send_credits_hp(mca_btl_base_endpoint_t*);
|
|||||||
void mca_btl_openib_endpoint_send_credits_lp(mca_btl_base_endpoint_t*);
|
void mca_btl_openib_endpoint_send_credits_lp(mca_btl_base_endpoint_t*);
|
||||||
void mca_btl_openib_endpoint_connect_eager_rdma(mca_btl_openib_endpoint_t*);
|
void mca_btl_openib_endpoint_connect_eager_rdma(mca_btl_openib_endpoint_t*);
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, \
|
static inline int btl_openib_endpoint_post_rr(mca_btl_base_endpoint_t *endpoint,
|
||||||
additional) \
|
const int additional, const int prio)
|
||||||
{ \
|
{
|
||||||
do { \
|
mca_btl_openib_module_t *openib_btl = endpoint->endpoint_btl;
|
||||||
mca_btl_openib_module_t * openib_btl = endpoint->endpoint_btl; \
|
|
||||||
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
|
||||||
if(endpoint->rd_posted_hp <= mca_btl_openib_component.rd_low+additional && \
|
|
||||||
endpoint->rd_posted_hp < openib_btl->rd_num) { \
|
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_SUB(openib_btl->rd_num - \
|
|
||||||
endpoint->rd_posted_hp, \
|
|
||||||
endpoint, \
|
|
||||||
&openib_btl->recv_free_eager, \
|
|
||||||
endpoint->rd_posted_hp, \
|
|
||||||
endpoint->rd_credits_hp, \
|
|
||||||
endpoint->lcl_qp_hp); \
|
|
||||||
} \
|
|
||||||
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
|
||||||
} while(0); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, \
|
OPAL_THREAD_LOCK(&openib_btl->ib_lock);
|
||||||
additional) { \
|
if(endpoint->rd_posted[prio] <=
|
||||||
do { \
|
mca_btl_openib_component.rd_low + additional &&
|
||||||
mca_btl_openib_module_t * openib_btl = endpoint->endpoint_btl; \
|
endpoint->rd_posted[prio] < openib_btl->rd_num) {
|
||||||
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
int rc;
|
||||||
if(endpoint->rd_posted_lp <= mca_btl_openib_component.rd_low+additional && \
|
int32_t i, num_post = openib_btl->rd_num - endpoint->rd_posted[prio];
|
||||||
endpoint->rd_posted_lp < openib_btl->rd_num){ \
|
struct ibv_recv_wr* bad_wr;
|
||||||
MCA_BTL_OPENIB_ENDPOINT_POST_RR_SUB(openib_btl->rd_num - \
|
ompi_free_list_t *free_list;
|
||||||
endpoint->rd_posted_lp, \
|
|
||||||
endpoint, \
|
|
||||||
&openib_btl->recv_free_max, \
|
|
||||||
endpoint->rd_posted_lp, \
|
|
||||||
endpoint->rd_credits_lp, \
|
|
||||||
endpoint->lcl_qp_lp \
|
|
||||||
); } \
|
|
||||||
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
|
||||||
} while(0); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_ENDPOINT_POST_RR_SUB(cnt, \
|
if(BTL_OPENIB_HP_QP == prio)
|
||||||
my_endpoint, \
|
free_list = &openib_btl->recv_free_eager;
|
||||||
frag_list, \
|
else
|
||||||
rd_posted, \
|
free_list = &openib_btl->recv_free_max;
|
||||||
rd_credits, \
|
|
||||||
qp ) \
|
for(i = 0; i < num_post; i++) {
|
||||||
do { \
|
ompi_free_list_item_t* item;
|
||||||
int32_t i; \
|
mca_btl_openib_frag_t* frag;
|
||||||
int rc; \
|
OMPI_FREE_LIST_WAIT(free_list, item, rc);
|
||||||
int32_t num_post = cnt; \
|
frag = (mca_btl_openib_frag_t*)item;
|
||||||
struct ibv_recv_wr* bad_wr; \
|
frag->endpoint = endpoint;
|
||||||
for(i = 0; i < num_post; i++) { \
|
frag->sg_entry.length = frag->size +
|
||||||
ompi_free_list_item_t* item; \
|
((unsigned char*)frag->segment.seg_addr.pval -
|
||||||
mca_btl_openib_frag_t* frag; \
|
(unsigned char*)frag->hdr);
|
||||||
OMPI_FREE_LIST_WAIT(frag_list, item, rc); \
|
if(ibv_post_recv(endpoint->lcl_qp[prio], &frag->wr_desc.rd_desc,
|
||||||
frag = (mca_btl_openib_frag_t*) item; \
|
&bad_wr)) {
|
||||||
frag->endpoint = my_endpoint; \
|
BTL_ERROR(("error posting receive errno says %s\n",
|
||||||
frag->sg_entry.length = frag->size + \
|
strerror(errno)));
|
||||||
((unsigned char*) frag->segment.seg_addr.pval- \
|
return OMPI_ERROR;
|
||||||
(unsigned char*) frag->hdr); \
|
}
|
||||||
if(ibv_post_recv(qp, \
|
}
|
||||||
&frag->wr_desc.rd_desc, \
|
OPAL_THREAD_ADD32(&endpoint->rd_posted[prio], num_post);
|
||||||
&bad_wr)) { \
|
OPAL_THREAD_ADD32(&endpoint->rd_credits[prio], num_post);
|
||||||
BTL_ERROR(("error posting receive errno says %s\n", strerror(errno))); \
|
}
|
||||||
return OMPI_ERROR; \
|
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock);
|
||||||
}\
|
}
|
||||||
}\
|
|
||||||
OPAL_THREAD_ADD32(&(rd_posted), num_post); \
|
|
||||||
OPAL_THREAD_ADD32(&(rd_credits), num_post); \
|
|
||||||
} while(0);
|
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "btl_openib_frag.h"
|
#include "btl_openib_frag.h"
|
||||||
|
#include "btl_openib_eager_rdma.h"
|
||||||
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#define MCA_BTL_IB_FRAG_H
|
#define MCA_BTL_IB_FRAG_H
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include "btl_openib.h"
|
|
||||||
|
|
||||||
#include <infiniband/verbs.h>
|
#include <infiniband/verbs.h>
|
||||||
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
||||||
|
#include "ompi/mca/btl/btl.h"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user