From 468800996bf4e4ebe32c93897427e9964dc1be5f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 5 May 2009 03:54:58 +0000 Subject: [PATCH] Make it possible to no-build the carto framework Could swear we had done this before...but I guess not! This commit was SVN r21150. --- opal/mca/carto/base/base.h | 3 +++ opal/mca/carto/base/carto_base_open.c | 30 +++++++++++++++++++++++++ opal/mca/carto/base/carto_base_select.c | 9 +++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/opal/mca/carto/base/base.h b/opal/mca/carto/base/base.h index edfbf0e8b7..60f81a441a 100644 --- a/opal/mca/carto/base/base.h +++ b/opal/mca/carto/base/base.h @@ -194,6 +194,9 @@ OPAL_DECLSPEC extern int opal_carto_base_output; OPAL_DECLSPEC extern opal_carto_graph_t *opal_carto_base_common_host_graph; +OPAL_DECLSPEC extern opal_carto_base_module_1_0_0_t opal_carto_default_module; + + END_C_DECLS #endif /* OPAL_BASE_CARTO_H */ diff --git a/opal/mca/carto/base/carto_base_open.c b/opal/mca/carto/base/carto_base_open.c index 7f310c6b11..00c418f8bd 100644 --- a/opal/mca/carto/base/carto_base_open.c +++ b/opal/mca/carto/base/carto_base_open.c @@ -26,6 +26,7 @@ #include "opal/mca/base/base.h" #include "opal/mca/base/mca_base_param.h" #include "opal/mca/carto/carto.h" +#include "opal/mca/carto/base/carto_base_graph.h" #include "opal/mca/carto/base/base.h" @@ -45,6 +46,35 @@ bool opal_carto_base_components_opened_valid = false; opal_list_t opal_carto_base_components_opened; opal_carto_graph_t *opal_carto_base_common_host_graph=NULL; +/* + * default carto module when no components are found + */ +static int opal_carto_default_init(void) +{ + /* create an empty graph */ + if (NULL == opal_carto_base_common_host_graph) { + opal_carto_base_graph_create_fn(&opal_carto_base_common_host_graph); + } + return OPAL_SUCCESS; +} +static int opal_carto_default_finalize(void) +{ + /* free the host cartography graph. */ + if (NULL != opal_carto_base_common_host_graph) { + opal_carto_base_free_graph_fn(opal_carto_base_common_host_graph); + } + return OPAL_SUCCESS; +} + +opal_carto_base_module_1_0_0_t opal_carto_default_module = { + opal_carto_default_init, + opal_carto_base_graph_get_host_graph_fn, + opal_carto_base_free_graph_fn, + opal_carto_base_get_nodes_distance_fn, + opal_carto_base_graph_spf_fn, + opal_carto_base_graph_find_node_fn, + opal_carto_default_finalize, +}; /* * Function for finding and opening either all MCA components, or the one diff --git a/opal/mca/carto/base/carto_base_select.c b/opal/mca/carto/base/carto_base_select.c index 7b796c3c95..45912fb3d9 100644 --- a/opal/mca/carto/base/carto_base_select.c +++ b/opal/mca/carto/base/carto_base_select.c @@ -48,8 +48,11 @@ int opal_carto_base_select(void) &opal_carto_base_components_opened, (mca_base_module_t **) &best_module, (mca_base_component_t **) &best_component) ) { - /* This will only happen if no component was selected */ - exit_status = OPAL_ERR_NOT_FOUND; + /* This will only happen if no component was selected, so + * use the default module instead + */ + opal_carto_base_module = &opal_carto_default_module; + opal_carto_base_selected = true; goto cleanup; } @@ -58,6 +61,7 @@ int opal_carto_base_select(void) opal_carto_base_module = best_module; opal_carto_base_selected = true; +cleanup: /* Initialize the winner */ if (NULL != opal_carto_base_module) { if (OPAL_SUCCESS != (ret = opal_carto_base_module->carto_module_init()) ) { @@ -66,7 +70,6 @@ int opal_carto_base_select(void) } } - cleanup: return exit_status; }