2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2008-05-06 22:08:45 +04:00
|
|
|
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-04-12 08:55:23 +04:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-12-22 17:29:45 +03:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2007-04-12 08:55:23 +04:00
|
|
|
#include "opal/mca/base/mca_base_component_repository.h"
|
2006-10-02 04:46:31 +04:00
|
|
|
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/plm/base/plm_private.h"
|
|
|
|
#include "orte/mca/plm/base/base.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/**
|
|
|
|
* Function for selecting one component from all those that are
|
2005-03-14 23:57:21 +03:00
|
|
|
* available.
|
|
|
|
*/
|
2005-04-01 03:25:24 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int orte_plm_base_select(void)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
2008-06-06 18:38:41 +04:00
|
|
|
int exit_status = ORTE_SUCCESS;
|
2008-05-06 22:08:45 +04:00
|
|
|
orte_plm_base_component_t *best_component = NULL;
|
|
|
|
orte_plm_base_module_t *best_module = NULL;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-05-06 22:08:45 +04:00
|
|
|
/*
|
|
|
|
* Select the best component
|
2008-02-28 04:57:57 +03:00
|
|
|
*/
|
2008-06-06 18:38:41 +04:00
|
|
|
if( OPAL_SUCCESS != mca_base_select("plm", orte_plm_globals.output,
|
|
|
|
&orte_plm_base.available_components,
|
|
|
|
(mca_base_module_t **) &best_module,
|
|
|
|
(mca_base_component_t **) &best_component) ) {
|
2008-05-06 22:08:45 +04:00
|
|
|
/* This will only happen if no component was selected
|
|
|
|
*
|
|
|
|
* If we didn't find one, and we are a daemon, then default to retaining the proxy.
|
|
|
|
* Otherwise, if we didn't find one to select, that is unacceptable.
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
if (orte_process_info.daemon) {
|
|
|
|
/* don't record a selected component or flag selected
|
|
|
|
* so we finalize correctly - just leave the plm alone
|
|
|
|
* as it defaults to pointing at the proxy
|
|
|
|
*/
|
|
|
|
goto cleanup;
|
|
|
|
} else {
|
2008-05-06 22:08:45 +04:00
|
|
|
exit_status = ORTE_ERR_NOT_FOUND;
|
|
|
|
goto cleanup;
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
2005-04-01 03:25:24 +04:00
|
|
|
}
|
|
|
|
|
2008-05-06 22:08:45 +04:00
|
|
|
/* Save the winner */
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_plm = *best_module;
|
|
|
|
orte_plm_base.selected_component = *best_component;
|
|
|
|
orte_plm_base.selected = true;
|
2008-09-08 19:45:11 +04:00
|
|
|
|
2008-05-06 22:08:45 +04:00
|
|
|
cleanup:
|
|
|
|
return exit_status;
|
2005-04-01 03:25:24 +04:00
|
|
|
}
|