Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCA component filter #1974

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ompi/mca/coll/hcoll/coll_hcoll_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ static int hcoll_open(void);
static int hcoll_close(void);
static int hcoll_register(void);
int mca_coll_hcoll_output = -1;

mca_base_component_filter_t mca_coll_hcoll_filter = {
.mca_filter_include = {"infiniband", "mxm", NULL},
};

mca_coll_hcoll_component_t mca_coll_hcoll_component = {

/* First, the mca_component_t struct containing meta information
Expand All @@ -46,6 +51,7 @@ mca_coll_hcoll_component_t mca_coll_hcoll_component = {
.mca_open_component = hcoll_open,
.mca_close_component = hcoll_close,
.mca_register_component_params = hcoll_register,
.mca_filter = &mca_coll_hcoll_filter,
},
.collm_data = {
/* The component is not checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions ompi/mca/mtl/mxm/mtl_mxm_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ static mca_mtl_base_module_t
* ompi_mtl_mxm_component_init(bool enable_progress_threads,
bool enable_mpi_threads);

mca_base_component_filter_t mca_mtl_mxm_filter = {
.mca_filter_include = {"infiniband", "mxm", NULL},
};

mca_mtl_mxm_component_t mca_mtl_mxm_component = {
{
/*
Expand All @@ -56,6 +60,7 @@ mca_mtl_mxm_component_t mca_mtl_mxm_component = {
.mca_close_component = ompi_mtl_mxm_component_close,
.mca_query_component = ompi_mtl_mxm_component_query,
.mca_register_component_params = ompi_mtl_mxm_component_register,
.mca_filter = &mca_mtl_mxm_filter,
},
.mtl_data = {
/* The component is not checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions ompi/mca/mtl/portals4/mtl_portals4_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads,

OMPI_MODULE_DECLSPEC extern mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component;

mca_base_component_filter_t mca_mtl_portals4_filter = {
.mca_filter_include = {"portals", NULL},
};

mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component = {

/* First, the mca_base_component_t struct containing meta
Expand All @@ -60,6 +64,7 @@ mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component = {
.mca_close_component = ompi_mtl_portals4_component_close,
.mca_query_component = ompi_mtl_portals4_component_query,
.mca_register_component_params = ompi_mtl_portals4_component_register,
.mca_filter = &mca_mtl_portals4_filter,
},
.mtl_data = {
/* The component is not checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions ompi/mca/mtl/psm/mtl_psm_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ static int ompi_mtl_psm_component_register(void);
static mca_mtl_base_module_t* ompi_mtl_psm_component_init( bool enable_progress_threads,
bool enable_mpi_threads );

mca_base_component_filter_t mca_mtl_psm_filter = {
.mca_filter_include = {"infiniband", "psm", "truescale", NULL},
};

mca_mtl_psm_component_t mca_mtl_psm_component = {

{
Expand All @@ -65,6 +69,7 @@ mca_mtl_psm_component_t mca_mtl_psm_component = {
.mca_close_component = ompi_mtl_psm_component_close,
.mca_query_component = ompi_mtl_psm_component_query,
.mca_register_component_params = ompi_mtl_psm_component_register,
.mca_filter = &mca_mtl_psm_filter,
},
.mtl_data = {
/* The component is not checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions ompi/mca/mtl/psm2/mtl_psm2_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ static int ompi_mtl_psm2_component_register(void);
static mca_mtl_base_module_t* ompi_mtl_psm2_component_init( bool enable_progress_threads,
bool enable_mpi_threads );

mca_base_component_filter_t mca_mtl_psm2_filter = {
.mca_filter_include = {"infiniband", "psm2", "omnipath", NULL},
};

mca_mtl_psm2_component_t mca_mtl_psm2_component = {

{
Expand All @@ -65,6 +69,7 @@ mca_mtl_psm2_component_t mca_mtl_psm2_component = {
.mca_close_component = ompi_mtl_psm2_component_close,
.mca_query_component = ompi_mtl_psm2_component_query,
.mca_register_component_params = ompi_mtl_psm2_component_register,
.mca_filter = &mca_mtl_psm2_filter,
},
.mtl_data = {
/* The component is not checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions ompi/mca/osc/portals4/osc_portals4_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in
int flavor, int *model);


mca_base_component_filter_t mca_osc_portals4_filter = {
.mca_filter_include = {"portals", NULL},
};

ompi_osc_portals4_component_t mca_osc_portals4_component = {
{ /* ompi_osc_base_component_t */
.osc_version = {
Expand All @@ -43,6 +47,7 @@ ompi_osc_portals4_component_t mca_osc_portals4_component = {
OMPI_RELEASE_VERSION),
.mca_open_component = component_open,
.mca_register_component_params = component_register,
.mca_filter = &mca_osc_portals4_filter,
},
.osc_data = {
/* The component is not checkpoint ready */
Expand Down
4 changes: 4 additions & 0 deletions ompi/mca/pml/yalla/pml_yalla_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ mca_pml_yalla_component_init(int* priority, bool enable_progress_threads,
bool enable_mpi_threads);
static int mca_pml_yalla_component_fini(void);

mca_base_component_filter_t mca_pml_yalla_filter = {
.mca_filter_include = {"infiniband", "mxm", NULL},
};

mca_pml_base_component_2_0_0_t mca_pml_yalla_component = {

Expand All @@ -39,6 +42,7 @@ mca_pml_base_component_2_0_0_t mca_pml_yalla_component = {
.mca_open_component = mca_pml_yalla_component_open,
.mca_close_component = mca_pml_yalla_component_close,
.mca_register_component_params = mca_pml_yalla_component_register,
.mca_filter = &mca_pml_yalla_filter,
},
.pmlm_data = {
/* This component is not checkpoint ready */
Expand Down
2 changes: 2 additions & 0 deletions opal/mca/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ OPAL_DECLSPEC extern bool mca_base_component_show_load_errors;
OPAL_DECLSPEC extern bool mca_base_component_disable_dlopen;
OPAL_DECLSPEC extern char *mca_base_system_default_path;
OPAL_DECLSPEC extern char *mca_base_user_default_path;
OPAL_DECLSPEC extern char **mca_base_component_enable_list;
OPAL_DECLSPEC extern char **mca_base_component_disable_list;

/*
* Standard verbosity levels
Expand Down
10 changes: 10 additions & 0 deletions opal/mca/base/mca_base_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ int mca_base_close(void)
free(mca_base_user_default_path);
}

if (NULL != mca_base_component_enable_list) {
opal_argv_free (mca_base_component_enable_list);
mca_base_component_enable_list = NULL;
}

if (NULL != mca_base_component_disable_list) {
opal_argv_free (mca_base_component_disable_list);
mca_base_component_disable_list = NULL;
}

/* Close down the component repository */
mca_base_component_repository_finalize();

Expand Down
100 changes: 66 additions & 34 deletions opal/mca/base/mca_base_components_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ int mca_base_framework_components_open (mca_base_framework_t *framework,
return open_components (framework);
}

static bool mca_base_component_filter (const mca_base_component_t *component)
{
bool enable = mca_base_component_enable_list ? true : false;
char **list = enable ? mca_base_component_enable_list : mca_base_component_disable_list;

if (NULL == component->mca_filter || (NULL == mca_base_component_enable_list && NULL == mca_base_component_disable_list)) {
return true;
}

for (int i = 0 ; list[i] ; ++i) {
for (int j = 0 ; component->mca_filter->mca_filter_include[j] ; ++j) {
if (0 == strcmp (list[i], component->mca_filter->mca_filter_include[j])) {
return enable;
}
}
}

return !enable;
}

/*
* Traverse the entire list of found components (a list of
* mca_base_component_t instances). If the requested_component_names
Expand Down Expand Up @@ -115,52 +135,64 @@ static int open_components(mca_base_framework_t *framework)
/* Traverse the list of components */
OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
const mca_base_component_t *component = cli->cli_component;
bool enabled;

opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
"mca: base: components_open: found loaded component %s",
component->mca_component_name);

if (NULL != component->mca_open_component) {
/* Call open if register didn't call it already */
ret = component->mca_open_component();
enabled = mca_base_component_filter (component);

if (enabled) {
if (NULL != component->mca_open_component) {
/* Call open if register didn't call it already */
ret = component->mca_open_component();
if (OPAL_SUCCESS == ret) {
opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
"mca: base: components_open: "
"component %s open function successful",
component->mca_component_name);
}
} else {
ret = OPAL_SUCCESS;
}
} else {
ret = OPAL_ERR_NOT_AVAILABLE;
}

if (OPAL_SUCCESS == ret) {
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_NOT_AVAILABLE != ret) {
/* If the component returns OPAL_ERR_NOT_AVAILABLE,
it's a cue to "silently ignore me" -- it's not a
failure, it's just a way for the component to say
"nope!".

Otherwise, however, display an error. We may end
up displaying this twice, but it may go to separate
streams. So better to be redundant than to not
display the error in the stream where it was
expected. */

if (mca_base_component_show_load_errors) {
opal_output_verbose (MCA_BASE_VERBOSE_ERROR, output_id,
"mca: base: components_open: component %s "
"/ %s open function failed",
component->mca_type_name,
component->mca_component_name);
}
opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
"mca: base: components_open: "
"component %s open function successful",
"component %s open function failed",
component->mca_component_name);
} else {
if (OPAL_ERR_NOT_AVAILABLE != ret) {
/* If the component returns OPAL_ERR_NOT_AVAILABLE,
it's a cue to "silently ignore me" -- it's not a
failure, it's just a way for the component to say
"nope!".

Otherwise, however, display an error. We may end
up displaying this twice, but it may go to separate
streams. So better to be redundant than to not
display the error in the stream where it was
expected. */

if (mca_base_component_show_load_errors) {
opal_output_verbose (MCA_BASE_VERBOSE_ERROR, output_id,
"mca: base: components_open: component %s "
"/ %s open function failed",
component->mca_type_name,
component->mca_component_name);
}
opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
"mca: base: components_open: "
"component %s open function failed",
component->mca_component_name);
}
}

if (enabled) {
mca_base_component_close (component, output_id);
}

opal_list_remove_item (components, &cli->super);
OBJ_RELEASE(cli);
}
}
opal_list_remove_item (components, &cli->super);
OBJ_RELEASE(cli);
}
}

/* All done */
Expand Down
28 changes: 28 additions & 0 deletions opal/mca/base/mca_base_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ char *mca_base_user_default_path = NULL;
bool mca_base_component_show_load_errors = true;
bool mca_base_component_disable_dlopen = false;

char *mca_base_component_enable = NULL;
char *mca_base_component_disable = NULL;

char **mca_base_component_enable_list = NULL;
char **mca_base_component_disable_list = NULL;

static char *mca_base_verbose = NULL;

/*
Expand Down Expand Up @@ -143,6 +149,28 @@ int mca_base_open(void)
opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, 0, "mca: base: opening components");
free(lds.lds_prefix);

mca_base_component_enable = NULL;
(void) mca_base_var_register ("opal", "mca", "base", "component_enable",
"Types of components to be enabled. Can not be used with mca_base_component_disable",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY,
&mca_base_component_enable);

mca_base_component_disable = NULL;
(void) mca_base_var_register ("opal", "mca", "base", "component_disable",
"Types of components to be disabled. Can not be used with mca_base_component_enable",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY,
&mca_base_component_disable);

if (mca_base_component_enable && mca_base_component_disable) {
return OPAL_ERR_BAD_PARAM;
}

if (mca_base_component_enable) {
mca_base_component_enable_list = opal_argv_split (mca_base_component_enable, ',');
} else if (mca_base_component_disable) {
mca_base_component_disable_list = opal_argv_split (mca_base_component_disable, ',');
}

/* Open up the component repository */

return mca_base_component_repository_init();
Expand Down
5 changes: 5 additions & 0 deletions opal/mca/btl/openib/btl_openib_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ static void btl_openib_handle_incoming_completion(mca_btl_base_module_t* btl,
static mca_btl_openib_device_t *receive_queues_device = NULL;
static int num_devices_intentionally_ignored = 0;

mca_base_component_filter_t mca_btl_openib_filter = {
.mca_filter_include = {"infiniband", "ib", NULL},
};

mca_btl_openib_component_t mca_btl_openib_component = {
.super = {
/* First, the mca_base_component_t struct containing meta information
Expand All @@ -122,6 +126,7 @@ mca_btl_openib_component_t mca_btl_openib_component = {
.mca_open_component = btl_openib_component_open,
.mca_close_component = btl_openib_component_close,
.mca_register_component_params = btl_openib_component_register,
.mca_filter = &mca_btl_openib_filter,
},
.btl_data = {
/* The component is checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions opal/mca/btl/sm/btl_sm_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ typedef enum {
MCA_BTL_SM_RNDV_MOD_MPOOL
} mca_btl_sm_rndv_module_type_t;

mca_base_component_filter_t mca_btl_sm_filter = {
.mca_filter_include = {"shared-memory", "sm", NULL},
};

/*
* Shared Memory (SM) component instance.
*/
Expand All @@ -95,6 +99,7 @@ mca_btl_sm_component_t mca_btl_sm_component = {
.mca_open_component = mca_btl_sm_component_open,
.mca_close_component = mca_btl_sm_component_close,
.mca_register_component_params = sm_register,
.mca_filter = &mca_btl_sm_filter,
},
.btl_data = {
/* The component is checkpoint ready */
Expand Down
5 changes: 5 additions & 0 deletions opal/mca/btl/smcuda/btl_smcuda_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ typedef enum {
MCA_BTL_SM_RNDV_MOD_MPOOL
} mca_btl_sm_rndv_module_type_t;

mca_base_component_filter_t mca_btl_smcuda_filter = {
.mca_filter_include = {"shared-memory", "sm", "cuda", NULL},
};

/*
* Shared Memory (SM) component instance.
*/
Expand All @@ -89,6 +93,7 @@ mca_btl_smcuda_component_t mca_btl_smcuda_component = {
.mca_open_component = mca_btl_smcuda_component_open,
.mca_close_component = mca_btl_smcuda_component_close,
.mca_register_component_params = smcuda_register,
.mca_filter = &mca_btl_smcuda_filter,
},
.btl_data = {
/* The component is checkpoint ready */
Expand Down
Loading