1
1
openmpi/orte/mca/ras/localhost/ras_localhost_module.c
Brian Barrett 5b9fa7e998 reapply r15517 and r15520, which were removed in r15527 so that I could get
the RML/OOB merge in slightly easier

This commit was SVN r15530.

The following SVN revision numbers were found above:
  r15517 --> open-mpi/ompi@41977fcc95
  r15520 --> open-mpi/ompi@9cbc9df1b8
  r15527 --> open-mpi/ompi@2d17dd9516
2007-07-20 02:34:29 +00:00

158 строки
4.4 KiB
C

/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/orte_constants.h"
#include "orte/orte_types.h"
#include "opal/class/opal_list.h"
#include "opal/util/output.h"
#include "orte/dss/dss.h"
#include "orte/util/sys_info.h"
#include "orte/mca/ras/base/ras_private.h"
#include "orte/mca/rmgr/base/base.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/util/proc_info.h"
#include "orte/mca/ras/localhost/ras_localhost.h"
/*
* Local functions
*/
static int orte_ras_localhost_allocate(orte_jobid_t jobid, opal_list_t *attributes);
static int orte_ras_localhost_deallocate(orte_jobid_t jobid);
static int orte_ras_localhost_finalize(void);
/*
* Local variables
*/
orte_ras_base_module_t orte_ras_localhost_module = {
orte_ras_localhost_allocate,
orte_ras_base_node_insert,
orte_ras_base_node_query,
orte_ras_base_node_query_alloc,
orte_ras_base_node_lookup,
orte_ras_base_proc_query_alloc,
orte_ras_localhost_deallocate,
orte_ras_localhost_finalize
};
orte_ras_base_module_t *orte_ras_localhost_init(int* priority)
{
/* if we are not an HNP, then we must not be selected */
if (!orte_process_info.seed) {
return NULL;
}
*priority = mca_ras_localhost_component.priority;
return &orte_ras_localhost_module;
}
static int orte_ras_localhost_allocate(orte_jobid_t jobid, opal_list_t *attributes)
{
bool empty;
int ret;
opal_list_t nodes;
orte_ras_node_t *node;
opal_list_item_t *item;
/* If the node segment is not empty, do nothing */
if (ORTE_SUCCESS != (ret = orte_ras_base_node_segment_empty(&empty))) {
ORTE_ERROR_LOG(ret);
return ret;
}
if (!empty) {
opal_output(orte_ras_base.ras_output,
"orte:ras:localhost: node segment not empty; not doing anything");
return ORTE_SUCCESS;
}
opal_output(orte_ras_base.ras_output,
"orte:ras:localhost: node segment empty; adding \"localhost\"");
/* Ok, the node segment is empty -- so add a localhost node */
node = OBJ_NEW(orte_ras_node_t);
if (NULL == node) {
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* use the same name we got in orte_system_info so we avoid confusion in
* the session directories
*/
node->node_name = strdup(orte_system_info.nodename);
node->node_arch = NULL;
node->node_state = ORTE_NODE_STATE_UP;
node->node_slots_inuse = 0;
node->node_slots_max = 0;
node->node_slots = 1;
OBJ_CONSTRUCT(&nodes, opal_list_t);
opal_list_append(&nodes, &node->super);
/* Put it on the segment and allocate it */
if (ORTE_SUCCESS !=
(ret = orte_ras_base_node_insert(&nodes)) ||
ORTE_SUCCESS !=
(ret = orte_ras_base_allocate_nodes(jobid, &nodes))) {
goto cleanup;
}
/* now indicate that there is uncertainty about the number of slots here,
* so the launcher should use knowledge of the local number of processors to
* override any oversubscription flags
*/
ret = orte_ras_base_set_oversubscribe_override(jobid);
if (ORTE_SUCCESS != ret) {
goto cleanup;
}
cleanup:
item = opal_list_remove_first(&nodes);
OBJ_RELEASE(item);
OBJ_DESTRUCT(&nodes);
/* All done */
return ret;
}
static int orte_ras_localhost_deallocate(orte_jobid_t jobid)
{
/* Nothing to do */
opal_output(orte_ras_base.ras_output,
"ras:localhost:deallocate: success (nothing to do)");
return ORTE_SUCCESS;
}
static int orte_ras_localhost_finalize(void)
{
/* Nothing to do */
opal_output(orte_ras_base.ras_output,
"ras:localhost:finalize: success (nothing to do)");
return ORTE_SUCCESS;
}