diff --git a/ompi/mca/coll/hcoll/coll_hcoll_component.c b/ompi/mca/coll/hcoll/coll_hcoll_component.c index 0bf4ec767a3..5bd62cea589 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_component.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_component.c @@ -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 @@ -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 */ diff --git a/ompi/mca/mtl/mxm/mtl_mxm_component.c b/ompi/mca/mtl/mxm/mtl_mxm_component.c index 28c04a3efaf..fe1eb35a8b7 100644 --- a/ompi/mca/mtl/mxm/mtl_mxm_component.c +++ b/ompi/mca/mtl/mxm/mtl_mxm_component.c @@ -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 = { { /* @@ -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 */ diff --git a/ompi/mca/mtl/portals4/mtl_portals4_component.c b/ompi/mca/mtl/portals4/mtl_portals4_component.c index 892bb67b7f5..473e2786b59 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_component.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_component.c @@ -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 @@ -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 */ diff --git a/ompi/mca/mtl/psm/mtl_psm_component.c b/ompi/mca/mtl/psm/mtl_psm_component.c index d0bc358cc09..d52aa7be3e7 100644 --- a/ompi/mca/mtl/psm/mtl_psm_component.c +++ b/ompi/mca/mtl/psm/mtl_psm_component.c @@ -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 = { { @@ -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 */ diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index e46d993bd78..47469d6240e 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -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 = { { @@ -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 */ diff --git a/ompi/mca/osc/portals4/osc_portals4_component.c b/ompi/mca/osc/portals4/osc_portals4_component.c index 889b20e8255..370fab3a820 100644 --- a/ompi/mca/osc/portals4/osc_portals4_component.c +++ b/ompi/mca/osc/portals4/osc_portals4_component.c @@ -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 = { @@ -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 */ diff --git a/ompi/mca/pml/yalla/pml_yalla_component.c b/ompi/mca/pml/yalla/pml_yalla_component.c index ce4a2c8633a..3ab6951f0d0 100644 --- a/ompi/mca/pml/yalla/pml_yalla_component.c +++ b/ompi/mca/pml/yalla/pml_yalla_component.c @@ -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 = { @@ -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 */ diff --git a/opal/mca/base/base.h b/opal/mca/base/base.h index 1fdcbd899d7..69fc489c9be 100644 --- a/opal/mca/base/base.h +++ b/opal/mca/base/base.h @@ -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 diff --git a/opal/mca/base/mca_base_close.c b/opal/mca/base/mca_base_close.c index 352ed01bec1..baa12f0d42b 100644 --- a/opal/mca/base/mca_base_close.c +++ b/opal/mca/base/mca_base_close.c @@ -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(); diff --git a/opal/mca/base/mca_base_components_open.c b/opal/mca/base/mca_base_components_open.c index 182a0fb5991..54a9c927505 100644 --- a/opal/mca/base/mca_base_components_open.c +++ b/opal/mca/base/mca_base_components_open.c @@ -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 @@ -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 */ diff --git a/opal/mca/base/mca_base_open.c b/opal/mca/base/mca_base_open.c index 7f14ffaf02e..4b214eb1c45 100644 --- a/opal/mca/base/mca_base_open.c +++ b/opal/mca/base/mca_base_open.c @@ -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; /* @@ -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(); diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index cb741816ceb..c7749530d8a 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -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 @@ -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 */ diff --git a/opal/mca/btl/sm/btl_sm_component.c b/opal/mca/btl/sm/btl_sm_component.c index 35796b55f17..28cdd7485d1 100644 --- a/opal/mca/btl/sm/btl_sm_component.c +++ b/opal/mca/btl/sm/btl_sm_component.c @@ -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. */ @@ -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 */ diff --git a/opal/mca/btl/smcuda/btl_smcuda_component.c b/opal/mca/btl/smcuda/btl_smcuda_component.c index 8aedf9f1d7a..723106b150c 100644 --- a/opal/mca/btl/smcuda/btl_smcuda_component.c +++ b/opal/mca/btl/smcuda/btl_smcuda_component.c @@ -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. */ @@ -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 */ diff --git a/opal/mca/btl/tcp/btl_tcp_component.c b/opal/mca/btl/tcp/btl_tcp_component.c index e4a547ac9c8..742b056600c 100644 --- a/opal/mca/btl/tcp/btl_tcp_component.c +++ b/opal/mca/btl/tcp/btl_tcp_component.c @@ -105,6 +105,10 @@ opal_list_t mca_btl_tcp_ready_frag_pending_queue = { { 0 } }; opal_mutex_t mca_btl_tcp_ready_frag_mutex = OPAL_MUTEX_STATIC_INIT; #endif /* MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD */ +mca_base_component_filter_t mca_btl_tcp_filter = { + .mca_filter_include = {"ethernet", NULL}, +}; + mca_btl_tcp_component_t mca_btl_tcp_component = { .super = { /* First, the mca_base_component_t struct containing meta information @@ -115,6 +119,7 @@ mca_btl_tcp_component_t mca_btl_tcp_component = { .mca_open_component = mca_btl_tcp_component_open, .mca_close_component = mca_btl_tcp_component_close, .mca_register_component_params = mca_btl_tcp_component_register, + .mca_filter = &mca_btl_tcp_filter, }, .btl_data = { /* The component is checkpoint ready */ diff --git a/opal/mca/btl/ugni/btl_ugni_component.c b/opal/mca/btl/ugni/btl_ugni_component.c index 271ec40a528..bfceb8b276c 100644 --- a/opal/mca/btl/ugni/btl_ugni_component.c +++ b/opal/mca/btl/ugni/btl_ugni_component.c @@ -32,6 +32,10 @@ static mca_btl_base_module_t **mca_btl_ugni_component_init(int *, bool, bool); static int mca_btl_ugni_component_progress(void); static unsigned long mca_btl_ugni_ugni_page_size = 0; +mca_base_component_filter_t mca_btl_ugni_filter = { + .mca_filter_include = {"gni", "gemini", "aries", NULL}, +}; + mca_btl_ugni_component_t mca_btl_ugni_component = { .super = { /* First, the mca_base_component_t struct containing meta information @@ -41,6 +45,7 @@ mca_btl_ugni_component_t mca_btl_ugni_component = { .mca_open_component = btl_ugni_component_open, .mca_close_component = btl_ugni_component_close, .mca_register_component_params = btl_ugni_component_register, + .mca_filter = &mca_btl_ugni_filter, }, .btl_data = { .param_field = MCA_BASE_METADATA_PARAM_CHECKPOINT diff --git a/opal/mca/btl/usnic/btl_usnic_component.c b/opal/mca/btl/usnic/btl_usnic_component.c index a063b72da65..bee08cb5091 100644 --- a/opal/mca/btl/usnic/btl_usnic_component.c +++ b/opal/mca/btl/usnic/btl_usnic_component.c @@ -134,6 +134,9 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str, const char *name); static void free_filter(usnic_if_filter_t *filter); +mca_base_component_filter_t mca_btl_usnic_filter = { + .mca_filter_include = {"ethernet", NULL}, +}; opal_btl_usnic_component_t mca_btl_usnic_component = { .super = { @@ -144,6 +147,7 @@ opal_btl_usnic_component_t mca_btl_usnic_component = { .mca_open_component = usnic_component_open, .mca_close_component = usnic_component_close, .mca_register_component_params = opal_btl_usnic_component_register, + .mca_filter = &mca_btl_usnic_filter, }, .btl_data = { /* The component is not checkpoint ready */ diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 23a93a3bbf8..46eea433da9 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -72,6 +72,10 @@ static mca_base_var_enum_value_t single_copy_mechanisms[] = { {.value = 0, .string = NULL} }; +mca_base_component_filter_t mca_btl_vader_filter = { + .mca_filter_include = {"shared-memory", "sm", NULL}, +}; + /* * Shared Memory (VADER) component instance. */ @@ -84,6 +88,7 @@ mca_btl_vader_component_t mca_btl_vader_component = { .mca_open_component = mca_btl_vader_component_open, .mca_close_component = mca_btl_vader_component_close, .mca_register_component_params = mca_btl_vader_component_register, + .mca_filter = &mca_btl_vader_filter, }, .btl_data = { /* The component is checkpoint ready */ diff --git a/opal/mca/mca.h b/opal/mca/mca.h index 7a545743653..6c648993827 100644 --- a/opal/mca/mca.h +++ b/opal/mca/mca.h @@ -256,6 +256,12 @@ typedef int (*mca_base_register_component_params_2_0_0_fn_t)(void); */ #define MCA_BASE_MAX_COMPONENT_NAME_LEN 63 +struct mca_base_component_filter_t { + const char *mca_filter_include[256]; + const char reserved[32]; +}; +typedef struct mca_base_component_filter_t mca_base_component_filter_t; + /** * Common type for all MCA components. * @@ -315,9 +321,11 @@ struct mca_base_component_2_1_0_t { mca_base_register_component_params_2_0_0_fn_t mca_register_component_params; /**< Method for registering the component's MCA parameters */ + mca_base_component_filter_t *mca_filter; + /** Extra space to allow for expansion in the future without breaking older components. */ - char reserved[32]; + char reserved[24]; }; /** Unversioned convenience typedef; use this name in frameworks/components to stay forward source-compatible */