1
1

use ibv_get_device_list if present

(submitted from roland)

This commit was SVN r8712.
Этот коммит содержится в:
Galen Shipman 2006-01-17 16:23:35 +00:00
родитель e830339098
Коммит 0c81c0a6ce

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

@ -305,7 +305,8 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
seedv[1] = opal_sys_timer_get_cycles();
seedv[2] = opal_sys_timer_get_cycles();
seed48(seedv);
#ifndef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
/* Determine the number of hca's available on the host */
dev_list = ibv_get_devices();
if (NULL == dev_list) {
@ -318,14 +319,17 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
num_devs++;
#else
ib_devs = ibv_get_device_list(&num_devs);
#endif
if(0 == num_devs) {
mca_btl_base_error_no_nics("OpenIB", "HCA");
mca_btl_openib_modex_send();
return NULL;
}
#ifndef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
/* Allocate space for the ib devices */
ib_devs = (struct ibv_device**) malloc(num_devs * sizeof(struct ibv_dev*));
if(NULL == ib_devs) {
@ -338,7 +342,7 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
i = 0;
dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
ib_devs[i++] = ib_dev;
#endif
/** We must loop through all the hca id's, get there handles and
for each hca we query the number of ports on the hca and set up
@ -449,10 +453,14 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
OBJ_CONSTRUCT(&openib_btl->recv_free_max, ompi_free_list_t);
if(mca_btl_openib_module_init(openib_btl) != OMPI_SUCCESS) {
free(ib_devs);
return NULL;
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
ibv_free_device_list(ib_devs);
#else
free(ib_devs);
#endif
return NULL;
}
mpool_resources.ib_pd = openib_btl->ib_pd;
/* initialize the memory pool using the hca */
@ -534,7 +542,11 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_modex_send();
*num_btl_modules = mca_btl_openib_component.ib_num_btls;
free(ib_devs);
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
ibv_free_device_list(ib_devs);
#else
free(ib_devs);
#endif
return btls;
}