From c45e0a36970981b0221b4194210b9b2d2704caeb Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 21 Mar 2016 12:28:53 -0600 Subject: [PATCH 1/3] mca: add support for required components This commit adds a new flag to the mca_base_component_t structure that specifies component flags. The only flag currently support is MCA_BASE_COMPONENT_FLAG_ALLWAYS_CONSIDER which forces the selection logic in the MCA base to always consider a component whether or not it was specified. In order to use this support a component must be built statically and not dynamically. For example, if btl:self is built statically and sets this flag in its component then -mca btl vader,openib would provide vader, openib, and self. Signed-off-by: Nathan Hjelm --- opal/mca/base/mca_base_component_find.c | 11 ++++++----- opal/mca/mca.h | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/opal/mca/base/mca_base_component_find.c b/opal/mca/base/mca_base_component_find.c index 7739399c5bb..48601970662 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -14,7 +14,7 @@ * 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$ * @@ -115,8 +115,8 @@ 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, + if ( (static_components[i]->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) || + use_component(include_mode, (const char**)requested_component_names, static_components[i]->mca_component_name) ) { cli = OBJ_NEW(mca_base_component_list_item_t); if (NULL == cli) { @@ -189,8 +189,9 @@ int mca_base_components_filter (mca_base_framework_t *framework, uint32_t filter mca_base_open_only_dummy_component_t *dummy = (mca_base_open_only_dummy_component_t *) cli->cli_component; - can_use = use_component (include_mode, (const char **) requested_component_names, - cli->cli_component->mca_component_name); + can_use = (cli->cli_component->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) || + use_component (include_mode, (const char **) requested_component_names, + cli->cli_component->mca_component_name); if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) { if (can_use && (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) && diff --git a/opal/mca/mca.h b/opal/mca/mca.h index 7a545743653..f264612baf6 100644 --- a/opal/mca/mca.h +++ b/opal/mca/mca.h @@ -11,7 +11,7 @@ * 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$ * @@ -256,6 +256,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 +324,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: 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 */ From cfc8a4d010ce0f8551dc6c7dee03f3c4084d35ef Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 21 Mar 2016 12:32:59 -0600 Subject: [PATCH 2/3] btl/self: make component static and set the allways consider flag This commit makes it so the btl/self component will always be considered for selection in the btl framework. Signed-off-by: Nathan Hjelm --- opal/mca/btl/self/Makefile.am | 27 ++++++-------------------- opal/mca/btl/self/btl_self_component.c | 1 + opal/mca/btl/self/configure.m4 | 19 ++++++++++++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 opal/mca/btl/self/configure.m4 diff --git a/opal/mca/btl/self/Makefile.am b/opal/mca/btl/self/Makefile.am index e35fb91d803..780474e9927 100644 --- a/opal/mca/btl/self/Makefile.am +++ b/opal/mca/btl/self/Makefile.am @@ -10,6 +10,8 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -17,30 +19,13 @@ # $HEADER$ # -libmca_btl_self_la_sources = \ +# Make self component always static +noinst_LTLIBRARIES = libmca_btl_self.la + +libmca_btl_self_la_SOURCES = \ btl_self.c \ btl_self.h \ btl_self_component.c \ btl_self_frag.c \ btl_self_frag.h -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_btl_self_DSO -component_noinst = -component_install = mca_btl_self.la -else -component_noinst = libmca_btl_self.la -component_install = -endif - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_btl_self_la_SOURCES = $(libmca_btl_self_la_sources) -mca_btl_self_la_LDFLAGS = -module -avoid-version - -noinst_LTLIBRARIES = $(component_noinst) -libmca_btl_self_la_SOURCES = $(libmca_btl_self_la_sources) -libmca_btl_self_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/btl/self/btl_self_component.c b/opal/mca/btl/self/btl_self_component.c index 42ea125d446..ebc1bf35998 100644 --- a/opal/mca/btl/self/btl_self_component.c +++ b/opal/mca/btl/self/btl_self_component.c @@ -48,6 +48,7 @@ mca_btl_self_component_t mca_btl_self_component = { .mca_open_component = mca_btl_self_component_open, .mca_close_component = mca_btl_self_component_close, .mca_register_component_params = mca_btl_self_component_register, + .mca_component_flags = MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER, }, .btl_data = { /* The component is checkpoint ready */ diff --git a/opal/mca/btl/self/configure.m4 b/opal/mca/btl/self/configure.m4 new file mode 100644 index 00000000000..86b85e825bc --- /dev/null +++ b/opal/mca/btl/self/configure.m4 @@ -0,0 +1,19 @@ +# -*- shell-script -*- +# +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AC_DEFUN([MCA_opal_btl_self_COMPILE_MODE], [ + AC_MSG_CHECKING([for MCA component btl:self compile mode]) + $4=static + AC_MSG_RESULT([static]) +]) + +AC_DEFUN([MCA_opal_btl_self_CONFIG], [ + AC_CONFIG_FILES([opal/mca/btl/self/Makefile]) +]) From 166d66c33c1f30d0e4fcafb22566556970d44ff5 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 21 Mar 2016 16:18:22 -0600 Subject: [PATCH 3/3] mca: warning when attempting to disable always consider component This commit adds a show_help() message when a user explicitly attempts to disable a component that can not be disabled. After printing the show_help message the component is enabled and execution continues. Signed-off-by: Nathan Hjelm --- opal/mca/base/help-mca-base.txt | 6 +++++ opal/mca/base/mca_base_component_find.c | 32 ++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/opal/mca/base/help-mca-base.txt b/opal/mca/base/help-mca-base.txt index 63bc471c1bd..cf2ae7f8c36 100644 --- a/opal/mca/base/help-mca-base.txt +++ b/opal/mca/base/help-mca-base.txt @@ -59,3 +59,9 @@ 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] +A request was made to exclude a component from consideration that +must always be considered. + +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 48601970662..f6e73d5fff8 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -115,9 +115,21 @@ 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 ( (static_components[i]->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) || - 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); + + 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); + } + + can_use = true; + } + + if (can_use) { cli = OBJ_NEW(mca_base_component_list_item_t); if (NULL == cli) { ret = OPAL_ERR_OUT_OF_RESOURCE; @@ -189,9 +201,17 @@ int mca_base_components_filter (mca_base_framework_t *framework, uint32_t filter mca_base_open_only_dummy_component_t *dummy = (mca_base_open_only_dummy_component_t *) cli->cli_component; - can_use = (cli->cli_component->mca_component_flags & MCA_BASE_COMPONENT_FLAG_ALWAYS_CONSIDER) || - use_component (include_mode, (const char **) requested_component_names, - cli->cli_component->mca_component_name); + can_use = use_component (include_mode, (const char **) requested_component_names, + cli->cli_component->mca_component_name); + + 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); + } + + can_use = true; + } if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) { if (can_use && (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) &&