1
1

performance optimization: process completions in the batch manner

This commit was SVN r27559.
Этот коммит содержится в:
Mike Dubman 2012-11-05 14:02:37 +00:00
родитель ca308974e0
Коммит d47d550dfc
3 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -57,6 +57,7 @@ BEGIN_C_DECLS
#define MCA_BTL_IB_LEAVE_PINNED 1 #define MCA_BTL_IB_LEAVE_PINNED 1
#define IB_DEFAULT_GID_PREFIX 0xfe80000000000000ll #define IB_DEFAULT_GID_PREFIX 0xfe80000000000000ll
#define MCA_BTL_IB_PKEY_MASK 0x7fff #define MCA_BTL_IB_PKEY_MASK 0x7fff
#define MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT (256)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
@ -278,6 +279,7 @@ struct mca_btl_openib_component_t {
bool use_message_coalescing; bool use_message_coalescing;
uint32_t cq_poll_ratio; uint32_t cq_poll_ratio;
uint32_t cq_poll_progress; uint32_t cq_poll_progress;
uint32_t cq_poll_batch;
uint32_t eager_rdma_poll_ratio; uint32_t eager_rdma_poll_ratio;
#ifdef HAVE_IBV_FORK_INIT #ifdef HAVE_IBV_FORK_INIT
/** Whether we want fork support or not */ /** Whether we want fork support or not */

Просмотреть файл

@ -3461,12 +3461,13 @@ static int poll_device(mca_btl_openib_device_t* device, int count)
{ {
int ne = 0, cq; int ne = 0, cq;
uint32_t hp_iter = 0; uint32_t hp_iter = 0;
struct ibv_wc wc; struct ibv_wc wc[MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT];
int i;
device->pollme = false; device->pollme = false;
for(cq = 0; cq < 2 && hp_iter < mca_btl_openib_component.cq_poll_progress;) for(cq = 0; cq < 2 && hp_iter < mca_btl_openib_component.cq_poll_progress;)
{ {
ne = ibv_poll_cq(device->ib_cq[cq], 1, &wc); ne = ibv_poll_cq(device->ib_cq[cq], mca_btl_openib_component.cq_poll_batch, wc);
if(0 == ne) { if(0 == ne) {
/* don't check low prio cq if there was something in high prio cq, /* don't check low prio cq if there was something in high prio cq,
* but for each cq_poll_ratio hp cq polls poll lp cq once */ * but for each cq_poll_ratio hp cq polls poll lp cq once */
@ -3488,7 +3489,8 @@ static int poll_device(mca_btl_openib_device_t* device, int count)
device->hp_cq_polls--; device->hp_cq_polls--;
} }
handle_wc(device, cq, &wc); for (i = 0; i < ne; i++)
handle_wc(device, cq, &wc[i]);
} }
return count; return count;

Просмотреть файл

@ -174,6 +174,12 @@ int btl_openib_register_mca_params(void)
0, &ival, 0)); 0, &ival, 0));
mca_btl_openib_component.abort_not_enough_reg_mem = (0 != ival); mca_btl_openib_component.abort_not_enough_reg_mem = (0 != ival);
CHECK(reg_int("poll_cq_batch", NULL,
"Retrieve up to poll_cq_batch completions from CQ",
MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT, &ival, REGINT_GE_ONE));
mca_btl_openib_component.cq_poll_batch = (ival > MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT)? MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT : ival;
if (OMPI_HAVE_IBV_FORK_INIT) { if (OMPI_HAVE_IBV_FORK_INIT) {
ival2 = -1; ival2 = -1;
} else { } else {