diff --git a/ompi/mca/btl/openib/btl_openib_mca.c b/ompi/mca/btl/openib/btl_openib_mca.c index 8c10aba39e..2fd13bf413 100644 --- a/ompi/mca/btl/openib/btl_openib_mca.c +++ b/ompi/mca/btl/openib/btl_openib_mca.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved. * Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights * reserved. @@ -190,7 +190,7 @@ int btl_openib_register_mca_params(void) orte_show_help("help-mpi-btl-openib.txt", "ibv_fork requested but not supported", true, orte_process_info.nodename); - return OMPI_ERROR; + return OMPI_ERR_BAD_PARAM; } #endif @@ -221,7 +221,7 @@ int btl_openib_register_mca_params(void) orte_show_help("help-mpi-btl-openib.txt", "ibv_fork requested but not supported", true, orte_process_info.nodename); - return OMPI_ERROR; + return OMPI_ERR_BAD_PARAM; } free(str); @@ -646,6 +646,7 @@ int btl_openib_register_mca_params(void) } mca_btl_openib_component.memalign_threshold = (size_t)ival; #endif + /* Register any MCA params for the connect pseudo-components */ if (OMPI_SUCCESS == ret) { ret = ompi_btl_openib_connect_base_register(); diff --git a/ompi/tools/ompi_info/components.c b/ompi/tools/ompi_info/components.c index f078ce08fb..2a656651fd 100644 --- a/ompi/tools/ompi_info/components.c +++ b/ompi/tools/ompi_info/components.c @@ -68,9 +68,6 @@ #include "ompi/tools/ompi_info/ompi_info.h" -/* - * Public variables - */ /* @@ -90,7 +87,7 @@ static bool opened_components = false; int ompi_info_register_components(opal_pointer_array_t *mca_types, opal_pointer_array_t *component_map) { - int i; + int i, rc; char *env, *str; char *target, *save, *type; char **env_save=NULL; @@ -121,8 +118,11 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, } /* Register the MPI layer's MCA parameters */ - if (OMPI_SUCCESS != ompi_mpi_register_params()) { - str = "ompi_mpi_Register_params failed"; + if (OMPI_SUCCESS != (rc = ompi_mpi_register_params())) { + str = "ompi_mpi_register_params"; + if (OMPI_ERR_BAD_PARAM == rc) { + goto breakout; + } goto error; } @@ -131,123 +131,205 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, map->type = strdup("base"); opal_pointer_array_add(component_map, map); - /* set default error message from here forward */ - str = "A component framework failed to open properly."; - /* MPI frameworks */ - - if (OMPI_SUCCESS != mca_allocator_base_open()) { + if (OMPI_SUCCESS != (rc = mca_allocator_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "allocator open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("allocator"); map->components = &mca_allocator_base_components; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_btl_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "allocator"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_btl_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "btl open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("btl"); map->components = &mca_btl_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_coll_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "btl"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_coll_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "coll open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("coll"); map->components = &mca_coll_base_components_opened; opal_pointer_array_add(component_map, map); - + if (OMPI_ERR_BAD_PARAM == rc) { + str = "coll"; + goto breakout; + } + #if OPAL_ENABLE_FT_CR == 1 - if (OMPI_SUCCESS != ompi_crcp_base_open()) { + if (OMPI_SUCCESS != (rc = ompi_crcp_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "crcp open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("crcp"); map->components = &ompi_crcp_base_components_available; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "crcp"; + goto breakout; + } #endif - if (OMPI_SUCCESS != ompi_dpm_base_open()) { + if (OMPI_SUCCESS != (rc = ompi_dpm_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "dpm open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("dpm"); map->components = &ompi_dpm_base_components_available; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_fbtl_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "dpm"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_fbtl_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "fbtl open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("fbtl"); map->components = &mca_fbtl_base_components_opened; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "fbtl"; + goto breakout; + } - if (OMPI_SUCCESS != mca_fcoll_base_open()) { + if (OMPI_SUCCESS != (rc = mca_fcoll_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "fcoll open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("fcoll"); map->components = &mca_fcoll_base_components_opened; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "fcoll"; + goto breakout; + } - if (OMPI_SUCCESS != mca_fs_base_open()) { + if (OMPI_SUCCESS != (rc = mca_fs_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "fs open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("fs"); map->components = &mca_fs_base_components_opened; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "fs"; + goto breakout; + } - if (OMPI_SUCCESS != mca_io_base_open()) { + if (OMPI_SUCCESS != (rc = mca_io_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "io open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("io"); map->components = &mca_io_base_components_opened; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "io"; + goto breakout; + } - if (OMPI_SUCCESS != mca_mpool_base_open()) { + if (OMPI_SUCCESS != (rc = mca_mpool_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "mpool open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("mpool"); map->components = &mca_mpool_base_components; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != ompi_mtl_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "mpool"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = ompi_mtl_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "mtl open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("mtl"); map->components = &ompi_mtl_base_components_opened; opal_pointer_array_add(component_map, map); - - ompi_op_base_open(); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "mtl"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = ompi_op_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "op open"; + goto error; + } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("op"); map->components = &ompi_op_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != ompi_osc_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "op"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = ompi_osc_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "osc open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("osc"); map->components = &ompi_osc_base_open_components; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_pml_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "osc"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_pml_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "pml open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("pml"); map->components = &mca_pml_base_components_available; opal_pointer_array_add(component_map, map); - + if (OMPI_ERR_BAD_PARAM == rc) { + str = "pml"; + goto breakout; + } + /* No need to call the bml_base_open() because the ob1 pml calls it. * mca_bml_base_open(); */ @@ -256,49 +338,80 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, map->components = &mca_bml_base_components_available; opal_pointer_array_add(component_map, map); - if (OMPI_SUCCESS != ompi_pubsub_base_open()) { + if (OMPI_SUCCESS != (rc = ompi_pubsub_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "pubsub open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("pubsub"); map->components = &ompi_pubsub_base_components_available; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_rcache_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "pubsub"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_rcache_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "rcache open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("rcache"); map->components = &mca_rcache_base_components; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_sharedfp_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "rcache"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_sharedfp_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "sharedfp open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("sharedfp"); map->components = &mca_sharedfp_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_topo_base_open()) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "sharedfp"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_topo_base_open()) && + OMPI_ERR_BAD_PARAM != rc) { + str = "topo open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("topo"); map->components = &mca_topo_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != mca_vprotocol_base_open(NULL)) { + if (OMPI_ERR_BAD_PARAM == rc) { + str = "topo"; + goto breakout; + } + + if (OMPI_SUCCESS != (rc = mca_vprotocol_base_open(NULL)) && + OMPI_ERR_BAD_PARAM != rc) { + str = "vprotocol open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("vprotocol"); map->components = &mca_vprotocol_base_components_available; opal_pointer_array_add(component_map, map); + if (OMPI_ERR_BAD_PARAM == rc) { + str = "vprotocol"; + goto breakout; + } /* flag that we need to close components */ need_close_components = true; + breakout: /* Restore the environment to what it was before we started so that * if users setenv OMPI_MCA_ to some value, they'll * see that value when it is shown via --param output. @@ -310,18 +423,17 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, } } - /* All done */ - - opened_components = true; - return OMPI_SUCCESS; - -error: - fprintf(stderr, "%s\n", str); - fprintf(stderr, "ompi_info will likely not display all configuration information\n"); - if (need_close_components) { - opened_components = true; - ompi_info_close_components(); + if (OPAL_ERR_BAD_PARAM == rc) { + fprintf(stderr, "\nA \"bad parameter\" error was encountered when opening the OMPI %s framework\n", str); + fprintf(stderr, "The output received from that framework includes the following parameters:\n\n"); } + + opened_components = true; + return rc; + + error: + fprintf(stderr, "ompi_info_register: %s failed\n", str); + fprintf(stderr, "ompi_info will likely not display all configuration information\n"); return OMPI_ERROR; } @@ -338,12 +450,6 @@ void ompi_info_close_components() * error? */ - /* close the OPAL components */ - (void) opal_info_close_components(); - - /* close the ORTE components */ - (void) orte_info_close_components(); - #if OPAL_ENABLE_FT_CR == 1 (void) ompi_crcp_base_close(); #endif @@ -364,4 +470,7 @@ void ompi_info_close_components() (void) mca_coll_base_close(); (void) mca_allocator_base_close(); (void) ompi_osc_base_close(); + + /* close the ORTE components */ + (void) orte_info_close_components(); } diff --git a/ompi/tools/ompi_info/ompi_info.c b/ompi/tools/ompi_info/ompi_info.c index 9891319b55..e04defc602 100644 --- a/ompi/tools/ompi_info/ompi_info.c +++ b/ompi/tools/ompi_info/ompi_info.c @@ -137,17 +137,31 @@ int main(int argc, char *argv[]) /* Register OPAL's params */ if (OPAL_SUCCESS != (ret = opal_info_register_components(&mca_types, &component_map))) { - exit(ret); + if (OPAL_ERR_BAD_PARAM == ret) { + /* output where the error occurred */ + opal_info_err_params(&component_map); + } + exit(1); } /* Register ORTE's params */ if (ORTE_SUCCESS != (ret = orte_info_register_components(&mca_types, &component_map))) { - exit(ret); + if (OPAL_ERR_BAD_PARAM == ret) { + /* output what we got */ + opal_info_do_params(true, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"), + &mca_types, NULL); + } + exit(1); } /* Register OMPI's params */ if (OMPI_SUCCESS != (ret = ompi_info_register_components(&mca_types, &component_map))) { - exit(ret); + if (OMPI_ERR_BAD_PARAM == ret) { + /* output what we got */ + opal_info_do_params(true, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"), + &mca_types, NULL); + } + exit(1); } /* Execute the desired action(s) */ @@ -219,6 +233,10 @@ int main(int argc, char *argv[]) OBJ_DESTRUCT(&component_map); opal_info_finalize(); + + /* Put our own call to opal_finalize_util() here because we called + it up above (and it refcounts) */ + opal_finalize_util(); return 0; } diff --git a/opal/mca/base/mca_base_components_open.c b/opal/mca/base/mca_base_components_open.c index 2feca0a605..1d69b5990b 100644 --- a/opal/mca/base/mca_base_components_open.c +++ b/opal/mca/base/mca_base_components_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ @@ -387,7 +387,7 @@ static int open_components(const char *type_name, int output_id, component->mca_component_name); } else { ret = component->mca_register_component_params(); - if (MCA_SUCCESS == ret) { + if (OPAL_SUCCESS == ret) { registered = true; opal_output_verbose(10, output_id, "mca: base: components_open: " @@ -427,7 +427,7 @@ static int open_components(const char *type_name, int output_id, } else { called_open = true; ret = component->mca_open_component(); - if (MCA_SUCCESS == ret) { + if (OPAL_SUCCESS == ret) { opened = true; opal_output_verbose(10, output_id, "mca: base: components_open: " diff --git a/opal/mca/hwloc/base/hwloc_base_open.c b/opal/mca/hwloc/base/hwloc_base_open.c index 344e8cccca..5d7e3c0828 100644 --- a/opal/mca/hwloc/base/hwloc_base_open.c +++ b/opal/mca/hwloc/base/hwloc_base_open.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -213,7 +213,7 @@ int opal_hwloc_base_open(void) /* error - cannot redefine the default ranking policy */ opal_show_help("help-opal-hwloc-base.txt", "redefining-policy", true, "core", opal_hwloc_base_print_binding(opal_hwloc_binding_policy)); - return OPAL_ERR_SILENT; + return OPAL_ERR_BAD_PARAM; } OPAL_SET_BINDING_POLICY(opal_hwloc_binding_policy, OPAL_BIND_TO_CORE); opal_hwloc_binding_policy |= OPAL_BIND_GIVEN; diff --git a/opal/mca/mca.h b/opal/mca/mca.h index 643ca5969c..0eb6c8db02 100644 --- a/opal/mca/mca.h +++ b/opal/mca/mca.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -110,8 +110,7 @@ typedef struct mca_base_module_2_0_0_t mca_base_module_2_0_0_t; /** * MCA component open function. * - * @retval MCA_SUCCESS (or OPAL_SUCCESS or ORTE_SUCCESS or - * OMPI_SUCCESS) This component can be used in the process. + * @retval OPAL_SUCCESS This component can be used in the process. * * @retval OPAL_ERR_NOT_AVAILABLE Silently ignore this component for * the duration of the process (it may even be unloaded from the @@ -122,19 +121,19 @@ typedef struct mca_base_module_2_0_0_t mca_base_module_2_0_0_t; * be unloaded from the process). * * All MCA components can have an "open" function that is invoked once - * per process, when the component is located and loaded. This function - * should register any MCA parameters (using - * mca_base_param_register_int() and mca_base_param_register_string()) - * that will be used by the component. Parameter registrations should - * occur in this function because the ompi_info command can be used by - * users to display all available MCA parameters (and their default - * values). However, the ompi_info command \em only invokes this open - * function on all components (i.e., no other component API methods). + * per process, when the component is located and loaded. + * + * This function should avoid registering MCA parameters (use the + * component "register" function for that; i.e., + * mca_base_register_component_params_2_0_0_fn_t for that). Legacy + * components still register MCA params in their component "open" + * function, but their authors should update them to use the component + * "register" function. * * This function can also be used to allocate any resources necessary * for the component (e.g., heap memory). * - * This function should return MCA_SUCCESS if it wishes to remain + * This function should return OPAL_SUCCESS if it wishes to remain * loaded in the process. Any other return value will cause the MCA * base to unload the component. Although most components do not use * this mechanism to force themselves to be unloaded (because if they @@ -145,14 +144,14 @@ typedef struct mca_base_module_2_0_0_t mca_base_module_2_0_0_t; * resources to allocate, and c) can always be used in a process * (albiet perhaps not selected), it may provide NULL for this * function. In this cause, the MCA will act as if it called the open - * function and it returned MCA_SUCCESS. + * function and it returned OPAL_SUCCESS. */ typedef int (*mca_base_open_component_1_0_0_fn_t)(void); /** * MCA component close function. * - * @retval MCA_SUCCESS The component successfully shut down. + * @retval OPAL_SUCCESS The component successfully shut down. * * @retval any_other_value Some error occurred, but is likely to be * ignored. @@ -168,7 +167,7 @@ typedef int (*mca_base_open_component_1_0_0_fn_t)(void); * * If the component has no resources to free, it may provide NULL for * this function. In this case, the MCA will act as if it called the - * close function and it returned MCA_SUCCESS. + * close function and it returned OPAL_SUCCESS. */ typedef int (*mca_base_close_component_1_0_0_fn_t)(void); @@ -194,8 +193,10 @@ typedef int (*mca_base_query_component_2_0_0_fn_t)(mca_base_module_2_0_0_t **mod /** * MCA component parameter registration function. * - * @retval MCA_SUCCESS This component successfully registered its + * @retval OPAL_SUCCESS This component successfully registered its * parameters and can be used in this process. + * @retval OPAL_ERR_BAD_PARAM Indicates that the register function + * failed because an MCA parameter got an invalid/incorrect value. * * @retval anything_else The MCA will ignore this component for the * duration of the process. @@ -214,18 +215,27 @@ typedef int (*mca_base_query_component_2_0_0_fn_t)(mca_base_module_2_0_0_t **mod * function invoked on a component; component authors should take care * that no resources are leaked in this case. * - * This function should return MCA_SUCCESS if it wishes to remain + * This function should return OPAL_SUCCESS if it wishes to remain * loaded in the process. Any other return value will cause the MCA * base to unload the component. Although most components do not use * this mechanism to force themselves to be unloaded (because if they * are immediately unloaded, ompi_info will not display them), the * mechanism is available should the need arise. * + * Note that if the function returns OPAL_ERR_BAD_PARAM, it is + * possible (likely?) that the component didn't register all of its + * parameters. When this happens, ompi_info (and friends) will stop + * execution and print out all existing registered parameters from the + * entire framework (since ompi_info doesn't track individual + * component register failures). This allows a user to know exactly + * what value is incorrect, and from where it was set (e.g., via an + * MCA params file). + * * If the component a) has no MCA parameters to register, b) no * resources to allocate, and c) can always be used in a process * (albiet perhaps not selected), it may provide NULL for this * function. In this cause, the MCA will act as if it called the - * registration function and it returned MCA_SUCCESS. + * registration function and it returned OPAL_SUCCESS. */ typedef int (*mca_base_register_component_params_2_0_0_fn_t)(void); @@ -334,28 +344,4 @@ typedef struct mca_base_component_data_2_0_0_t mca_base_component_data_2_0_0_t; #define MCA_BASE_VERSION_2_0_0 MCA_BASE_VERSION_MAJOR, MCA_BASE_VERSION_MINOR, MCA_BASE_VERSION_RELEASE -/** - * MCA return codes. - */ -enum { - MCA_SUCCESS = 0, - /**< Success. */ - MCA_ERROR = -1, - /**< General error. */ - MCA_ERR_OUT_OF_RESOURCE = -2, - /**< Out of resources; a fatal error. */ - MCA_ERR_TEMP_OUT_OF_RESOURCE = -3, - /**< Out of resources; try again later. */ - MCA_ERR_BAD_PARAM = -5, - /**< Equivalent to MPI_ERR_ARG error code. */ - MCA_ERR_NOT_IMPLEMENTED = -10, - /**< Returned by functions or functionality that has not yet been - implemented */ - MCA_ERR_NOT_SUPPORTED = -11, - /**< Returned by functionality that is not supported. */ - - MCA_MAX_ERROR = -20 - /**< Maximum error code. */ -}; - #endif /* OPAL_MCA_H */ diff --git a/opal/runtime/opal_info_support.c b/opal/runtime/opal_info_support.c index c1983cce28..700b1064f9 100644 --- a/opal/runtime/opal_info_support.c +++ b/opal/runtime/opal_info_support.c @@ -251,7 +251,7 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, { opal_info_component_map_t *map; char *env, *str; - int i; + int i, rc; char *target, *save, *type; char **env_save=NULL; @@ -278,52 +278,77 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, } /* some components require the event library be active, so activate it */ - if (OPAL_SUCCESS != opal_event_base_open()) { + if (OPAL_SUCCESS != (rc = opal_event_base_open())) { + if (OPAL_ERR_BAD_PARAM == rc) { + goto breakout; + } str = "opal_event_base_open"; goto error; } /* Open the DSS */ - if (OPAL_SUCCESS != opal_dss_open()) { - str = "Unable to initialize the DSS"; + if (OPAL_SUCCESS != (rc = opal_dss_open())) { + if (OPAL_ERR_BAD_PARAM == rc) { + str = "opal_dss"; + goto breakout; + } + str = "dss_open"; goto error; } /* Register the OPAL layer's MCA parameters */ - if (OPAL_SUCCESS != opal_register_params()) { - str = "opal_register_params failed"; + if (OPAL_SUCCESS != (rc = opal_register_params())) { + str = "opal_register_params"; + if (OPAL_ERR_BAD_PARAM == rc) { + goto breakout; + } goto error; } /* OPAL frameworks */ - if (OPAL_SUCCESS != opal_backtrace_base_open()) { - str = "backtrace open failed"; + if (OPAL_SUCCESS != (rc = opal_backtrace_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "backtrace open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("backtrace"); map->components = &opal_backtrace_base_components_opened; opal_pointer_array_add(component_map, map); - + if (OPAL_ERR_BAD_PARAM == rc) { + str = "backtrace"; + goto breakout; + } + #if OPAL_ENABLE_FT_CR == 1 - if (OPAL_SUCCESS != opal_compress_base_open()) { - str = "compress open failed"; + if (OPAL_SUCCESS != (rc = opal_compress_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "compress open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("compress"); map->components = &opal_compress_base_components_available; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "compress"; + goto breakout; + } - if (OPAL_SUCCESS != opal_crs_base_open()) { - str = "crs open failed"; + if (OPAL_SUCCESS != (rc = opal_crs_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "crs open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("crs"); map->components = &opal_crs_base_components_available; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "crs"; + goto breakout; + } #endif /* the event framework is already open - just get its components */ @@ -333,24 +358,34 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, opal_pointer_array_add(component_map, map); #if OPAL_HAVE_HWLOC - if (OPAL_SUCCESS != opal_hwloc_base_open()) { - str = "hwloc open failed"; + if (OPAL_SUCCESS != (rc = opal_hwloc_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "hwloc open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("hwloc"); map->components = &opal_hwloc_base_components; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "hwloc"; + goto breakout; + } #endif - if (OPAL_SUCCESS != opal_if_base_open()) { - str = "if open failed"; + if (OPAL_SUCCESS != (rc = opal_if_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "if open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("if"); map->components = &opal_if_components; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "if"; + goto breakout; + } /* OPAL's installdirs base open has already been called as part of * opal_init_util() back in main(). @@ -360,51 +395,76 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, map->components = &opal_installdirs_components; opal_pointer_array_add(component_map, map); - if (OPAL_SUCCESS != opal_memory_base_open()) { - str = "memory open failed"; + if (OPAL_SUCCESS != (rc = opal_memory_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "memory open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("memory"); map->components = &opal_memory_base_components_opened; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "memory"; + goto breakout; + } - if (OPAL_SUCCESS != opal_memcpy_base_open()) { - str = "memcpy open failed"; + if (OPAL_SUCCESS != (rc = opal_memcpy_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "memcpy open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("memcpy"); map->components = &opal_memcpy_base_components_opened; opal_pointer_array_add(component_map, map); + if (OPAL_ERR_BAD_PARAM == rc) { + str = "memcpy"; + goto breakout; + } - if (OPAL_SUCCESS != opal_memchecker_base_open()) { - str = "memchecker open failed"; + if (OPAL_SUCCESS != (rc = opal_memchecker_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "memchecker open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("memchecker"); map->components = &opal_memchecker_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OPAL_SUCCESS != opal_shmem_base_open()) { - str = "shmem open failed"; + if (OPAL_ERR_BAD_PARAM == rc) { + str = "memchecker"; + goto breakout; + } + + if (OPAL_SUCCESS != (rc = opal_shmem_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "shmem open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("shmem"); map->components = &opal_shmem_base_components_opened; opal_pointer_array_add(component_map, map); - - if (OPAL_SUCCESS != opal_timer_base_open()) { - str = "timer open failed"; + if (OPAL_ERR_BAD_PARAM == rc) { + str = "shmem"; + goto breakout; + } + + if (OPAL_SUCCESS != (rc = opal_timer_base_open()) && + OPAL_ERR_BAD_PARAM != rc) { + str = "timer open"; goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("timer"); map->components = &opal_timer_base_components_opened; opal_pointer_array_add(component_map, map); - + if (OPAL_ERR_BAD_PARAM == rc) { + str = "timer"; + } + + breakout: /* Restore the environment to what it was before we started so that * if users setenv OMPI_MCA_ to some value, they'll * see that value when it is shown via --param output. @@ -416,13 +476,19 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, } } - return OPAL_SUCCESS; + if (OPAL_ERR_BAD_PARAM == rc) { + fprintf(stderr, "\nA \"bad parameter\" error was encountered when opening the OPAL %s framework.\n", str); + fprintf(stderr, "The output received from that framework includes the following parameters:\n\n"); + } + + return rc; error: - fprintf(stderr, "opal_info_register: %s\n", str); + fprintf(stderr, "opal_info_register: %s failed\n", str); return OPAL_ERROR; } + void opal_info_close_components(void) { (void) opal_backtrace_base_close(); @@ -440,10 +506,11 @@ void opal_info_close_components(void) (void) opal_event_base_close(); /* Do not call OPAL's installdirs close; it will be handled in - * opal_finalize_util(). + * opal_finalize_util(). Ditto for opal_if_base_close(). */ } + void opal_info_show_path(const char *type, const char *value) { char *pretty, *path; @@ -573,8 +640,8 @@ void opal_info_do_params(bool want_all_in, bool want_internal, if (want_all_in) { want_all = true; } else { - /* See if the special param "all" was givin to --param; that - * superceeds any individual type + /* See if the special param "all" was given to --param; that + * supercedes any individual type */ count = opal_cmd_line_get_ninsts(opal_info_cmd_line, p); for (i = 0; i < count; ++i) { @@ -628,6 +695,27 @@ void opal_info_do_params(bool want_all_in, bool want_internal, mca_base_param_dump_release(info); } +void opal_info_err_params(opal_pointer_array_t *component_map) +{ + opal_info_component_map_t *map, *mptr; + int i; + opal_list_t *info=NULL; + + /* all we want to do is display the LAST entry in the + * component_map array as this is the one that generated the error + */ + for (i=0; i < component_map->size; i++) { + if (NULL == (mptr = (opal_info_component_map_t*)opal_pointer_array_get_item(component_map, i))) { + continue; + } + map = mptr; + } + mca_base_param_dump(&info, true); + opal_info_show_mca_params(info, map->type, opal_info_component_all, true); + fprintf(stderr, "\n"); + return; +} + void opal_info_show_mca_params(opal_list_t *info, const char *type, const char *component, bool want_internal) @@ -640,7 +728,7 @@ void opal_info_show_mca_params(opal_list_t *info, mca_base_param_source_t source; char *src_file; - for (i = opal_list_get_first(info); i != opal_list_get_last(info); + for (i = opal_list_get_first(info); i != opal_list_get_end(info); i = opal_list_get_next(i)) { p = (mca_base_param_info_t*) i; diff --git a/opal/runtime/opal_info_support.h b/opal/runtime/opal_info_support.h index 7a35ecd779..f733b2cc3d 100644 --- a/opal/runtime/opal_info_support.h +++ b/opal/runtime/opal_info_support.h @@ -64,6 +64,7 @@ OPAL_DECLSPEC int opal_info_register_components(opal_pointer_array_t *mca_types, opal_pointer_array_t *component_map); OPAL_DECLSPEC void opal_info_close_components(void); +OPAL_DECLSPEC void opal_info_err_params(opal_pointer_array_t *component_map); OPAL_DECLSPEC void opal_info_do_params(bool want_all_in, bool want_internal, opal_pointer_array_t *mca_type, diff --git a/orte/runtime/orte_info_support.c b/orte/runtime/orte_info_support.c index 73011d0085..e7c2d0dfbc 100644 --- a/orte/runtime/orte_info_support.c +++ b/orte/runtime/orte_info_support.c @@ -87,7 +87,7 @@ int orte_info_register_components(opal_pointer_array_t *mca_types, { opal_info_component_map_t *map; char *env, *str; - int i; + int i, rc; char *target, *save, *type; char **env_save=NULL; @@ -113,157 +113,262 @@ int orte_info_register_components(opal_pointer_array_t *mca_types, free(env); } - /* Set orte_process_info.proc_type to HNP to force all frameworks to + /* Set orte_process_info.proc_type to HNP to force all frameworks to * open components */ orte_process_info.proc_type = ORTE_PROC_HNP; /* Register the ORTE layer's MCA parameters */ - if (ORTE_SUCCESS != orte_register_params()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_register_params()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "orte_register_params"; + goto error; } - if (ORTE_SUCCESS != orte_db_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_db_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "db_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("db"); map->components = &orte_db_base.available_components; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_errmgr_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "db"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_errmgr_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "errmgr_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("errmgr"); map->components = &orte_errmgr_base_components_available; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_ess_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "errmgr"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_ess_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "ess_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("ess"); map->components = &orte_ess_base_components_available; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_filem_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "ess"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_filem_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "filem_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("filem"); map->components = &orte_filem_base_components_available; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "filem"; + goto breakout; + } - if (ORTE_SUCCESS != orte_grpcomm_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_grpcomm_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "grpcomm_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("grpcomm"); map->components = &orte_grpcomm_base.components_available; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_iof_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "grpcomm"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_iof_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "iof_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("iof"); map->components = &orte_iof_base.iof_components_opened; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_odls_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "iof"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_odls_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "odls_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("odls"); map->components = &orte_odls_base.available_components; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != mca_oob_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "odls"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = mca_oob_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "oob_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("oob"); map->components = &mca_oob_base_components; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_plm_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "oob"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_plm_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "plm_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("plm"); map->components = &orte_plm_base.available_components; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "plm"; + goto breakout; + } - if (ORTE_SUCCESS != orte_ras_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_ras_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "ras_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("ras"); map->components = &orte_ras_base.ras_opened; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_rmaps_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "ras"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_rmaps_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "rmaps_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("rmaps"); map->components = &orte_rmaps_base.available_components; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_routed_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "rmaps"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_routed_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "routed_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("routed"); map->components = &orte_routed_base_components; opal_pointer_array_add(component_map, map); - - if (ORTE_SUCCESS != orte_rml_base_open()) { - return ORTE_ERROR; + if (ORTE_ERR_BAD_PARAM == rc) { + str = "routed"; + goto breakout; + } + + if (ORTE_SUCCESS != (rc = orte_rml_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "rml_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("rml"); map->components = &orte_rml_base_components; opal_pointer_array_add(component_map, map); - + if (ORTE_ERR_BAD_PARAM == rc) { + str = "rml"; + goto breakout; + } + #if ORTE_ENABLE_SENSORS - if (ORTE_SUCCESS != orte_sensor_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_sensor_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "sensor_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("sensor"); map->components = &mca_sensor_base_components_available; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "sensor"; + goto breakout; + } #endif #if OPAL_ENABLE_FT_CR == 1 - if (ORTE_SUCCESS != orte_snapc_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_snapc_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "snapc_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("snapc"); map->components = &orte_snapc_base_components_available; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "snapc"; + goto breakout; + } - if (ORTE_SUCCESS != orte_sstore_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_sstore_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "sstore_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("sstore"); map->components = &orte_sstore_base_components_available; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "sstore"; + goto breakout; + } #endif - if (ORTE_SUCCESS != orte_state_base_open()) { - return ORTE_ERROR; + if (ORTE_SUCCESS != (rc = orte_state_base_open()) && + ORTE_ERR_BAD_PARAM != rc) { + str = "state_base_open"; + goto error; } map = OBJ_NEW(opal_info_component_map_t); map->type = strdup("state"); map->components = &orte_state_base_components_available; opal_pointer_array_add(component_map, map); + if (ORTE_ERR_BAD_PARAM == rc) { + str = "state"; + goto breakout; + } + breakout: /* Restore the environment to what it was before we started so that * if users setenv OMPI_MCA_ to some value, they'll * see that value when it is shown via --param output. @@ -274,7 +379,17 @@ int orte_info_register_components(opal_pointer_array_t *mca_types, putenv(env_save[i]); } } - return ORTE_SUCCESS; + + if (ORTE_ERR_BAD_PARAM == rc) { + fprintf(stderr, "\nA \"bad parameter\" error was encountered when opening the ORTE %s framework\n", str); + fprintf(stderr, "The output received from that framework includes the following parameters:\n\n"); + } + + return rc; + + error: + fprintf(stderr, "orte_info_register: %s failed\n", str); + return ORTE_ERROR; } void orte_info_close_components(void) diff --git a/orte/tools/orte-info/components.c b/orte/tools/orte-info/components.c index 6f857787db..a09a5ad8fc 100644 --- a/orte/tools/orte-info/components.c +++ b/orte/tools/orte-info/components.c @@ -27,7 +27,7 @@ #include "orte/runtime/runtime.h" #include "opal/util/argv.h" - +#include "opal/runtime/opal_info_support.h" #include "opal/mca/event/base/base.h" #include "opal/util/output.h" #include "opal/mca/base/base.h" @@ -528,6 +528,9 @@ void orte_info_close_components() } } OBJ_DESTRUCT(&component_map); + + /* close the OPAL components */ + (void) opal_info_close_components(); } opened_components = false;