1.1 --- a/ompi/mca/btl/openib/btl_openib.h Tue Nov 06 05:20:31 2012 +0000
1.2 +++ b/ompi/mca/btl/openib/btl_openib.h Tue Nov 06 05:22:07 2012 +0000
1.3 @@ -57,6 +57,7 @@
1.4 #define MCA_BTL_IB_LEAVE_PINNED 1
1.5 #define IB_DEFAULT_GID_PREFIX 0xfe80000000000000ll
1.6 #define MCA_BTL_IB_PKEY_MASK 0x7fff
1.7 +#define MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT (256)
1.8
1.9
1.10 /*--------------------------------------------------------------------*/
1.11 @@ -274,6 +275,7 @@
1.12 bool use_message_coalescing;
1.13 uint32_t cq_poll_ratio;
1.14 uint32_t cq_poll_progress;
1.15 + uint32_t cq_poll_batch;
1.16 uint32_t eager_rdma_poll_ratio;
1.17 #ifdef HAVE_IBV_FORK_INIT
1.18 /** Whether we want fork support or not */
2.1 --- a/ompi/mca/btl/openib/btl_openib_component.c Tue Nov 06 05:20:31 2012 +0000
2.2 +++ b/ompi/mca/btl/openib/btl_openib_component.c Tue Nov 06 05:22:07 2012 +0000
2.3 @@ -3576,12 +3576,13 @@
2.4 {
2.5 int ne = 0, cq;
2.6 uint32_t hp_iter = 0;
2.7 - struct ibv_wc wc;
2.8 + struct ibv_wc wc[MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT];
2.9 + int i;
2.10
2.11 device->pollme = false;
2.12 for(cq = 0; cq < 2 && hp_iter < mca_btl_openib_component.cq_poll_progress;)
2.13 {
2.14 - ne = ibv_poll_cq(device->ib_cq[cq], 1, &wc);
2.15 + ne = ibv_poll_cq(device->ib_cq[cq], mca_btl_openib_component.cq_poll_batch, wc);
2.16 if(0 == ne) {
2.17 /* don't check low prio cq if there was something in high prio cq,
2.18 * but for each cq_poll_ratio hp cq polls poll lp cq once */
2.19 @@ -3603,7 +3604,8 @@
2.20 device->hp_cq_polls--;
2.21 }
2.22
2.23 - handle_wc(device, cq, &wc);
2.24 + for (i = 0; i < ne; i++)
2.25 + handle_wc(device, cq, &wc[i]);
2.26 }
2.27
2.28 return count;
3.1 --- a/ompi/mca/btl/openib/btl_openib_mca.c Tue Nov 06 05:20:31 2012 +0000
3.2 +++ b/ompi/mca/btl/openib/btl_openib_mca.c Tue Nov 06 05:22:07 2012 +0000
3.3 @@ -166,6 +166,12 @@
3.4 1, &ival, 0));
3.5 mca_btl_openib_component.warn_nonexistent_if = (0 != ival);
3.6
3.7 + CHECK(reg_int("poll_cq_batch", NULL,
3.8 + "Retrieve up to poll_cq_batch completions from CQ",
3.9 + MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT, &ival, REGINT_GE_ONE));
3.10 +
3.11 + mca_btl_openib_component.cq_poll_batch = (ival > MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT)? MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT : ival;
3.12 +
3.13 if (OMPI_HAVE_IBV_FORK_INIT) {
3.14 ival2 = -1;
3.15 } else {