diff --git a/ompi/mca/hook/demo/hook_demo_component.c b/ompi/mca/hook/demo/hook_demo_component.c index 44e1acebd1b..f1dfaabf87b 100644 --- a/ompi/mca/hook/demo/hook_demo_component.c +++ b/ompi/mca/hook/demo/hook_demo_component.c @@ -41,6 +41,9 @@ const ompi_hook_base_component_2_0_0_t mca_hook_demo_component = { .mca_open_component = ompi_hook_demo_component_open, .mca_close_component = ompi_hook_demo_component_close, .mca_register_component_params = ompi_hook_demo_component_register, + + // Force this component to always be considered - component must be static + //.mca_component_flags = MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER, }, .hookm_data = { /* The component is checkpoint ready */ diff --git a/opal/mca/base/help-mca-base.txt b/opal/mca/base/help-mca-base.txt index 63bc471c1bd..4ed4179c9ba 100644 --- a/opal/mca/base/help-mca-base.txt +++ b/opal/mca/base/help-mca-base.txt @@ -11,6 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -59,3 +60,10 @@ all components *except* a and b", while "c,d" specifies the inclusive behavior and means "use *only* components c and d." You cannot mix inclusive and exclusive behavior. +[framework-param:exclude-always-component] +Error: A request was made to exclude a component from consideration that +must always be considered. This component (noted below) can -not- be excluded +from consideration. The program will fail at this time. + +Framework: %s +Component: %s diff --git a/opal/mca/base/mca_base_component_find.c b/opal/mca/base/mca_base_component_find.c index 899673dfaf9..e86e486fd4f 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -14,8 +14,9 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -115,9 +116,24 @@ int mca_base_component_find (const char *directory, mca_base_framework_t *framew /* Find all the components that were statically linked in */ if (static_components) { for (int i = 0 ; NULL != static_components[i]; ++i) { - if ( use_component(include_mode, - (const char**)requested_component_names, - static_components[i]->mca_component_name) ) { + bool can_use; + + can_use = use_component(include_mode, (const char **) requested_component_names, + static_components[i]->mca_component_name); + + // Make sure the user is not trying to unload a component that must + // always be considered. + if (!can_use && static_components[i]->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) { + if (!include_mode) { + opal_show_help ("help-mca-base.txt", "framework-param:exclude-always-component", true, + framework->framework_name, static_components[i]->mca_component_name); + return OPAL_ERR_NOT_SUPPORTED; + } + + can_use = true; + } + + if (can_use) { cli = OBJ_NEW(mca_base_component_list_item_t); if (NULL == cli) { ret = OPAL_ERR_OUT_OF_RESOURCE; @@ -192,6 +208,18 @@ int mca_base_components_filter (mca_base_framework_t *framework, uint32_t filter can_use = use_component (include_mode, (const char **) requested_component_names, cli->cli_component->mca_component_name); + // Make sure the user is not trying to unload a component that must + // always be considered. + if (!can_use && cli->cli_component->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) { + if (!include_mode) { + opal_show_help ("help-mca-base.txt", "framework-param:exclude-always-component", true, + framework->framework_name, cli->cli_component->mca_component_name); + return OPAL_ERR_NOT_SUPPORTED; + } + + can_use = true; + } + if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) { if (can_use && (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) && !(MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field)) { diff --git a/opal/mca/mca.h b/opal/mca/mca.h index 7a545743653..6ace8976f7e 100644 --- a/opal/mca/mca.h +++ b/opal/mca/mca.h @@ -11,8 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -256,6 +257,15 @@ typedef int (*mca_base_register_component_params_2_0_0_fn_t)(void); */ #define MCA_BASE_MAX_COMPONENT_NAME_LEN 63 +/** + * Component flags (mca_component_flags field) + */ +enum { + /** Always consider this component for selection. For this flag to + * work properly the component must always be built statically. */ + MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER = 1, +}; + /** * Common type for all MCA components. * @@ -315,9 +325,13 @@ 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 */ + int32_t mca_component_flags; + /**< flags for this component */ + /** Extra space to allow for expansion in the future without - breaking older components. */ - char reserved[32]; + breaking older components. + NTH/JJH: reduced by 4 bytes for mca_component_flags */ + char reserved[28]; }; /** Unversioned convenience typedef; use this name in frameworks/components to stay forward source-compatible */