2006-09-15 01:29:51 +04:00
|
|
|
/*
|
2007-03-17 02:11:45 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2006-09-15 01:29:51 +04:00
|
|
|
* 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.
|
2007-02-13 02:59:27 +03:00
|
|
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
2007-10-17 17:47:36 +04:00
|
|
|
* Copyright (c) 2007 Evergrid, Inc. All rights reserved.
|
|
|
|
*
|
2006-09-15 01:29:51 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <errno.h>
|
2007-06-13 02:43:18 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2006-09-15 01:29:51 +04:00
|
|
|
#include <sys/types.h>
|
2006-11-13 21:51:18 +03:00
|
|
|
#endif
|
2006-09-15 01:29:51 +04:00
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#endif
|
|
|
|
#include <signal.h>
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
2006-11-13 21:51:18 +03:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
2006-09-15 01:29:51 +04:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif /* HAVE_SYS_STAT_H */
|
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
#if defined(HAVE_SCHED_YIELD)
|
|
|
|
/* Only if we have sched_yield() */
|
|
|
|
#ifdef HAVE_SCHED_H
|
|
|
|
#include <sched.h>
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* Only do these if we don't have <sched.h> */
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_SCHED_YIELD */
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "opal/util/output.h"
|
|
|
|
#include "opal/util/show_help.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/runtime/orte_wait.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/mca/iof/base/iof_base_setup.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
#include "orte/mca/odls/base/odls_private.h"
|
|
|
|
#include "orte/mca/odls/default/odls_default.h"
|
|
|
|
|
2007-06-07 00:18:37 +04:00
|
|
|
/*
|
|
|
|
* External Interface
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
static int orte_odls_default_launch_local_procs(opal_buffer_t *data);
|
2007-06-07 00:18:37 +04:00
|
|
|
static int orte_odls_default_kill_local_procs(orte_jobid_t job, bool set_state);
|
2007-10-10 19:02:10 +04:00
|
|
|
static int orte_odls_default_signal_local_procs(const orte_process_name_t *proc, int32_t signal);
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
static void set_handler_default(int sig);
|
|
|
|
|
|
|
|
orte_odls_base_module_t orte_odls_default_module = {
|
2007-10-10 19:02:10 +04:00
|
|
|
orte_odls_base_default_get_add_procs_data,
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_odls_default_launch_local_procs,
|
|
|
|
orte_odls_default_kill_local_procs,
|
Bring in the code for routing xcast stage gate messages via the local orteds. This code is inactive unless you specifically request it via an mca param oob_xcast_mode (can be set to "linear" or "direct"). Direct mode is the old standard method where we send messages directly to each MPI process. Linear mode sends the xcast message via the orteds, with the HNP sending the message to each orted directly.
There is a binomial algorithm in the code (i.e., the HNP would send to a subset of the orteds, which then relay it on according to the typical log-2 algo), but that has a bug in it so the code won't let you select it even if you tried (and the mca param doesn't show, so you'd *really* have to try).
This also involved a slight change to the oob.xcast API, so propagated that as required.
Note: this has *only* been tested on rsh, SLURM, and Bproc environments (now that it has been transferred to the OMPI trunk, I'll need to re-test it [only done rsh so far]). It should work fine on any environment that uses the ORTE daemons - anywhere else, you are on your own... :-)
Also, correct a mistake where the orte_debug_flag was declared an int, but the mca param was set as a bool. Move the storage for that flag to the orte/runtime/params.c and orte/runtime/params.h files appropriately.
This commit was SVN r14475.
2007-04-23 22:41:04 +04:00
|
|
|
orte_odls_default_signal_local_procs,
|
2007-10-10 19:02:10 +04:00
|
|
|
orte_odls_base_default_deliver_message,
|
2008-03-27 18:17:53 +03:00
|
|
|
orte_odls_base_default_require_sync,
|
|
|
|
orte_odls_base_default_collect_data
|
2006-09-15 01:29:51 +04:00
|
|
|
};
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
static bool odls_default_child_died(pid_t pid, unsigned int timeout, int *exit_status)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
time_t end;
|
|
|
|
pid_t ret;
|
2006-11-13 21:51:18 +03:00
|
|
|
#if !defined(HAVE_SCHED_YIELD)
|
|
|
|
struct timeval t;
|
|
|
|
fd_set bogus;
|
|
|
|
#endif
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
end = time(NULL) + timeout;
|
|
|
|
do {
|
|
|
|
ret = waitpid(pid, exit_status, WNOHANG);
|
|
|
|
if (pid == ret) {
|
|
|
|
/* It died -- return success */
|
|
|
|
return true;
|
2008-02-28 04:57:57 +03:00
|
|
|
} else if (0 == ret) {
|
|
|
|
/* with NOHANG specified, if a process has already exited
|
|
|
|
* while waitpid was registered, then waitpid returns 0
|
|
|
|
* as there is no error - this is a race condition problem
|
|
|
|
* that occasionally causes us to incorrectly report a proc
|
|
|
|
* as refusing to die. Unfortunately, errno may not be reset
|
|
|
|
* by waitpid in this case, so we cannot check it - just assume
|
|
|
|
* the proc has indeed died
|
|
|
|
*/
|
|
|
|
return true;
|
2006-09-15 01:29:51 +04:00
|
|
|
} else if (-1 == ret && ECHILD == errno) {
|
|
|
|
/* The pid no longer exists, so we'll call this "good
|
|
|
|
enough for government work" */
|
|
|
|
return true;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2006-11-13 21:51:18 +03:00
|
|
|
#if defined(HAVE_SCHED_YIELD)
|
2006-11-13 15:45:03 +03:00
|
|
|
sched_yield();
|
2006-11-13 21:51:18 +03:00
|
|
|
#else
|
|
|
|
/* Bogus delay for 1 usec */
|
|
|
|
t.tv_sec = 0;
|
|
|
|
t.tv_usec = 1;
|
|
|
|
FD_ZERO(&bogus);
|
|
|
|
FD_SET(0, &bogus);
|
|
|
|
select(1, &bogus, NULL, NULL, &t);
|
2006-11-13 15:45:03 +03:00
|
|
|
#endif
|
2006-11-13 21:51:18 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
} while (time(NULL) < end);
|
|
|
|
|
|
|
|
/* The child didn't die, so return false */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
static int odls_default_kill_local(pid_t pid, int signum)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
2007-10-10 19:02:10 +04:00
|
|
|
if (0 != kill(pid, signum)) {
|
|
|
|
if (ESRCH != errno) return errno;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2007-10-10 19:02:10 +04:00
|
|
|
return 0;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
int orte_odls_default_kill_local_procs(orte_jobid_t job, bool set_state)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
Bring over the update to terminate orteds that are generated by a dynamic spawn such as comm_spawn. This introduces the concept of a job "family" - i.e., jobs that have a parent/child relationship. Comm_spawn'ed jobs have a parent (the one that spawned them). We track that relationship throughout the lineage - i.e., if a comm_spawned job in turn calls comm_spawn, then it has a parent (the one that spawned it) and a "root" job (the original job that started things).
Accordingly, there are new APIs to the name service to support the ability to get a job's parent, root, immediate children, and all its descendants. In addition, the terminate_job, terminate_orted, and signal_job APIs for the PLS have been modified to accept attributes that define the extent of their actions. For example, doing a "terminate_job" with an attribute of ORTE_NS_INCLUDE_DESCENDANTS will terminate the given jobid AND all jobs that descended from it.
I have tested this capability on a MacBook under rsh, Odin under SLURM, and LANL's Flash (bproc). It worked successfully on non-MPI jobs (both simple and including a spawn), and MPI jobs (again, both simple and with a spawn).
This commit was SVN r12597.
2006-11-14 22:34:59 +03:00
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_odls_base_default_kill_local_procs(job, set_state,
|
|
|
|
odls_default_kill_local, odls_default_child_died))) {
|
2006-09-15 01:29:51 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
2007-10-10 19:02:10 +04:00
|
|
|
return rc;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2007-10-10 19:02:10 +04:00
|
|
|
return ORTE_SUCCESS;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fork/exec the specified processes
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int odls_default_fork_local_proc(
|
|
|
|
orte_app_context_t* context,
|
2006-11-11 07:03:45 +03:00
|
|
|
orte_odls_child_t *child,
|
2007-10-10 19:02:10 +04:00
|
|
|
char **environ_copy)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
orte_iof_base_io_conf_t opts;
|
|
|
|
int rc;
|
|
|
|
sigset_t sigs;
|
2007-10-10 19:02:10 +04:00
|
|
|
int i, p[2];
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
/* should pull this information from MPIRUN instead of going with
|
|
|
|
default */
|
|
|
|
opts.usepty = OMPI_ENABLE_PTY_SUPPORT;
|
2007-10-10 19:02:10 +04:00
|
|
|
|
2007-06-09 02:59:31 +04:00
|
|
|
/* BWB - Fix post beta. Should setup stdin in orterun and make
|
|
|
|
part of the app_context. Do not change this without also
|
|
|
|
changing the reverse of this in
|
|
|
|
odls_default_wait_local_proc(). */
|
2006-09-15 01:29:51 +04:00
|
|
|
if (child->name->vpid == 0) {
|
|
|
|
opts.connect_stdin = true;
|
|
|
|
} else {
|
|
|
|
opts.connect_stdin = false;
|
|
|
|
}
|
2007-10-10 19:02:10 +04:00
|
|
|
|
2007-04-24 22:54:45 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_iof_base_setup_prefork(&opts))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
child->state = ORTE_PROC_STATE_FAILED_TO_START;
|
|
|
|
child->exit_code = rc;
|
|
|
|
return rc;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2007-04-24 22:54:45 +04:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
/* A pipe is used to communicate between the parent and child to
|
2008-01-27 00:36:04 +03:00
|
|
|
indicate whether the exec ultimately succeeded or failed. The
|
2006-09-15 01:29:51 +04:00
|
|
|
child sets the pipe to be close-on-exec; the child only ever
|
|
|
|
writes anything to the pipe if there is an error (e.g.,
|
|
|
|
executable not found, exec() fails, etc.). The parent does a
|
|
|
|
blocking read on the pipe; if the pipe closed with no data,
|
|
|
|
then the exec() succeeded. If the parent reads something from
|
|
|
|
the pipe, then the child was letting us know that it failed. */
|
|
|
|
if (pipe(p) < 0) {
|
2007-04-24 22:54:45 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_PIPES);
|
|
|
|
child->state = ORTE_PROC_STATE_FAILED_TO_START;
|
|
|
|
child->exit_code = ORTE_ERR_SYS_LIMITS_PIPES;
|
|
|
|
return ORTE_ERR_SYS_LIMITS_PIPES;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fork off the child */
|
2008-02-28 04:57:57 +03:00
|
|
|
child->pid = fork();
|
|
|
|
if(child->pid < 0) {
|
2007-04-24 22:54:45 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_CHILDREN);
|
|
|
|
child->state = ORTE_PROC_STATE_FAILED_TO_START;
|
|
|
|
child->exit_code = ORTE_ERR_SYS_LIMITS_CHILDREN;
|
|
|
|
return ORTE_ERR_SYS_LIMITS_CHILDREN;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (child->pid == 0) {
|
2006-09-15 01:29:51 +04:00
|
|
|
long fd, fdmax = sysconf(_SC_OPEN_MAX);
|
|
|
|
|
|
|
|
/* Setup the pipe to be close-on-exec */
|
|
|
|
close(p[0]);
|
|
|
|
fcntl(p[1], F_SETFD, FD_CLOEXEC);
|
|
|
|
|
2007-04-24 22:54:45 +04:00
|
|
|
/* setup stdout/stderr so that any error messages that we may
|
|
|
|
print out will get displayed back at orterun.
|
|
|
|
|
|
|
|
NOTE: Definitely do this AFTER we check contexts so that any
|
|
|
|
error message from those two functions doesn't come out to the
|
|
|
|
user. IF we didn't do it in this order, THEN a user who gives
|
|
|
|
us a bad executable name or working directory would get N
|
|
|
|
error messages, where N=num_procs. This would be very annoying
|
|
|
|
for large jobs, so instead we set things up so that orterun
|
|
|
|
always outputs a nice, single message indicating what happened
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (i = orte_iof_base_setup_child(&opts))) {
|
|
|
|
write(p[1], &i, sizeof(int));
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
/* close all file descriptors w/ exception of stdin/stdout/stderr */
|
|
|
|
for(fd=3; fd<fdmax; fd++)
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
if (context->argv == NULL) {
|
|
|
|
context->argv = malloc(sizeof(char*)*2);
|
|
|
|
context->argv[0] = strdup(context->app);
|
|
|
|
context->argv[1] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set signal handlers back to the default. Do this close to
|
|
|
|
the exev() because the event library may (and likely will)
|
|
|
|
reset them. If we don't do this, the event library may
|
|
|
|
have left some set that, at least on some OS's, don't get
|
|
|
|
reset via fork() or exec(). Hence, the launched process
|
|
|
|
could be unkillable (for example). */
|
|
|
|
|
|
|
|
set_handler_default(SIGTERM);
|
|
|
|
set_handler_default(SIGINT);
|
|
|
|
set_handler_default(SIGHUP);
|
|
|
|
set_handler_default(SIGPIPE);
|
|
|
|
set_handler_default(SIGCHLD);
|
|
|
|
|
|
|
|
/* Unblock all signals, for many of the same reasons that we
|
|
|
|
set the default handlers, above. This is noticable on
|
|
|
|
Linux where the event library blocks SIGTERM, but we don't
|
|
|
|
want that blocked by the launched process. */
|
|
|
|
sigprocmask(0, 0, &sigs);
|
|
|
|
sigprocmask(SIG_UNBLOCK, &sigs, 0);
|
|
|
|
|
|
|
|
/* Exec the new executable */
|
|
|
|
|
|
|
|
execve(context->app, context->argv, environ_copy);
|
2006-10-11 22:43:13 +04:00
|
|
|
opal_show_help("help-odls-default.txt", "orte-odls-default:execv-error",
|
2006-09-15 01:29:51 +04:00
|
|
|
true, context->app, strerror(errno));
|
2006-12-18 05:30:05 +03:00
|
|
|
exit(1);
|
2006-09-15 01:29:51 +04:00
|
|
|
} else {
|
|
|
|
|
|
|
|
/* connect endpoints IOF */
|
|
|
|
rc = orte_iof_base_setup_parent(child->name, &opts);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wait to read something from the pipe or close */
|
|
|
|
close(p[1]);
|
|
|
|
while (1) {
|
|
|
|
rc = read(p[0], &i, sizeof(int));
|
|
|
|
if (rc < 0) {
|
|
|
|
/* Signal interrupts are ok */
|
|
|
|
if (errno == EINTR) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* Other errno's are bad */
|
2007-04-24 22:54:45 +04:00
|
|
|
child->state = ORTE_PROC_STATE_FAILED_TO_START;
|
|
|
|
child->exit_code = ORTE_ERR_PIPE_READ_FAILURE;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
|
|
|
"%s odls:default:fork got code %d back from child",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), i));
|
|
|
|
|
2007-04-24 22:54:45 +04:00
|
|
|
return ORTE_ERR_PIPE_READ_FAILURE;
|
2006-09-15 01:29:51 +04:00
|
|
|
break;
|
|
|
|
} else if (0 == rc) {
|
|
|
|
/* Child was successful in exec'ing! */
|
|
|
|
break;
|
|
|
|
} else {
|
2007-04-24 22:54:45 +04:00
|
|
|
/* Doh -- child failed.
|
|
|
|
Let the calling function
|
|
|
|
know about the failure. The actual exit status of child proc
|
|
|
|
cannot be found here - all we can do is report the ORTE error
|
|
|
|
code that was reported back to us. The calling func needs to report the
|
|
|
|
failure to launch this process through the SMR or else
|
|
|
|
everyone else will hang.
|
2006-09-15 01:29:51 +04:00
|
|
|
*/
|
2007-04-24 22:54:45 +04:00
|
|
|
child->state = ORTE_PROC_STATE_FAILED_TO_START;
|
|
|
|
child->exit_code = i;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
|
|
|
"%s odls:default:fork got code %d back from child",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), i));
|
|
|
|
|
2007-02-13 02:59:27 +03:00
|
|
|
return i;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* set the proc state to LAUNCHED */
|
2006-11-11 07:03:45 +03:00
|
|
|
child->state = ORTE_PROC_STATE_LAUNCHED;
|
2006-09-15 01:29:51 +04:00
|
|
|
child->alive = true;
|
|
|
|
}
|
2006-11-11 07:03:45 +03:00
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Launch all processes allocated to the current node.
|
|
|
|
*/
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int orte_odls_default_launch_local_procs(opal_buffer_t *data)
|
2006-09-15 01:29:51 +04:00
|
|
|
{
|
|
|
|
int rc;
|
Squeeeeeeze the launch message. This is the message sent to the daemons that provides all the data required for launching their local procs. In reorganizing the ODLS framework, I discovered that we were sending a significant amount of unnecessary and repeated data. This commit resolves this by:
1. taking advantage of the fact that we no longer create the launch message via a GPR trigger. In earlier times, we had the GPR create the launch message based on a subscription. In that mode of operation, we could not guarantee the order in which the data was stored in the message - hence, we had no choice but to parse the message in a loop that checked each value against a list of possible "keys" until the corresponding value was found.
Now, however, we construct the message "by hand", so we know precisely what data is in each location in the message. Thus, we no longer need to send the character string "keys" for each data value any more. This represents a rather large savings in the message size - to give you an example, we typically would use a 30-char "key" for a 2-byte data value. As you can see, the overhead can become very large.
2. sending node-specific data only once. Again, because we used to construct the message via subscriptions that were done on a per-proc basis, the data for each node (e.g., the daemon's name, whether or not the node was oversubscribed) would be included in the data for each proc. Thus, the node-specific data was repeated for every proc.
Now that we construct the message "by hand", there is no reason to do this any more. Instead, we can insert the data for a specific node only once, and then provide the per-proc data for that node. We therefore not only save all that extra data in the message, but we also only need to parse the per-node data once.
The savings become significant at scale. Here is a comparison between the revised trunk and the trunk prior to this commit (all data was taken on odin, using openib, 64 nodes, unity message routing, tested with application consisting of mpi_init/mpi_barrier/mpi_finalize, all execution times given in seconds, all launch message sizes in bytes):
Per-node scaling, taken at 1ppn:
#nodes original trunk revised trunk
time size time size
1 0.10 819 0.09 564
2 0.14 1070 0.14 677
3 0.15 1321 0.14 790
4 0.15 1572 0.15 903
8 0.17 2576 0.20 1355
16 0.25 4584 0.21 2259
32 0.28 8600 0.27 4067
64 0.50 16632 0.39 7683
Per-proc scaling, taken at 64 nodes
ppn original trunk revised trunk
time size time size
1 0.50 16669 0.40 7720
2 0.55 32733 0.54 11048
3 0.87 48797 0.81 14376
4 1.0 64861 0.85 17704
Condensing those numbers, it appears we gained:
per-node message size: 251 bytes/node -> 113 bytes/node
per-proc message size: 251 bytes/proc -> 52 bytes/proc
per-job message size: 568 bytes/job -> 399 bytes/job
(job-specific data such as jobid, override oversubscribe flag, total #procs in job, total slots allocated)
The fact that the two pre-commit trunk numbers are the same confirms the fact that each proc was containing the node data as well. It isn't quite the 10x message reduction I had hoped to get, but it is significant and gives much better scaling.
Note that the timing info was, as usual, pretty chaotic - the numbers cited here were typical across several runs taken after the initial one to avoid NFS file positioning influences.
Also note that this commit removes the orte_process_info.vpid_start field and the handful of places that passed that useless value. By definition, all jobs start at vpid=0, so all we were doing is passing "0" around. In fact, many places simply hardwired it to "0" anyway rather than deal with it.
This commit was SVN r16428.
2007-10-11 19:57:26 +04:00
|
|
|
orte_std_cntr_t total_slots_alloc, num_local_procs;
|
2006-09-15 01:29:51 +04:00
|
|
|
orte_jobid_t job;
|
Squeeeeeeze the launch message. This is the message sent to the daemons that provides all the data required for launching their local procs. In reorganizing the ODLS framework, I discovered that we were sending a significant amount of unnecessary and repeated data. This commit resolves this by:
1. taking advantage of the fact that we no longer create the launch message via a GPR trigger. In earlier times, we had the GPR create the launch message based on a subscription. In that mode of operation, we could not guarantee the order in which the data was stored in the message - hence, we had no choice but to parse the message in a loop that checked each value against a list of possible "keys" until the corresponding value was found.
Now, however, we construct the message "by hand", so we know precisely what data is in each location in the message. Thus, we no longer need to send the character string "keys" for each data value any more. This represents a rather large savings in the message size - to give you an example, we typically would use a 30-char "key" for a 2-byte data value. As you can see, the overhead can become very large.
2. sending node-specific data only once. Again, because we used to construct the message via subscriptions that were done on a per-proc basis, the data for each node (e.g., the daemon's name, whether or not the node was oversubscribed) would be included in the data for each proc. Thus, the node-specific data was repeated for every proc.
Now that we construct the message "by hand", there is no reason to do this any more. Instead, we can insert the data for a specific node only once, and then provide the per-proc data for that node. We therefore not only save all that extra data in the message, but we also only need to parse the per-node data once.
The savings become significant at scale. Here is a comparison between the revised trunk and the trunk prior to this commit (all data was taken on odin, using openib, 64 nodes, unity message routing, tested with application consisting of mpi_init/mpi_barrier/mpi_finalize, all execution times given in seconds, all launch message sizes in bytes):
Per-node scaling, taken at 1ppn:
#nodes original trunk revised trunk
time size time size
1 0.10 819 0.09 564
2 0.14 1070 0.14 677
3 0.15 1321 0.14 790
4 0.15 1572 0.15 903
8 0.17 2576 0.20 1355
16 0.25 4584 0.21 2259
32 0.28 8600 0.27 4067
64 0.50 16632 0.39 7683
Per-proc scaling, taken at 64 nodes
ppn original trunk revised trunk
time size time size
1 0.50 16669 0.40 7720
2 0.55 32733 0.54 11048
3 0.87 48797 0.81 14376
4 1.0 64861 0.85 17704
Condensing those numbers, it appears we gained:
per-node message size: 251 bytes/node -> 113 bytes/node
per-proc message size: 251 bytes/proc -> 52 bytes/proc
per-job message size: 568 bytes/job -> 399 bytes/job
(job-specific data such as jobid, override oversubscribe flag, total #procs in job, total slots allocated)
The fact that the two pre-commit trunk numbers are the same confirms the fact that each proc was containing the node data as well. It isn't quite the 10x message reduction I had hoped to get, but it is significant and gives much better scaling.
Note that the timing info was, as usual, pretty chaotic - the numbers cited here were typical across several runs taken after the initial one to avoid NFS file positioning influences.
Also note that this commit removes the orte_process_info.vpid_start field and the handful of places that passed that useless value. By definition, all jobs start at vpid=0, so all we were doing is passing "0" around. In fact, many places simply hardwired it to "0" anyway rather than deal with it.
This commit was SVN r16428.
2007-10-11 19:57:26 +04:00
|
|
|
orte_vpid_t range;
|
2007-04-24 22:54:45 +04:00
|
|
|
bool node_included;
|
2007-10-10 19:02:10 +04:00
|
|
|
bool override_oversubscribed;
|
|
|
|
bool oversubscribed;
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_std_cntr_t i, num_contexts;
|
|
|
|
orte_app_context_t **app_contexts;
|
2007-06-18 19:39:04 +04:00
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
/* construct the list of children we are to launch */
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_odls_base_default_construct_child_list(data, &job,
|
Squeeeeeeze the launch message. This is the message sent to the daemons that provides all the data required for launching their local procs. In reorganizing the ODLS framework, I discovered that we were sending a significant amount of unnecessary and repeated data. This commit resolves this by:
1. taking advantage of the fact that we no longer create the launch message via a GPR trigger. In earlier times, we had the GPR create the launch message based on a subscription. In that mode of operation, we could not guarantee the order in which the data was stored in the message - hence, we had no choice but to parse the message in a loop that checked each value against a list of possible "keys" until the corresponding value was found.
Now, however, we construct the message "by hand", so we know precisely what data is in each location in the message. Thus, we no longer need to send the character string "keys" for each data value any more. This represents a rather large savings in the message size - to give you an example, we typically would use a 30-char "key" for a 2-byte data value. As you can see, the overhead can become very large.
2. sending node-specific data only once. Again, because we used to construct the message via subscriptions that were done on a per-proc basis, the data for each node (e.g., the daemon's name, whether or not the node was oversubscribed) would be included in the data for each proc. Thus, the node-specific data was repeated for every proc.
Now that we construct the message "by hand", there is no reason to do this any more. Instead, we can insert the data for a specific node only once, and then provide the per-proc data for that node. We therefore not only save all that extra data in the message, but we also only need to parse the per-node data once.
The savings become significant at scale. Here is a comparison between the revised trunk and the trunk prior to this commit (all data was taken on odin, using openib, 64 nodes, unity message routing, tested with application consisting of mpi_init/mpi_barrier/mpi_finalize, all execution times given in seconds, all launch message sizes in bytes):
Per-node scaling, taken at 1ppn:
#nodes original trunk revised trunk
time size time size
1 0.10 819 0.09 564
2 0.14 1070 0.14 677
3 0.15 1321 0.14 790
4 0.15 1572 0.15 903
8 0.17 2576 0.20 1355
16 0.25 4584 0.21 2259
32 0.28 8600 0.27 4067
64 0.50 16632 0.39 7683
Per-proc scaling, taken at 64 nodes
ppn original trunk revised trunk
time size time size
1 0.50 16669 0.40 7720
2 0.55 32733 0.54 11048
3 0.87 48797 0.81 14376
4 1.0 64861 0.85 17704
Condensing those numbers, it appears we gained:
per-node message size: 251 bytes/node -> 113 bytes/node
per-proc message size: 251 bytes/proc -> 52 bytes/proc
per-job message size: 568 bytes/job -> 399 bytes/job
(job-specific data such as jobid, override oversubscribe flag, total #procs in job, total slots allocated)
The fact that the two pre-commit trunk numbers are the same confirms the fact that each proc was containing the node data as well. It isn't quite the 10x message reduction I had hoped to get, but it is significant and gives much better scaling.
Note that the timing info was, as usual, pretty chaotic - the numbers cited here were typical across several runs taken after the initial one to avoid NFS file positioning influences.
Also note that this commit removes the orte_process_info.vpid_start field and the handful of places that passed that useless value. By definition, all jobs start at vpid=0, so all we were doing is passing "0" around. In fact, many places simply hardwired it to "0" anyway rather than deal with it.
This commit was SVN r16428.
2007-10-11 19:57:26 +04:00
|
|
|
&num_local_procs,
|
|
|
|
&range,
|
2007-10-10 19:02:10 +04:00
|
|
|
&total_slots_alloc,
|
|
|
|
&node_included,
|
|
|
|
&oversubscribed,
|
|
|
|
&override_oversubscribed,
|
2008-02-28 04:57:57 +03:00
|
|
|
&num_contexts,
|
|
|
|
&app_contexts))) {
|
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
|
|
|
"%s odls:default:launch:local failed to construct child list on error %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_ERROR_NAME(rc)));
|
2007-10-10 19:02:10 +04:00
|
|
|
goto CLEANUP;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
2007-10-10 19:02:10 +04:00
|
|
|
|
2007-04-24 22:54:45 +04:00
|
|
|
/* if there is nothing for us to do, just return */
|
|
|
|
if (!node_included) {
|
2007-10-10 19:02:10 +04:00
|
|
|
rc = ORTE_SUCCESS;
|
|
|
|
goto CLEANUP;
|
2007-04-24 22:54:45 +04:00
|
|
|
}
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
/* launch the local procs */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_odls_base_default_launch_local(job,
|
|
|
|
num_contexts, app_contexts,
|
Squeeeeeeze the launch message. This is the message sent to the daemons that provides all the data required for launching their local procs. In reorganizing the ODLS framework, I discovered that we were sending a significant amount of unnecessary and repeated data. This commit resolves this by:
1. taking advantage of the fact that we no longer create the launch message via a GPR trigger. In earlier times, we had the GPR create the launch message based on a subscription. In that mode of operation, we could not guarantee the order in which the data was stored in the message - hence, we had no choice but to parse the message in a loop that checked each value against a list of possible "keys" until the corresponding value was found.
Now, however, we construct the message "by hand", so we know precisely what data is in each location in the message. Thus, we no longer need to send the character string "keys" for each data value any more. This represents a rather large savings in the message size - to give you an example, we typically would use a 30-char "key" for a 2-byte data value. As you can see, the overhead can become very large.
2. sending node-specific data only once. Again, because we used to construct the message via subscriptions that were done on a per-proc basis, the data for each node (e.g., the daemon's name, whether or not the node was oversubscribed) would be included in the data for each proc. Thus, the node-specific data was repeated for every proc.
Now that we construct the message "by hand", there is no reason to do this any more. Instead, we can insert the data for a specific node only once, and then provide the per-proc data for that node. We therefore not only save all that extra data in the message, but we also only need to parse the per-node data once.
The savings become significant at scale. Here is a comparison between the revised trunk and the trunk prior to this commit (all data was taken on odin, using openib, 64 nodes, unity message routing, tested with application consisting of mpi_init/mpi_barrier/mpi_finalize, all execution times given in seconds, all launch message sizes in bytes):
Per-node scaling, taken at 1ppn:
#nodes original trunk revised trunk
time size time size
1 0.10 819 0.09 564
2 0.14 1070 0.14 677
3 0.15 1321 0.14 790
4 0.15 1572 0.15 903
8 0.17 2576 0.20 1355
16 0.25 4584 0.21 2259
32 0.28 8600 0.27 4067
64 0.50 16632 0.39 7683
Per-proc scaling, taken at 64 nodes
ppn original trunk revised trunk
time size time size
1 0.50 16669 0.40 7720
2 0.55 32733 0.54 11048
3 0.87 48797 0.81 14376
4 1.0 64861 0.85 17704
Condensing those numbers, it appears we gained:
per-node message size: 251 bytes/node -> 113 bytes/node
per-proc message size: 251 bytes/proc -> 52 bytes/proc
per-job message size: 568 bytes/job -> 399 bytes/job
(job-specific data such as jobid, override oversubscribe flag, total #procs in job, total slots allocated)
The fact that the two pre-commit trunk numbers are the same confirms the fact that each proc was containing the node data as well. It isn't quite the 10x message reduction I had hoped to get, but it is significant and gives much better scaling.
Note that the timing info was, as usual, pretty chaotic - the numbers cited here were typical across several runs taken after the initial one to avoid NFS file positioning influences.
Also note that this commit removes the orte_process_info.vpid_start field and the handful of places that passed that useless value. By definition, all jobs start at vpid=0, so all we were doing is passing "0" around. In fact, many places simply hardwired it to "0" anyway rather than deal with it.
This commit was SVN r16428.
2007-10-11 19:57:26 +04:00
|
|
|
num_local_procs,
|
|
|
|
range, total_slots_alloc,
|
2007-10-10 19:02:10 +04:00
|
|
|
oversubscribed,
|
|
|
|
override_oversubscribed,
|
|
|
|
odls_default_fork_local_proc))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((2, orte_odls_globals.output,
|
|
|
|
"%s odls:default:launch:local failed to launch on error %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_ERROR_NAME(rc)));
|
2007-10-10 19:02:10 +04:00
|
|
|
goto CLEANUP;
|
Bring in the code for routing xcast stage gate messages via the local orteds. This code is inactive unless you specifically request it via an mca param oob_xcast_mode (can be set to "linear" or "direct"). Direct mode is the old standard method where we send messages directly to each MPI process. Linear mode sends the xcast message via the orteds, with the HNP sending the message to each orted directly.
There is a binomial algorithm in the code (i.e., the HNP would send to a subset of the orteds, which then relay it on according to the typical log-2 algo), but that has a bug in it so the code won't let you select it even if you tried (and the mca param doesn't show, so you'd *really* have to try).
This also involved a slight change to the oob.xcast API, so propagated that as required.
Note: this has *only* been tested on rsh, SLURM, and Bproc environments (now that it has been transferred to the OMPI trunk, I'll need to re-test it [only done rsh so far]). It should work fine on any environment that uses the ORTE daemons - anywhere else, you are on your own... :-)
Also, correct a mistake where the orte_debug_flag was declared an int, but the mca param was set as a bool. Move the storage for that flag to the orte/runtime/params.c and orte/runtime/params.h files appropriately.
This commit was SVN r14475.
2007-04-23 22:41:04 +04:00
|
|
|
}
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
CLEANUP:
|
2006-09-15 01:29:51 +04:00
|
|
|
/* cleanup */
|
2008-02-28 04:57:57 +03:00
|
|
|
for (i=0; i < num_contexts; i++) {
|
|
|
|
if (NULL != app_contexts[i]) OBJ_RELEASE(app_contexts[i]);
|
|
|
|
};
|
|
|
|
if (NULL != app_contexts) free(app_contexts);
|
2007-10-10 19:02:10 +04:00
|
|
|
|
2006-11-11 07:03:45 +03:00
|
|
|
return rc;
|
2006-09-15 01:29:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
static void set_handler_default(int sig)
|
|
|
|
{
|
|
|
|
struct sigaction act;
|
|
|
|
|
|
|
|
act.sa_handler = SIG_DFL;
|
|
|
|
act.sa_flags = 0;
|
|
|
|
sigemptyset(&act.sa_mask);
|
|
|
|
|
|
|
|
sigaction(sig, &act, (struct sigaction *)0);
|
|
|
|
}
|
2006-09-15 01:29:51 +04:00
|
|
|
|
|
|
|
static int send_signal(pid_t pid, int signal)
|
|
|
|
{
|
|
|
|
int rc = ORTE_SUCCESS;
|
|
|
|
|
2007-09-12 18:32:31 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_odls_globals.output,
|
|
|
|
"%s sending signal %d to pid %ld",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
signal, (long)pid));
|
|
|
|
|
2006-09-15 01:29:51 +04:00
|
|
|
if (kill(pid, signal) != 0) {
|
|
|
|
switch(errno) {
|
|
|
|
case EINVAL:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
|
|
rc = ORTE_ERR_BAD_PARAM;
|
|
|
|
break;
|
|
|
|
case ESRCH:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
rc = ORTE_ERR_NOT_FOUND;
|
|
|
|
break;
|
|
|
|
case EPERM:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_PERM);
|
|
|
|
rc = ORTE_ERR_PERM;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERROR);
|
|
|
|
rc = ORTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2007-09-12 18:32:31 +04:00
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
static int orte_odls_default_signal_local_procs(const orte_process_name_t *proc, int32_t signal)
|
Bring in the code for routing xcast stage gate messages via the local orteds. This code is inactive unless you specifically request it via an mca param oob_xcast_mode (can be set to "linear" or "direct"). Direct mode is the old standard method where we send messages directly to each MPI process. Linear mode sends the xcast message via the orteds, with the HNP sending the message to each orted directly.
There is a binomial algorithm in the code (i.e., the HNP would send to a subset of the orteds, which then relay it on according to the typical log-2 algo), but that has a bug in it so the code won't let you select it even if you tried (and the mca param doesn't show, so you'd *really* have to try).
This also involved a slight change to the oob.xcast API, so propagated that as required.
Note: this has *only* been tested on rsh, SLURM, and Bproc environments (now that it has been transferred to the OMPI trunk, I'll need to re-test it [only done rsh so far]). It should work fine on any environment that uses the ORTE daemons - anywhere else, you are on your own... :-)
Also, correct a mistake where the orte_debug_flag was declared an int, but the mca param was set as a bool. Move the storage for that flag to the orte/runtime/params.c and orte/runtime/params.h files appropriately.
This commit was SVN r14475.
2007-04-23 22:41:04 +04:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2007-10-10 19:02:10 +04:00
|
|
|
if (ORTE_SUCCESS != (rc = orte_odls_base_default_signal_local_procs(proc, signal, send_signal))) {
|
These changes were mostly captured in a prior RFC (except for #2 below) and are aimed specifically at improving startup performance and setting up the remaining modifications described in that RFC.
The commit has been tested for C/R and Cray operations, and on Odin (SLURM, rsh) and RoadRunner (TM). I tried to update all environments, but obviously could not test them. I know that Windows needs some work, and have highlighted what is know to be needed in the odls process component.
This represents a lot of work by Brian, Tim P, Josh, and myself, with much advice from Jeff and others. For posterity, I have appended a copy of the email describing the work that was done:
As we have repeatedly noted, the modex operation in MPI_Init is the single greatest consumer of time during startup. To-date, we have executed that operation as an ORTE stage gate that held the process until a startup message containing all required modex (and OOB contact info - see #3 below) info could be sent to it. Each process would send its data to the HNP's registry, which assembled and sent the message when all processes had reported in.
In addition, ORTE had taken responsibility for monitoring process status as it progressed through a series of "stage gates". The process reported its status at each gate, and ORTE would then send a "release" message once all procs had reported in.
The incoming changes revamp these procedures in three ways:
1. eliminating the ORTE stage gate system and cleanly delineating responsibility between the OMPI and ORTE layers for MPI init/finalize. The modex stage gate (STG1) has been replaced by a collective operation in the modex itself that performs an allgather on the required modex info. The allgather is implemented using the orte_grpcomm framework since the BTL's are not active at that point. At the moment, the grpcomm framework only has a "basic" component analogous to OMPI's "basic" coll framework - I would recommend that the MPI team create additional, more advanced components to improve performance of this step.
The other stage gates have been replaced by orte_grpcomm barrier functions. We tried to use MPI barriers instead (since the BTL's are active at that point), but - as we discussed on the telecon - these are not currently true barriers so the job would hang when we fell through while messages were still in process. Note that the grpcomm barrier doesn't actually resolve that problem, but Brian has pointed out that we are unlikely to ever see it violated. Again, you might want to spend a little time on an advanced barrier algorithm as the one in "basic" is very simplistic.
Summarizing this change: ORTE no longer tracks process state nor has direct responsibility for synchronizing jobs. This is now done via collective operations within the MPI layer, albeit using ORTE collective communication services. I -strongly- urge the MPI team to implement advanced collective algorithms to improve the performance of this critical procedure.
2. reducing the volume of data exchanged during modex. Data in the modex consisted of the process name, the name of the node where that process is located (expressed as a string), plus a string representation of all contact info. The nodename was required in order for the modex to determine if the process was local or not - in addition, some people like to have it to print pretty error messages when a connection failed.
The size of this data has been reduced in three ways:
(a) reducing the size of the process name itself. The process name consisted of two 32-bit fields for the jobid and vpid. This is far larger than any current system, or system likely to exist in the near future, can support. Accordingly, the default size of these fields has been reduced to 16-bits, which means you can have 32k procs in each of 32k jobs. Since the daemons must have a vpid, and we require one daemon/node, this also restricts the default configuration to 32k nodes.
To support any future "mega-clusters", a configuration option --enable-jumbo-apps has been added. This option increases the jobid and vpid field sizes to 32-bits. Someday, if necessary, someone can add yet another option to increase them to 64-bits, I suppose.
(b) replacing the string nodename with an integer nodeid. Since we have one daemon/node, the nodeid corresponds to the local daemon's vpid. This replaces an often lengthy string with only 2 (or at most 4) bytes, a substantial reduction.
(c) when the mca param requesting that nodenames be sent to support pretty error messages, a second mca param is now used to request FQDN - otherwise, the domain name is stripped (by default) from the message to save space. If someone wants to combine those into a single param somehow (perhaps with an argument?), they are welcome to do so - I didn't want to alter what people are already using.
While these may seem like small savings, they actually amount to a significant impact when aggregated across the entire modex operation. Since every proc must receive the modex data regardless of the collective used to send it, just reducing the size of the process name removes nearly 400MBytes of communication from a 32k proc job (admittedly, much of this comm may occur in parallel). So it does add up pretty quickly.
3. routing RML messages to reduce connections. The default messaging system remains point-to-point - i.e., each proc opens a socket to every proc it communicates with and sends its messages directly. A new option uses the orteds as routers - i.e., each proc only opens a single socket to its local orted. All messages are sent from the proc to the orted, which forwards the message to the orted on the node where the intended recipient proc is located - that orted then forwards the message to its local proc (the recipient). This greatly reduces the connection storm we have encountered during startup.
It also has the benefit of removing the sharing of every proc's OOB contact with every other proc. The orted routing tables are populated during launch since every orted gets a map of where every proc is being placed. Each proc, therefore, only needs to know the contact info for its local daemon, which is passed in via the environment when the proc is fork/exec'd by the daemon. This alone removes ~50 bytes/process of communication that was in the current STG1 startup message - so for our 32k proc job, this saves us roughly 32k*50 = 1.6MBytes sent to 32k procs = 51GBytes of messaging.
Note that you can use the new routing method by specifying -mca routed tree - if you so desire. This mode will become the default at some point in the future.
There are a few minor additional changes in the commit that I'll just note in passing:
* propagation of command line mca params to the orteds - fixes ticket #1073. See note there for details.
* requiring of "finalize" prior to "exit" for MPI procs - fixes ticket #1144. See note there for details.
* cleanup of some stale header files
This commit was SVN r16364.
2007-10-05 23:48:23 +04:00
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|