
*** THIS RFC INCLUDES A MINOR CHANGE TO THE MPI-RTE INTERFACE *** Note: during the course of this work, it was necessary to completely separate the MPI and RTE progress engines. There were multiple places in the MPI layer where ORTE_WAIT_FOR_COMPLETION was being used. A new OMPI_WAIT_FOR_COMPLETION macro was created (defined in ompi/mca/rte/rte.h) that simply cycles across opal_progress until the provided flag becomes false. Places where the MPI layer blocked waiting for RTE to complete an event have been modified to use this macro. *************************************************************************************** I am reissuing this RFC because of the time that has passed since its original release. Since its initial release and review, I have debugged it further to ensure it fully supports tests like loop_spawn. It therefore seems ready for merge back to the trunk. Given its prior review, I have set the timeout for one week. The code is in https://bitbucket.org/rhc/ompi-oob2 WHAT: Rewrite of ORTE OOB WHY: Support asynchronous progress and a host of other features WHEN: Wed, August 21 SYNOPSIS: The current OOB has served us well, but a number of limitations have been identified over the years. Specifically: * it is only progressed when called via opal_progress, which can lead to hangs or recursive calls into libevent (which is not supported by that code) * we've had issues when multiple NICs are available as the code doesn't "shift" messages between transports - thus, all nodes had to be available via the same TCP interface. * the OOB "unloads" incoming opal_buffer_t objects during the transmission, thus preventing use of OBJ_RETAIN in the code when repeatedly sending the same message to multiple recipients * there is no failover mechanism across NICs - if the selected NIC (or its attached switch) fails, we are forced to abort * only one transport (i.e., component) can be "active" The revised OOB resolves these problems: * async progress is used for all application processes, with the progress thread blocking in the event library * each available TCP NIC is supported by its own TCP module. The ability to asynchronously progress each module independently is provided, but not enabled by default (a runtime MCA parameter turns it "on") * multi-address TCP NICs (e.g., a NIC with both an IPv4 and IPv6 address, or with virtual interfaces) are supported - reachability is determined by comparing the contact info for a peer against all addresses within the range covered by the address/mask pairs for the NIC. * a message that arrives on one TCP NIC is automatically shifted to whatever NIC that is connected to the next "hop" if that peer cannot be reached by the incoming NIC. If no TCP module will reach the peer, then the OOB attempts to send the message via all other available components - if none can reach the peer, then an "error" is reported back to the RML, which then calls the errmgr for instructions. * opal_buffer_t now conforms to standard object rules re OBJ_RETAIN as we no longer "unload" the incoming object * NIC failure is reported to the TCP component, which then tries to resend the message across any other available TCP NIC. If that doesn't work, then the message is given back to the OOB base to try using other components. If all that fails, then the error is reported to the RML, which reports to the errmgr for instructions * obviously from the above, multiple OOB components (e.g., TCP and UD) can be active in parallel * the matching code has been moved to the RML (and out of the OOB/TCP component) so it is independent of transport * routing is done by the individual OOB modules (as opposed to the RML). Thus, both routed and non-routed transports can simultaneously be active * all blocking send/recv APIs have been removed. Everything operates asynchronously. KNOWN LIMITATIONS: * although provision is made for component failover as described above, the code for doing so has not been fully implemented yet. At the moment, if all connections for a given peer fail, the errmgr is notified of a "lost connection", which by default results in termination of the job if it was a lifeline * the IPv6 code is present and compiles, but is not complete. Since the current IPv6 support in the OOB doesn't work anyway, I don't consider this a blocker * routing is performed at the individual module level, yet the active routed component is selected on a global basis. We probably should update that to reflect that different transports may need/choose to route in different ways * obviously, not every error path has been tested nor necessarily covered * determining abnormal termination is more challenging than in the old code as we now potentially have multiple ways of connecting to a process. Ideally, we would declare "connection failed" when *all* transports can no longer reach the process, but that requires some additional (possibly complex) code. For now, the code replicates the old behavior only somewhat modified - i.e., if a module sees its connection fail, it checks to see if it is a lifeline. If so, it notifies the errmgr that the lifeline is lost - otherwise, it notifies the errmgr that a non-lifeline connection was lost. * reachability is determined solely on the basis of a shared subnet address/mask - more sophisticated algorithms (e.g., the one used in the tcp btl) are required to handle routing via gateways * the RML needs to assign sequence numbers to each message on a per-peer basis. The receiving RML will then deliver messages in order, thus preventing out-of-order messaging in the case where messages travel across different transports or a message needs to be redirected/resent due to failure of a NIC This commit was SVN r29058.
524 строки
20 KiB
C
524 строки
20 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 (c) 2011-2012 Los Alamos National Security, LLC. All rights
|
|
* reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
|
|
#ifdef HAVE_STRING_H
|
|
#include <string.h>
|
|
#endif
|
|
|
|
#include "orte/constants.h"
|
|
#include "orte/types.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
#include "opal/mca/base/base.h"
|
|
#include "opal/class/opal_list.h"
|
|
#include "opal/util/output.h"
|
|
#include "opal/dss/dss.h"
|
|
#include "opal/util/argv.h"
|
|
|
|
#include "orte/util/show_help.h"
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
#include "orte/mca/rmaps/base/base.h"
|
|
#include "orte/util/name_fns.h"
|
|
#include "orte/runtime/orte_globals.h"
|
|
#include "orte/runtime/orte_wait.h"
|
|
#include "orte/util/hostfile/hostfile.h"
|
|
#include "orte/util/dash_host/dash_host.h"
|
|
#include "orte/util/proc_info.h"
|
|
#include "orte/util/comm/comm.h"
|
|
#include "orte/mca/state/state.h"
|
|
#include "orte/runtime/orte_quit.h"
|
|
|
|
#include "orte/mca/ras/base/ras_private.h"
|
|
|
|
/* function to display allocation */
|
|
void orte_ras_base_display_alloc(void)
|
|
{
|
|
char *tmp=NULL, *tmp2, *tmp3, *pfx=NULL;
|
|
int i, istart;
|
|
orte_node_t *alloc;
|
|
|
|
if (orte_xml_output) {
|
|
asprintf(&tmp, "<allocation>\n");
|
|
pfx = "\t";
|
|
} else {
|
|
asprintf(&tmp, "\n====================== ALLOCATED NODES ======================\n");
|
|
}
|
|
if (orte_hnp_is_allocated) {
|
|
istart = 0;
|
|
} else {
|
|
istart = 1;
|
|
}
|
|
for (i=istart; i < orte_node_pool->size; i++) {
|
|
if (NULL == (alloc = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, i))) {
|
|
continue;
|
|
}
|
|
opal_dss.print(&tmp2, pfx, alloc, ORTE_NODE);
|
|
if (NULL == tmp) {
|
|
tmp = tmp2;
|
|
} else {
|
|
asprintf(&tmp3, "%s%s", tmp, tmp2);
|
|
free(tmp);
|
|
free(tmp2);
|
|
tmp = tmp3;
|
|
}
|
|
}
|
|
if (orte_xml_output) {
|
|
fprintf(orte_xml_fp, "%s</allocation>\n", tmp);
|
|
fflush(orte_xml_fp);
|
|
} else {
|
|
opal_output(orte_clean_output, "%s\n\n=================================================================\n", tmp);
|
|
}
|
|
free(tmp);
|
|
}
|
|
|
|
/*
|
|
* Function for selecting one component from all those that are
|
|
* available.
|
|
*/
|
|
void orte_ras_base_allocate(int fd, short args, void *cbdata)
|
|
{
|
|
int rc;
|
|
orte_job_t *jdata;
|
|
opal_list_t nodes;
|
|
orte_node_t *node;
|
|
orte_std_cntr_t i;
|
|
orte_app_context_t *app;
|
|
orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata;
|
|
bool default_hostfile_used;
|
|
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
/* convenience */
|
|
jdata = caddy->jdata;
|
|
|
|
/* if we already did this, don't do it again - the pool of
|
|
* global resources is set.
|
|
*/
|
|
if (orte_ras_base.allocation_read) {
|
|
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate allocation already read",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
goto next_state;
|
|
}
|
|
orte_ras_base.allocation_read = true;
|
|
|
|
/* Otherwise, we have to create
|
|
* the initial set of resources that will delineate all
|
|
* further operations serviced by this HNP. This list will
|
|
* contain ALL nodes that can be used by any subsequent job.
|
|
*
|
|
* In other words, if a node isn't found in this step, then
|
|
* no job launched by this HNP will be able to utilize it.
|
|
*/
|
|
|
|
/* construct a list to hold the results */
|
|
OBJ_CONSTRUCT(&nodes, opal_list_t);
|
|
|
|
/* if a component was selected, then we know we are in a managed
|
|
* environment. - the active module will return a list of what it found
|
|
*/
|
|
if (NULL != orte_ras_base.active_module) {
|
|
/* read the allocation */
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base.active_module->allocate(jdata, &nodes))) {
|
|
if (ORTE_ERR_ALLOCATION_PENDING == rc) {
|
|
/* an allocation request is underway, so just do nothing */
|
|
OBJ_DESTRUCT(&nodes);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
if (ORTE_ERR_SYSTEM_WILL_BOOTSTRAP == rc) {
|
|
/* this module indicates that nodes will be discovered
|
|
* on a bootstrap basis, so all we do here is add our
|
|
* own node to the list
|
|
*/
|
|
goto addlocal;
|
|
}
|
|
if (ORTE_ERR_TAKE_NEXT_OPTION == rc) {
|
|
/* we have an active module, but it is unable to
|
|
* allocate anything for this job - this indicates
|
|
* that it isn't a fatal error, but could be if
|
|
* an allocation is required
|
|
*/
|
|
if (orte_allocation_required) {
|
|
/* an allocation is required, so this is fatal */
|
|
OBJ_DESTRUCT(&nodes);
|
|
orte_show_help("help-ras-base.txt", "ras-base:no-allocation", true);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
} else {
|
|
/* an allocation is not required, so we can just
|
|
* run on the local node - go add it
|
|
*/
|
|
goto addlocal;
|
|
}
|
|
}
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
}
|
|
/* If something came back, save it and we are done */
|
|
if (!opal_list_is_empty(&nodes)) {
|
|
/* store the results in the global resource pool - this removes the
|
|
* list items
|
|
*/
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base_node_insert(&nodes, jdata))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
OBJ_DESTRUCT(&nodes);
|
|
/* default to no-oversubscribe-allowed for managed systems */
|
|
if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) {
|
|
ORTE_SET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
|
|
}
|
|
/* flag that the allocation is managed */
|
|
orte_managed_allocation = true;
|
|
goto DISPLAY;
|
|
} else if (orte_allocation_required) {
|
|
/* if nothing was found, and an allocation is
|
|
* required, then error out
|
|
*/
|
|
OBJ_DESTRUCT(&nodes);
|
|
orte_show_help("help-ras-base.txt", "ras-base:no-allocation", true);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate nothing found in module - proceeding to hostfile",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
/* nothing was found, or no active module was alive. Our next
|
|
* option is to look for a hostfile and assign our global
|
|
* pool from there.
|
|
*
|
|
* Individual hostfile names, if given, are included
|
|
* in the app_contexts for this job. We therefore need to
|
|
* retrieve the app_contexts for the job, and then cycle
|
|
* through them to see if anything is there. The parser will
|
|
* add the nodes found in each hostfile to our list - i.e.,
|
|
* the resulting list contains the UNION of all nodes specified
|
|
* in hostfiles from across all app_contexts
|
|
*
|
|
* Any app that has no hostfile but has a dash-host, will have
|
|
* those nodes added to the list
|
|
*
|
|
* Any app that fails to have a hostfile or a dash-host will be given the
|
|
* default hostfile, if we have it
|
|
*
|
|
* Note that any relative node syntax found in the hostfiles will
|
|
* generate an error in this scenario, so only non-relative syntax
|
|
* can be present
|
|
*/
|
|
default_hostfile_used = false;
|
|
for (i=0; i < jdata->apps->size; i++) {
|
|
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) {
|
|
continue;
|
|
}
|
|
if (NULL != app->hostfile) {
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate adding hostfile %s",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
app->hostfile));
|
|
|
|
/* hostfile was specified - parse it and add it to the list */
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
|
|
app->hostfile))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
/* set an error event */
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
} else if (!orte_soft_locations && NULL != app->dash_host) {
|
|
/* if we are using soft locations, then any dash-host would
|
|
* just include desired nodes and not required. We don't want
|
|
* to pick them up here as this would mean the request was
|
|
* always satisfied - instead, we want to allow the request
|
|
* to fail later on and use whatever nodes are actually
|
|
* available
|
|
*/
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate adding dash_hosts",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
|
|
app->dash_host))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
} else if (!default_hostfile_used) {
|
|
if (NULL != orte_default_hostfile) {
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate parsing default hostfile %s",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
orte_default_hostfile));
|
|
|
|
/* a default hostfile was provided - parse it */
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
|
|
orte_default_hostfile))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
}
|
|
/* only look at it once */
|
|
default_hostfile_used = true;
|
|
}
|
|
}
|
|
|
|
/* if something was found in the hostfile(s), we use that as our global
|
|
* pool - set it and we are done
|
|
*/
|
|
if (!opal_list_is_empty(&nodes)) {
|
|
/* store the results in the global resource pool - this removes the
|
|
* list items
|
|
*/
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base_node_insert(&nodes, jdata))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
/* cleanup */
|
|
OBJ_DESTRUCT(&nodes);
|
|
goto DISPLAY;
|
|
}
|
|
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate nothing found in hostfiles - checking for rankfile",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
/* Our next option is to look for a rankfile - if one was provided, we
|
|
* will use its nodes to create a default allocation pool
|
|
*/
|
|
if (NULL != orte_rankfile) {
|
|
/* check the rankfile for node information */
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
|
|
orte_rankfile))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return ;
|
|
}
|
|
}
|
|
/* if something was found in rankfile, we use that as our global
|
|
* pool - set it and we are done
|
|
*/
|
|
if (!opal_list_is_empty(&nodes)) {
|
|
/* store the results in the global resource pool - this removes the
|
|
* list items
|
|
*/
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base_node_insert(&nodes, jdata))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
/* rankfile is considered equivalent to an RM allocation */
|
|
if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) {
|
|
ORTE_SET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE);
|
|
}
|
|
/* cleanup */
|
|
OBJ_DESTRUCT(&nodes);
|
|
goto DISPLAY;
|
|
}
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:allocate nothing found in rankfile - inserting current node",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
addlocal:
|
|
/* if nothing was found by any of the above methods, then we have no
|
|
* earthly idea what to do - so just add the local host
|
|
*/
|
|
node = OBJ_NEW(orte_node_t);
|
|
if (NULL == node) {
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
/* use the same name we got in orte_process_info so we avoid confusion in
|
|
* the session directories
|
|
*/
|
|
node->name = strdup(orte_process_info.nodename);
|
|
node->state = ORTE_NODE_STATE_UP;
|
|
node->slots_inuse = 0;
|
|
node->slots_max = 0;
|
|
node->slots = 1;
|
|
opal_list_append(&nodes, &node->super);
|
|
|
|
/* store the results in the global resource pool - this removes the
|
|
* list items
|
|
*/
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base_node_insert(&nodes, jdata))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
return;
|
|
}
|
|
OBJ_DESTRUCT(&nodes);
|
|
|
|
DISPLAY:
|
|
/* shall we display the results? */
|
|
if (4 < opal_output_get_verbosity(orte_ras_base_framework.framework_output)) {
|
|
orte_ras_base_display_alloc();
|
|
}
|
|
|
|
next_state:
|
|
/* are we to report this event? */
|
|
if (orte_report_events) {
|
|
if (ORTE_SUCCESS != (rc = orte_util_comm_report_event(ORTE_COMM_EVENT_ALLOCATE))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
|
|
OBJ_RELEASE(caddy);
|
|
}
|
|
}
|
|
|
|
/* set total slots alloc */
|
|
jdata->total_slots_alloc = orte_ras_base.total_slots_alloc;
|
|
|
|
/* set the job state to the next position */
|
|
ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_ALLOCATION_COMPLETE);
|
|
|
|
/* cleanup */
|
|
OBJ_RELEASE(caddy);
|
|
}
|
|
|
|
int orte_ras_base_add_hosts(orte_job_t *jdata)
|
|
{
|
|
int rc;
|
|
opal_list_t nodes;
|
|
int i;
|
|
orte_app_context_t *app;
|
|
|
|
/* construct a list to hold the results */
|
|
OBJ_CONSTRUCT(&nodes, opal_list_t);
|
|
|
|
/* Individual add-hostfile names, if given, are included
|
|
* in the app_contexts for this job. We therefore need to
|
|
* retrieve the app_contexts for the job, and then cycle
|
|
* through them to see if anything is there. The parser will
|
|
* add the nodes found in each add-hostfile to our list - i.e.,
|
|
* the resulting list contains the UNION of all nodes specified
|
|
* in add-hostfiles from across all app_contexts
|
|
*
|
|
* Note that any relative node syntax found in the add-hostfiles will
|
|
* generate an error in this scenario, so only non-relative syntax
|
|
* can be present
|
|
*/
|
|
|
|
for (i=0; i < jdata->apps->size; i++) {
|
|
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) {
|
|
continue;
|
|
}
|
|
if (NULL != app->add_hostfile) {
|
|
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
|
"%s ras:base:add_hosts checking add-hostfile %s",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
app->add_hostfile));
|
|
|
|
/* hostfile was specified - parse it and add it to the list */
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
|
|
app->add_hostfile))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
return rc;
|
|
}
|
|
/* now indicate that this app is to run across it */
|
|
app->hostfile = app->add_hostfile;
|
|
app->add_hostfile = NULL;
|
|
}
|
|
}
|
|
|
|
/* We next check for and add any add-host options. Note this is
|
|
* a -little- different than dash-host in that (a) we add these
|
|
* nodes to the global pool regardless of what may already be there,
|
|
* and (b) as a result, any job and/or app_context can access them.
|
|
*
|
|
* Note that any relative node syntax found in the add-host lists will
|
|
* generate an error in this scenario, so only non-relative syntax
|
|
* can be present
|
|
*/
|
|
for (i=0; i < jdata->apps->size; i++) {
|
|
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) {
|
|
continue;
|
|
}
|
|
if (NULL != app->add_host) {
|
|
if (4 < opal_output_get_verbosity(orte_ras_base_framework.framework_output)) {
|
|
char *fff = opal_argv_join(app->add_host, ',');
|
|
opal_output(0, "%s ras:base:add_hosts checking add-host %s",
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fff);
|
|
free(fff);
|
|
}
|
|
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
|
|
app->add_host))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
OBJ_DESTRUCT(&nodes);
|
|
return rc;
|
|
}
|
|
/* now indicate that this app is to run across them */
|
|
app->dash_host = app->add_host;
|
|
app->add_host = NULL;
|
|
}
|
|
}
|
|
|
|
/* if something was found, we add that to our global pool */
|
|
if (!opal_list_is_empty(&nodes)) {
|
|
/* store the results in the global resource pool - this removes the
|
|
* list items
|
|
*/
|
|
if (ORTE_SUCCESS != (rc = orte_ras_base_node_insert(&nodes, jdata))) {
|
|
ORTE_ERROR_LOG(rc);
|
|
}
|
|
/* cleanup */
|
|
OBJ_DESTRUCT(&nodes);
|
|
}
|
|
|
|
/* shall we display the results? */
|
|
if (0 < opal_output_get_verbosity(orte_ras_base_framework.framework_output)) {
|
|
orte_ras_base_display_alloc();
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
}
|