1
1

Merge pull request #7975 from wckzhang/btlcommonlist

btl/ofi: Use common provider include/exclude list
Этот коммит содержится в:
Jeff Squyres 2020-08-10 14:41:53 -04:00 коммит произвёл GitHub
родитель a44914cb6b 9b8f463a76
Коммит 9a0f661a66
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 66 добавлений и 29 удалений

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

@ -306,26 +306,6 @@ ompi_mtl_ofi_progress_no_inline(void)
return ompi_mtl_ofi_progress();
}
static int
is_in_list(char **list, char *item)
{
int i = 0;
if ((NULL == list) || (NULL == item)) {
return 0;
}
while (NULL != list[i]) {
if (0 == strncasecmp(item, list[i], strlen(list[i]))) {
return 1;
} else {
i++;
}
}
return 0;
}
static struct fi_info*
select_ofi_provider(struct fi_info *providers,
char **include_list, char **exclude_list)
@ -334,7 +314,7 @@ select_ofi_provider(struct fi_info *providers,
if (NULL != include_list) {
while ((NULL != prov) &&
(!is_in_list(include_list, prov->fabric_attr->prov_name))) {
(!opal_common_ofi_is_in_list(include_list, prov->fabric_attr->prov_name))) {
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: mtl:ofi: \"%s\" not in include list\n",
__FILE__, __LINE__,
@ -343,7 +323,7 @@ select_ofi_provider(struct fi_info *providers,
}
} else if (NULL != exclude_list) {
while ((NULL != prov) &&
(is_in_list(exclude_list, prov->fabric_attr->prov_name))) {
(opal_common_ofi_is_in_list(exclude_list, prov->fabric_attr->prov_name))) {
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: mtl:ofi: \"%s\" in exclude list\n",
__FILE__, __LINE__,
@ -733,8 +713,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
* this logic if the user specifies an include list without EFA or adds EFA
* to the exclude list.
*/
if ((include_list && is_in_list(include_list, "efa")) ||
(exclude_list && !is_in_list(exclude_list, "efa"))) {
if ((include_list && opal_common_ofi_is_in_list(include_list, "efa")) ||
(exclude_list && !opal_common_ofi_is_in_list(exclude_list, "efa"))) {
hints_dup = fi_dupinfo(hints);
hints_dup->caps &= ~(FI_LOCAL_COMM | FI_REMOTE_COMM);
hints_dup->fabric_attr->prov_name = strdup("efa");

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

@ -53,10 +53,25 @@ static int mca_btl_ofi_init_device(struct fi_info *info);
/* validate information returned from fi_getinfo().
* return OPAL_ERROR if we dont have what we need. */
static int validate_info(struct fi_info *info, uint64_t required_caps)
static int validate_info(struct fi_info *info, uint64_t required_caps,
char **include_list, char **exclude_list)
{
int mr_mode;
if (NULL != include_list && !opal_common_ofi_is_in_list(include_list, info->fabric_attr->prov_name)) {
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: btl:ofi: \"%s\" not in include list\n",
__FILE__, __LINE__,
info->fabric_attr->prov_name);
return OPAL_ERROR;
} else if (NULL != exclude_list && opal_common_ofi_is_in_list(exclude_list, info->fabric_attr->prov_name)) {
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: btl:ofi: \"%s\" in exclude list\n",
__FILE__, __LINE__,
info->fabric_attr->prov_name);
return OPAL_ERROR;
}
BTL_VERBOSE(("validating device: %s", info->domain_attr->name));
/* we need exactly all the required bits */
@ -219,7 +234,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules,
uint64_t progress_mode;
unsigned resource_count = 0;
struct mca_btl_base_module_t **base_modules;
char **include_list = NULL;
char **include_list = NULL, **exclude_list = NULL;
BTL_VERBOSE(("initializing ofi btl"));
@ -264,10 +279,18 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules,
}
fabric_attr.prov_name = NULL;
/* Select the provider - sort of. we just take first element in list for now */
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: btl:ofi:provider_include = \"%s\"\n",
__FILE__, __LINE__, *opal_common_ofi.prov_include);
opal_output_verbose(1, opal_common_ofi.output,
"%s:%d: btl:ofi:provider_exclude = \"%s\"\n",
__FILE__, __LINE__, *opal_common_ofi.prov_exclude);
if (NULL != *opal_common_ofi.prov_include) {
include_list = opal_argv_split(*opal_common_ofi.prov_include, ',');
fabric_attr.prov_name = include_list[0];
} else if (NULL != *opal_common_ofi.prov_exclude) {
exclude_list = opal_argv_split(*opal_common_ofi.prov_exclude, ',');
}
domain_attr.mr_mode = MCA_BTL_OFI_REQUESTED_MR_MODE;
@ -331,7 +354,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules,
info = info_list;
while(info) {
rc = validate_info(info, required_caps);
rc = validate_info(info, required_caps, include_list, exclude_list);
if (OPAL_SUCCESS == rc) {
/* Device passed sanity check, let's make a module.
*

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

@ -33,6 +33,25 @@ OPAL_DECLSPEC opal_common_ofi_module_t opal_common_ofi = {
static const char default_prov_exclude_list[] = "shm,sockets,tcp,udp,rstream";
OPAL_DECLSPEC int opal_common_ofi_is_in_list(char **list, char *item)
{
int i = 0;
if ((NULL == list) || (NULL == item)) {
return 0;
}
while (NULL != list[i]) {
if (0 == strncasecmp(item, list[i], strlen(list[i]))) {
return 1;
} else {
i++;
}
}
return 0;
}
OPAL_DECLSPEC int opal_common_ofi_register_mca_variables(const mca_base_component_t *component)
{
static int registered = 0;

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

@ -38,6 +38,21 @@ OPAL_DECLSPEC void opal_common_ofi_mca_register(void);
OPAL_DECLSPEC void opal_common_ofi_mca_deregister(void);
OPAL_DECLSPEC struct fi_info* opal_common_ofi_select_ofi_provider(struct fi_info *providers,
char *framework_name);
/*
* @param list (IN) List of strings corresponding to lower providers.
* @param item (IN) Single string corresponding to a provider.
*
* @return 0 The lower provider of the item string is not in
* list or an input was NULL
* @return 1 The lower provider of the item string matches
* a string in the item list.
*
* This function will take a provider name string and a list of lower
* provider name strings as inputs. It will return true if the lower
* provider in the item string matches a lower provider in the list.
*
*/
OPAL_DECLSPEC int opal_common_ofi_is_in_list(char **list, char *item);
END_C_DECLS