1
1

Merge pull request #1715 from hjelmn/ugni_overhead

btl/ugni: reduce overhead of progress function
Этот коммит содержится в:
Nathan Hjelm 2016-05-26 10:17:00 -06:00
родитель 46710ba151 99627319f0
Коммит 87ea9be863
5 изменённых файлов: 27 добавлений и 5 удалений

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

@ -129,6 +129,8 @@ typedef struct mca_btl_ugni_module_t {
int nlocal_procs;
volatile int active_send_count;
volatile int64_t connected_peer_count;
volatile int64_t active_rdma_count;
mca_rcache_base_module_t *rcache;
} mca_btl_ugni_module_t;

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

@ -613,6 +613,10 @@ mca_btl_ugni_progress_wait_list (mca_btl_ugni_module_t *ugni_module)
mca_btl_base_endpoint_t *endpoint = NULL;
int count;
if (0 == opal_list_get_size(&ugni_module->ep_wait_list)) {
return 0;
}
OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock);
count = opal_list_get_size(&ugni_module->ep_wait_list);
@ -636,18 +640,28 @@ mca_btl_ugni_progress_wait_list (mca_btl_ugni_module_t *ugni_module)
static int mca_btl_ugni_component_progress (void)
{
mca_btl_ugni_module_t *ugni_module;
static int64_t call_count = 0;
int64_t cur_call_count = OPAL_THREAD_ADD64(&call_count, 1);
unsigned int i;
int count = 0;
for (i = 0 ; i < mca_btl_ugni_component.ugni_num_btls ; ++i) {
ugni_module = mca_btl_ugni_component.modules + i;
mca_btl_ugni_progress_wait_list (ugni_module);
if ((cur_call_count & 0x7) == 0) {
count += mca_btl_ugni_progress_datagram (ugni_module);
}
if (ugni_module->connected_peer_count) {
mca_btl_ugni_progress_wait_list (ugni_module);
count += mca_btl_ugni_progress_local_smsg (ugni_module);
count += mca_btl_ugni_progress_remote_smsg (ugni_module);
}
if (ugni_module->active_rdma_count) {
count += mca_btl_ugni_progress_rdma (ugni_module, 0);
}
if (mca_btl_ugni_component.progress_thread_enabled) {
count += mca_btl_ugni_progress_rdma (ugni_module, 1);
}

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

@ -81,6 +81,7 @@ int mca_btl_ugni_ep_disconnect (mca_btl_base_endpoint_t *ep, bool send_disconnec
}
ep->state = MCA_BTL_UGNI_EP_STATE_INIT;
(void) opal_atomic_add_64 (&ep->btl->connected_peer_count, -11);
return OPAL_SUCCESS;
}
@ -152,6 +153,7 @@ static inline int mca_btl_ugni_ep_connect_finish (mca_btl_base_endpoint_t *ep) {
ep->rmt_irq_mem_hndl = ep->remote_attr.rmt_irq_mem_hndl;
ep->state = MCA_BTL_UGNI_EP_STATE_CONNECTED;
(void) opal_atomic_add_64 (&ep->btl->connected_peer_count, 1);
/* send all pending messages */
BTL_VERBOSE(("endpoint connected. posting %u sends", (unsigned int) opal_list_get_size (&ep->frag_wait_list)));

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

@ -112,12 +112,14 @@ static inline void mca_btl_ugni_alloc_post_descriptor (mca_btl_base_endpoint_t *
(*desc)->cbdata = cbdata;
(*desc)->local_handle = local_handle;
(*desc)->endpoint = endpoint;
(void) OPAL_THREAD_ADD64(&endpoint->btl->active_rdma_count, 1);
}
}
static inline void mca_btl_ugni_return_post_descriptor (mca_btl_ugni_module_t *module,
mca_btl_ugni_post_descriptor_t *desc)
{
(void) OPAL_THREAD_ADD64(&module->active_rdma_count, -1);
opal_free_list_return (&module->post_descriptors, &desc->super);
}

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

@ -76,6 +76,8 @@ mca_btl_ugni_module_init (mca_btl_ugni_module_t *ugni_module,
ugni_module->initialized = false;
ugni_module->nlocal_procs = 0;
ugni_module->active_send_count = 0;
ugni_module->connected_peer_count = 0;
ugni_module->active_rdma_count = 0;
OBJ_CONSTRUCT(&ugni_module->failed_frags, opal_list_t);
OBJ_CONSTRUCT(&ugni_module->failed_frags_lock, opal_mutex_t);