1515 * reserved.
1616 * Copyright (c) 2011-2012 University of Houston. All rights reserved.
1717 * Copyright (c) 2016 Intel, Inc. All rights reserved.
18+ * Copyright (c) 2017 IBM Corporation. All rights reserved.
1819 * $COPYRIGHT$
1920 *
2021 * Additional copyrights may follow
5051#include "opal/mca/installdirs/installdirs.h"
5152
5253#include "opal/runtime/opal_info_support.h"
54+ #include "opal/mca/base/mca_base_component_repository.h"
5355
5456const char * opal_info_path_prefix = "prefix" ;
5557const char * opal_info_path_bindir = "bindir" ;
@@ -109,6 +111,9 @@ OBJ_CLASS_INSTANCE(opal_info_component_map_t,
109111 component_map_construct ,
110112 component_map_destruct );
111113
114+ static void opal_info_show_failed_component (const mca_base_component_repository_item_t * ri ,
115+ const char * error_msg );
116+
112117int opal_info_init (int argc , char * * argv ,
113118 opal_cmd_line_t * opal_info_cmd_line )
114119{
@@ -157,6 +162,8 @@ int opal_info_init(int argc, char **argv,
157162 "Show only variables with at most this level (1-9)" );
158163 opal_cmd_line_make_opt3 (opal_info_cmd_line , 's' , NULL , "selected-only" , 0 ,
159164 "Show only variables from selected components" );
165+ opal_cmd_line_make_opt3 (opal_info_cmd_line , '\0' , NULL , "show-failed" , 0 ,
166+ "Show the components that failed to load along with the reason why they failed." );
160167
161168 /* set our threading level */
162169 opal_set_using_threads (false);
@@ -223,6 +230,10 @@ int opal_info_init(int argc, char **argv,
223230 opal_info_register_flags = MCA_BASE_REGISTER_DEFAULT ;
224231 }
225232
233+ if ( opal_cmd_line_is_taken (opal_info_cmd_line , "show-failed" ) ) {
234+ mca_base_component_track_load_errors = true;
235+ }
236+
226237 return OPAL_SUCCESS ;
227238}
228239
@@ -245,6 +256,7 @@ static int info_register_framework (mca_base_framework_t *framework, opal_pointe
245256 map = OBJ_NEW (opal_info_component_map_t );
246257 map -> type = strdup (framework -> framework_name );
247258 map -> components = & framework -> framework_components ;
259+ map -> failed_components = & framework -> framework_failed_components ;
248260 opal_pointer_array_add (component_map , map );
249261 }
250262
@@ -1012,6 +1024,7 @@ void opal_info_show_component_version(opal_pointer_array_t *mca_types,
10121024 bool want_all_types = false;
10131025 bool found ;
10141026 mca_base_component_list_item_t * cli ;
1027+ mca_base_failed_component_t * cli_failed ;
10151028 int j ;
10161029 char * pos ;
10171030 opal_info_component_map_t * map ;
@@ -1057,6 +1070,15 @@ void opal_info_show_component_version(opal_pointer_array_t *mca_types,
10571070 }
10581071 }
10591072
1073+ /* found it! */
1074+ OPAL_LIST_FOREACH (cli_failed , map -> failed_components , mca_base_failed_component_t ) {
1075+ mca_base_component_repository_item_t * ri = cli_failed -> comp ;
1076+ if (want_all_components ||
1077+ 0 == strcmp (component_name , ri -> ri_name ) ) {
1078+ opal_info_show_failed_component (ri , cli_failed -> error_msg );
1079+ }
1080+ }
1081+
10601082 if (!want_all_types ) {
10611083 break ;
10621084 }
@@ -1065,6 +1087,30 @@ void opal_info_show_component_version(opal_pointer_array_t *mca_types,
10651087}
10661088
10671089
1090+ static void opal_info_show_failed_component (const mca_base_component_repository_item_t * ri ,
1091+ const char * error_msg )
1092+ {
1093+ char * message , * content ;
1094+
1095+ if (opal_info_pretty ) {
1096+ asprintf (& message , "MCA %s" , ri -> ri_type );
1097+ asprintf (& content , "%s (failed to load) %s" , ri -> ri_name , error_msg );
1098+
1099+ opal_info_out (message , NULL , content );
1100+
1101+ free (message );
1102+ free (content );
1103+ } else {
1104+ asprintf (& message , "mca:%s:%s:failed" , ri -> ri_type , ri -> ri_name );
1105+ asprintf (& content , "%s" , error_msg );
1106+
1107+ opal_info_out (NULL , message , content );
1108+
1109+ free (message );
1110+ free (content );
1111+ }
1112+ }
1113+
10681114/*
10691115 * Given a component, display its relevant version(s)
10701116 */
0 commit comments