1
1

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.
Этот коммит содержится в:
Ralph Castain 2009-05-05 03:54:58 +00:00
родитель e615af8b80
Коммит 468800996b
3 изменённых файлов: 39 добавлений и 3 удалений

Просмотреть файл

@ -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_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 END_C_DECLS
#endif /* OPAL_BASE_CARTO_H */ #endif /* OPAL_BASE_CARTO_H */

Просмотреть файл

@ -26,6 +26,7 @@
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
#include "opal/mca/carto/carto.h" #include "opal/mca/carto/carto.h"
#include "opal/mca/carto/base/carto_base_graph.h"
#include "opal/mca/carto/base/base.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_list_t opal_carto_base_components_opened;
opal_carto_graph_t *opal_carto_base_common_host_graph=NULL; 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 * Function for finding and opening either all MCA components, or the one

Просмотреть файл

@ -48,8 +48,11 @@ int opal_carto_base_select(void)
&opal_carto_base_components_opened, &opal_carto_base_components_opened,
(mca_base_module_t **) &best_module, (mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component) ) { (mca_base_component_t **) &best_component) ) {
/* This will only happen if no component was selected */ /* This will only happen if no component was selected, so
exit_status = OPAL_ERR_NOT_FOUND; * use the default module instead
*/
opal_carto_base_module = &opal_carto_default_module;
opal_carto_base_selected = true;
goto cleanup; goto cleanup;
} }
@ -58,6 +61,7 @@ int opal_carto_base_select(void)
opal_carto_base_module = best_module; opal_carto_base_module = best_module;
opal_carto_base_selected = true; opal_carto_base_selected = true;
cleanup:
/* Initialize the winner */ /* Initialize the winner */
if (NULL != opal_carto_base_module) { if (NULL != opal_carto_base_module) {
if (OPAL_SUCCESS != (ret = opal_carto_base_module->carto_module_init()) ) { 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; return exit_status;
} }