1
1

Fix a race condition when multiple threads try to create a bml endpoint simultaneously.

Этот коммит содержится в:
Aurélien Bouteiller 2016-05-05 10:49:30 -04:00
родитель 627a89bf71
Коммит 4899c89731

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

@ -160,7 +160,6 @@ static mca_bml_base_endpoint_t *mca_bml_r2_allocate_endpoint (ompi_proc_t *proc)
mca_bml_base_btl_array_reserve(&bml_endpoint->btl_rdma, mca_bml_r2.num_btl_modules);
bml_endpoint->btl_max_send_size = -1;
bml_endpoint->btl_proc = proc;
proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML] = bml_endpoint;
bml_endpoint->btl_flags_or = 0;
return bml_endpoint;
@ -430,6 +429,12 @@ static int mca_bml_r2_add_proc (struct ompi_proc_t *proc)
/* compute metrics for registered btls */
mca_bml_r2_compute_endpoint_metrics (bml_endpoint);
/* do it last, for the lazy initialization check in bml_base_get* */
#if OPAL_ENABLE_THREAD_MULTI
opal_atomic_wmb();
#endif /* OPAL_ENABLE_THREAD_MULTI */
proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML] = bml_endpoint;
return OMPI_SUCCESS;
}
@ -523,6 +528,7 @@ static int mca_bml_r2_add_procs( size_t nprocs,
if (NULL == bml_endpoint) {
bml_endpoint = mca_bml_r2_allocate_endpoint (proc);
proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML] = bml_endpoint;
if (NULL == bml_endpoint) {
free(btl_endpoints);
free(new_procs);