2007-07-23 22:36:33 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2006 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) 2007 Cisco, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "opal/event/event.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/threads/mutex.h"
|
|
|
|
#include "opal/threads/condition.h"
|
|
|
|
#include "opal/util/bit_ops.h"
|
|
|
|
#include "opal/util/cmd_line.h"
|
|
|
|
#include "opal/util/daemon_init.h"
|
|
|
|
#include "opal/util/opal_environ.h"
|
|
|
|
#include "opal/util/os_path.h"
|
|
|
|
#include "opal/util/output.h"
|
|
|
|
#include "opal/util/printf.h"
|
|
|
|
#include "opal/util/show_help.h"
|
|
|
|
#include "opal/util/trace.h"
|
|
|
|
#include "opal/util/argv.h"
|
|
|
|
#include "opal/runtime/opal.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/dss/dss.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
#include "orte/util/sys_info.h"
|
|
|
|
#include "orte/util/proc_info.h"
|
|
|
|
#include "orte/util/session_dir.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/grpcomm/grpcomm.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
#include "orte/mca/rml/rml.h"
|
|
|
|
#include "orte/mca/rml/base/rml_contact.h"
|
|
|
|
#include "orte/mca/odls/odls.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/mca/plm/plm.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
|
|
|
#include "orte/mca/routed/routed.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
|
|
|
|
#include "orte/runtime/runtime.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
#include "orte/runtime/orte_wakeup.h"
|
2007-07-23 22:36:33 +04:00
|
|
|
|
|
|
|
#include "orte/orted/orted.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Globals
|
|
|
|
*/
|
|
|
|
static int process_commands(orte_process_name_t* sender,
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *buffer,
|
2007-07-23 22:36:33 +04:00
|
|
|
orte_rml_tag_t tag);
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* local callback function for non-blocking sends */
|
|
|
|
static void send_callback(int status, orte_process_name_t *peer,
|
|
|
|
opal_buffer_t *buf, orte_rml_tag_t tag,
|
|
|
|
void *cbdata)
|
2007-07-23 22:36:33 +04:00
|
|
|
{
|
2008-02-28 04:57:57 +03:00
|
|
|
/* nothing to do here - just release buffer and return */
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
}
|
2007-07-23 22:36:33 +04:00
|
|
|
|
2008-02-29 18:18:45 +03:00
|
|
|
static void send_relay(int fd, short event, void *data)
|
2008-02-28 04:57:57 +03:00
|
|
|
{
|
2008-02-29 18:18:45 +03:00
|
|
|
orte_message_event_t *mev = (orte_message_event_t*)data;
|
|
|
|
opal_buffer_t *buffer = mev->buffer;
|
|
|
|
orte_rml_tag_t tag = mev->tag;
|
|
|
|
orte_grpcomm_mode_t relay_mode;
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_list_t recips;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
int ret;
|
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
|
|
|
|
2008-02-29 18:18:45 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orte:daemon:send_relay",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
|
|
|
|
|
|
/* we pass the relay_mode in the mev "tag" field. This is a bit
|
|
|
|
* of a hack as the two sizes may not exactly match. However, since
|
|
|
|
* the rml_tag is an int32, it is doubtful we will ever see a
|
|
|
|
* truncation error
|
|
|
|
*/
|
|
|
|
relay_mode = (orte_grpcomm_mode_t)tag;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* setup a list of next recipients */
|
|
|
|
OBJ_CONSTRUCT(&recips, opal_list_t);
|
|
|
|
/* ask the active grpcomm module for the next recipients */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_grpcomm.next_recipients(&recips, relay_mode))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
/* send the message - if we are at the end of the chain, then there
|
|
|
|
* will be nothing on the list, so remove_first will return NULL
|
|
|
|
*/
|
|
|
|
while (NULL != (item = opal_list_remove_first(&recips))) {
|
|
|
|
orte_namelist_t *target = (orte_namelist_t*)item;
|
2008-02-29 18:18:45 +03:00
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orte:daemon:send_relay sending relay msg to %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(&target->name)));
|
|
|
|
|
|
|
|
if (0 > (ret = orte_rml.send_buffer(&target->name, buffer, ORTE_RML_TAG_DAEMON, 0))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
OBJ_RELEASE(item);
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2007-07-23 22:36:33 +04:00
|
|
|
CLEANUP:
|
2008-02-28 04:57:57 +03:00
|
|
|
/* cleanup */
|
|
|
|
OBJ_DESTRUCT(&recips);
|
2008-02-29 18:18:45 +03:00
|
|
|
OBJ_RELEASE(mev);
|
2008-02-28 04:57:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void orte_daemon_recv(int status, orte_process_name_t* sender,
|
|
|
|
opal_buffer_t *buffer, orte_rml_tag_t tag,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
int ret;
|
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
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orted_recv_cmd: received message from %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(sender)));
|
2007-07-23 22:36:33 +04:00
|
|
|
|
2008-02-28 22:58:32 +03:00
|
|
|
/* don't process this right away - we need to get out of the recv before
|
|
|
|
* we process the message as it may ask us to do something that involves
|
|
|
|
* more messaging! Instead, setup an event so that the message gets processed
|
|
|
|
* as soon as we leave the recv.
|
|
|
|
*
|
|
|
|
* The macro makes a copy of the buffer, which we release when processed - the incoming
|
|
|
|
* buffer, however, is NOT released here, although its payload IS transferred
|
|
|
|
* to the message buffer for later processing
|
|
|
|
*/
|
|
|
|
ORTE_MESSAGE_EVENT(sender, buffer, tag, orte_daemon_cmd_processor);
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2007-07-23 22:36:33 +04:00
|
|
|
/* reissue the non-blocking receive */
|
2008-02-28 04:57:57 +03:00
|
|
|
ret = orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DAEMON,
|
|
|
|
ORTE_RML_NON_PERSISTENT, orte_daemon_recv, NULL);
|
2007-07-23 22:36:33 +04:00
|
|
|
if (ret != ORTE_SUCCESS && ret != ORTE_ERR_NOT_IMPLEMENTED) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orted_recv_cmd: reissued recv",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
|
2008-02-28 22:58:32 +03:00
|
|
|
void orte_daemon_cmd_processor(int fd, short event, void *data)
|
2007-07-23 22:36:33 +04:00
|
|
|
{
|
2008-02-28 22:58:32 +03:00
|
|
|
orte_message_event_t *mev = (orte_message_event_t*)data;
|
|
|
|
orte_process_name_t *sender = &(mev->sender);
|
|
|
|
opal_buffer_t *buffer = mev->buffer;
|
|
|
|
orte_rml_tag_t tag = mev->tag;
|
2007-07-23 22:36:33 +04:00
|
|
|
int ret;
|
2008-02-28 04:57:57 +03:00
|
|
|
char *unpack_ptr;
|
|
|
|
orte_std_cntr_t n;
|
|
|
|
orte_daemon_cmd_flag_t command;
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orte:daemon:cmd:processor called by %s for tag %ld",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(sender),
|
|
|
|
(long)(tag)));
|
|
|
|
|
|
|
|
/* save the original buffer pointers */
|
|
|
|
unpack_ptr = buffer->unpack_ptr;
|
2007-07-23 22:36:33 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* unpack the initial command */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &command, &n, ORTE_DAEMON_CMD))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2008-03-03 19:06:47 +03:00
|
|
|
#if OMPI_ENABLE_DEBUG
|
|
|
|
opal_output(0, "%s got message buffer from file %s line %d\n",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), mev->file, mev->line);
|
|
|
|
#endif
|
2008-02-28 04:57:57 +03:00
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2007-07-23 22:36:33 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* see if this is a "process-and-relay" command */
|
|
|
|
if (ORTE_DAEMON_PROCESS_AND_RELAY_CMD == command) {
|
2008-02-29 18:18:45 +03:00
|
|
|
opal_buffer_t relay_buf;
|
|
|
|
orte_grpcomm_mode_t relay_mode;
|
|
|
|
orte_rml_tag_t relay_tag;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* unpack the routing mode in use */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &relay_mode, &n, ORTE_GRPCOMM_MODE))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2008-02-29 18:18:45 +03:00
|
|
|
/* we are going to use the message event's tag field to pass the relay mode
|
|
|
|
* see comment in send_relay
|
|
|
|
*/
|
|
|
|
relay_tag = (orte_rml_tag_t)relay_mode;
|
2008-02-28 04:57:57 +03:00
|
|
|
/* initialize the relay buffer */
|
2008-02-29 18:18:45 +03:00
|
|
|
OBJ_CONSTRUCT(&relay_buf, opal_buffer_t);
|
2008-02-28 04:57:57 +03:00
|
|
|
/* tell the downstream daemons to process-and-relay */
|
2008-02-29 18:18:45 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(&relay_buf, &command, 1, ORTE_DAEMON_CMD))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto PROCESS;
|
|
|
|
}
|
|
|
|
/* tell the downstream daemons the routing algo in use */
|
2008-02-29 18:18:45 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(&relay_buf, &relay_mode, 1, ORTE_GRPCOMM_MODE))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* copy the message payload to the relay buffer - this is non-destructive */
|
2008-02-29 18:18:45 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.copy_payload(&relay_buf, buffer))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto PROCESS;
|
|
|
|
}
|
2008-02-29 18:18:45 +03:00
|
|
|
/* setup an event to actually perform the relay */
|
|
|
|
ORTE_MESSAGE_EVENT(sender, &relay_buf, relay_tag, send_relay);
|
2008-02-28 04:57:57 +03:00
|
|
|
} else {
|
|
|
|
/* rewind the buffer so we can process it correctly */
|
|
|
|
buffer->unpack_ptr = unpack_ptr;
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
PROCESS:
|
2007-07-23 22:36:33 +04:00
|
|
|
/* process the command */
|
|
|
|
if (ORTE_SUCCESS != (ret = process_commands(sender, buffer, tag))) {
|
2008-02-28 04:57:57 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orte:daemon:cmd:processor failed on error %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_ERROR_NAME(ret)));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orte:daemon:cmd:processor: processing commands completed",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
2008-02-29 18:18:45 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
CLEANUP:
|
2008-02-28 22:58:32 +03:00
|
|
|
OBJ_RELEASE(mev);
|
|
|
|
return;
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int process_commands(orte_process_name_t* sender,
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *buffer,
|
2007-07-23 22:36:33 +04:00
|
|
|
orte_rml_tag_t tag)
|
|
|
|
{
|
|
|
|
orte_daemon_cmd_flag_t command;
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *relay_msg;
|
2007-07-23 22:36:33 +04:00
|
|
|
int ret;
|
|
|
|
orte_std_cntr_t n;
|
|
|
|
int32_t signal;
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_jobid_t job;
|
2007-07-23 22:36:33 +04:00
|
|
|
orte_rml_tag_t target_tag;
|
|
|
|
char *contact_info;
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_buffer_t *answer;
|
2007-07-23 22:36:33 +04:00
|
|
|
orte_rml_cmd_flag_t rml_cmd;
|
Afraid this has a couple of things mixed into the commit. Couldn't be helped - had missed one commit prior to running out the door on vacation.
Fix race conditions in abnormal terminations. We had done a first-cut at this in a prior commit. However, the window remained partially open due to the fact that the HNP has multiple paths leading to orte_finalize. Most of our frameworks don't care if they are finalized more than once, but one of them does, which meant we segfaulted if orte_finalize got called more than once. Besides, we really shouldn't be doing that anyway.
So we now introduce a set of atomic locks that prevent us from multiply calling abort, attempting to call orte_finalize, etc. My initial tests indicate this is working cleanly, but since it is a race condition issue, more testing will have to be done before we know for sure that this problem has been licked.
Also, some updates relevant to the tool comm library snuck in here. Since those also touched the orted code (as did the prior changes), I didn't want to attempt to separate them out - besides, they are coming in soon anyway. More on them later as that functionality approaches completion.
This commit was SVN r17843.
2008-03-17 20:58:59 +03:00
|
|
|
orte_job_t *jdata;
|
2007-07-23 22:36:33 +04:00
|
|
|
|
|
|
|
/* unpack the command */
|
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &command, &n, ORTE_DAEMON_CMD))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now process the command locally */
|
|
|
|
switch(command) {
|
|
|
|
|
|
|
|
/**** KILL_LOCAL_PROCS ****/
|
|
|
|
case ORTE_DAEMON_KILL_LOCAL_PROCS:
|
2008-02-28 04:57:57 +03:00
|
|
|
/* unpack the jobid */
|
2007-07-23 22:36:33 +04:00
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls.kill_local_procs(job, true))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/**** SIGNAL_LOCAL_PROCS ****/
|
|
|
|
case ORTE_DAEMON_SIGNAL_LOCAL_PROCS:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received signal_local_procs",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
/* unpack the jobid */
|
2007-07-23 22:36:33 +04:00
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the signal */
|
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &signal, &n, OPAL_INT32))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* signal them */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls.signal_local_procs(NULL, signal))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/**** ADD_LOCAL_PROCS ****/
|
|
|
|
case ORTE_DAEMON_ADD_LOCAL_PROCS:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received add_local_procs",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
/* launch the processes */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls.launch_local_procs(buffer))) {
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
|
|
|
|
"%s orted:comm:add_procs failed to launch on error %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_ERROR_NAME(ret)));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/**** DELIVER A MESSAGE TO THE LOCAL PROCS ****/
|
|
|
|
case ORTE_DAEMON_MESSAGE_LOCAL_PROCS:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received message_local_procs",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack the jobid of the procs that are to receive the message */
|
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack the tag where we are to deliver the message */
|
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &target_tag, &n, ORTE_RML_TAG))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
relay_msg = OBJ_NEW(opal_buffer_t);
|
|
|
|
opal_dss.copy_payload(relay_msg, buffer);
|
2007-07-23 22:36:33 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* if job=my_jobid, then this message is for us and not for our children */
|
|
|
|
if (ORTE_PROC_MY_NAME->jobid == job) {
|
2007-07-23 22:36:33 +04:00
|
|
|
/* if the target tag is our xcast_barrier or rml_update, then we have
|
|
|
|
* to handle the message as a special case. The RML has logic in it
|
|
|
|
* intended to make it easier to use. This special logic mandates that
|
|
|
|
* any message we "send" actually only goes into the queue for later
|
|
|
|
* transmission. Thus, since we are already in a recv when we enter
|
|
|
|
* the "process_commands" function, any attempt to "send" the relay
|
|
|
|
* buffer to ourselves will only be added to the queue - it won't
|
|
|
|
* actually be delivered until *after* we conclude the processing
|
|
|
|
* of the current recv.
|
|
|
|
*
|
|
|
|
* The problem here is that, for messages where we need to relay
|
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
|
|
|
* them along the orted chain, the rml_update
|
|
|
|
* message contains contact info we may well need in order to do
|
2007-07-23 22:36:33 +04:00
|
|
|
* the relay! So we need to process those messages immediately.
|
|
|
|
* The only way to accomplish that is to (a) detect that the
|
|
|
|
* buffer is intended for those tags, and then (b) process
|
|
|
|
* those buffers here.
|
|
|
|
*
|
|
|
|
*/
|
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
|
|
|
if (ORTE_RML_TAG_RML_INFO_UPDATE == target_tag) {
|
2007-07-23 22:36:33 +04:00
|
|
|
n = 1;
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(relay_msg, &rml_cmd, &n, ORTE_RML_CMD))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
/* initialize the routes to my peers - this will update the number
|
|
|
|
* of daemons in the system (i.e., orte_process_info.num_procs) as
|
|
|
|
* this might have changed
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_routed.init_routes(ORTE_PROC_MY_NAME->jobid, relay_msg))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* just deliver it to ourselves */
|
2008-02-28 04:57:57 +03:00
|
|
|
if ((ret = orte_rml.send_buffer(ORTE_PROC_MY_NAME, relay_msg, target_tag, 0)) < 0) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
} else {
|
|
|
|
ret = ORTE_SUCCESS;
|
2008-02-28 04:57:57 +03:00
|
|
|
opal_progress(); /* give us a chance to move the message along */
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* must be for our children - deliver the message */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls.deliver_message(job, relay_msg, target_tag))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
}
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
OBJ_RELEASE(relay_msg);
|
2007-07-23 22:36:33 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/**** EXIT COMMAND ****/
|
|
|
|
case ORTE_DAEMON_EXIT_CMD:
|
2008-02-28 04:57:57 +03:00
|
|
|
if (orte_process_info.hnp) {
|
Afraid this has a couple of things mixed into the commit. Couldn't be helped - had missed one commit prior to running out the door on vacation.
Fix race conditions in abnormal terminations. We had done a first-cut at this in a prior commit. However, the window remained partially open due to the fact that the HNP has multiple paths leading to orte_finalize. Most of our frameworks don't care if they are finalized more than once, but one of them does, which meant we segfaulted if orte_finalize got called more than once. Besides, we really shouldn't be doing that anyway.
So we now introduce a set of atomic locks that prevent us from multiply calling abort, attempting to call orte_finalize, etc. My initial tests indicate this is working cleanly, but since it is a race condition issue, more testing will have to be done before we know for sure that this problem has been licked.
Also, some updates relevant to the tool comm library snuck in here. Since those also touched the orted code (as did the prior changes), I didn't want to attempt to separate them out - besides, they are coming in soon anyway. More on them later as that functionality approaches completion.
This commit was SVN r17843.
2008-03-17 20:58:59 +03:00
|
|
|
/* if we are the HNP, do nothing - we will
|
2007-07-23 22:36:33 +04:00
|
|
|
* exit at our own sweet time
|
|
|
|
*/
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
/* eventually, we need to revise this so we only
|
|
|
|
* exit if all our children are dead. For now, treat
|
2008-02-28 04:57:57 +03:00
|
|
|
* the same as a "hard kill" command
|
2007-07-23 22:36:33 +04:00
|
|
|
*/
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received exit",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
2008-02-29 18:18:45 +03:00
|
|
|
/* trigger our appropriate exit procedure
|
|
|
|
* NOTE: this event will fire -after- any zero-time events
|
|
|
|
* so any pending relays -do- get sent first
|
2007-07-23 22:36:33 +04:00
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_wakeup(0);
|
2007-07-23 22:36:33 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
break;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
Afraid this has a couple of things mixed into the commit. Couldn't be helped - had missed one commit prior to running out the door on vacation.
Fix race conditions in abnormal terminations. We had done a first-cut at this in a prior commit. However, the window remained partially open due to the fact that the HNP has multiple paths leading to orte_finalize. Most of our frameworks don't care if they are finalized more than once, but one of them does, which meant we segfaulted if orte_finalize got called more than once. Besides, we really shouldn't be doing that anyway.
So we now introduce a set of atomic locks that prevent us from multiply calling abort, attempting to call orte_finalize, etc. My initial tests indicate this is working cleanly, but since it is a race condition issue, more testing will have to be done before we know for sure that this problem has been licked.
Also, some updates relevant to the tool comm library snuck in here. Since those also touched the orted code (as did the prior changes), I didn't want to attempt to separate them out - besides, they are coming in soon anyway. More on them later as that functionality approaches completion.
This commit was SVN r17843.
2008-03-17 20:58:59 +03:00
|
|
|
/**** HALT VM COMMAND ****/
|
|
|
|
case ORTE_DAEMON_HALT_VM_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received halt vm",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
/* trigger our appropriate exit procedure
|
|
|
|
* NOTE: this event will fire -after- any zero-time events
|
|
|
|
* so any pending relays -do- get sent first
|
|
|
|
*/
|
|
|
|
orte_wakeup(0);
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/**** SPAWN JOB COMMAND ****/
|
|
|
|
case ORTE_DAEMON_SPAWN_JOB_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received spawn job",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
job = ORTE_JOBID_INVALID;
|
|
|
|
/* can only process this if we are the HNP */
|
|
|
|
if (orte_process_info.hnp) {
|
|
|
|
/* unpack the job data */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &jdata, &n, ORTE_JOB))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto ANSWER_LAUNCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* launch it */
|
|
|
|
if (ORTE_SUCCESS != (ret = orte_plm.spawn(jdata))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto ANSWER_LAUNCH;
|
|
|
|
}
|
|
|
|
job = jdata->jobid;
|
|
|
|
}
|
|
|
|
ANSWER_LAUNCH:
|
|
|
|
/* pack the jobid to be returned */
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &job, 1, ORTE_JOBID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* return response */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
2007-07-23 22:36:33 +04:00
|
|
|
/**** CONTACT QUERY COMMAND ****/
|
|
|
|
case ORTE_DAEMON_CONTACT_QUERY_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received contact query",
|
2008-02-28 04:57:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
2007-07-23 22:36:33 +04:00
|
|
|
}
|
|
|
|
/* send back contact info */
|
|
|
|
contact_info = orte_rml.get_contact_info();
|
|
|
|
|
|
|
|
if (NULL == contact_info) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERROR);
|
|
|
|
ret = ORTE_ERROR;
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/* setup buffer with answer */
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &contact_info, 1, OPAL_STRING))) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
2008-02-28 22:58:32 +03:00
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, tag, 0,
|
|
|
|
send_callback, NULL)) {
|
2007-07-23 22:36:33 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**** REPORT_JOB_INFO_CMD COMMAND ****/
|
|
|
|
case ORTE_DAEMON_REPORT_JOB_INFO_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received job info query",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
/* if we are not the HNP, we can do nothing - report
|
|
|
|
* back 0 procs so the tool won't hang
|
|
|
|
*/
|
|
|
|
if (!orte_process_info.hnp) {
|
|
|
|
orte_std_cntr_t zero=0;
|
|
|
|
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &zero, 1, ORTE_STD_CNTR))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* if we are the HNP, process the request */
|
|
|
|
orte_std_cntr_t i, num_jobs=0;
|
2008-02-29 05:39:39 +03:00
|
|
|
orte_job_t **jobs=NULL, *jobdat;
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
/* unpack the jobid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup return */
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* if they asked for a specific job, then just get that info */
|
|
|
|
if (ORTE_JOBID_WILDCARD != job) {
|
|
|
|
if (NULL != (jobdat = orte_get_job_data_object(job))) {
|
|
|
|
num_jobs = 1;
|
|
|
|
jobs = &jobdat;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* count number of jobs */
|
|
|
|
for (i=0; i < orte_job_data->size; i++) {
|
|
|
|
if (NULL == orte_job_data->addr[i]) break;
|
|
|
|
num_jobs++;
|
|
|
|
}
|
|
|
|
jobs = (orte_job_t**)orte_job_data->addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pack the answer */
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &num_jobs, 1, ORTE_STD_CNTR))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
if (0 < num_jobs) {
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, jobs, num_jobs, ORTE_JOB))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2007-07-23 22:36:33 +04:00
|
|
|
break;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**** REPORT_NODE_INFO_CMD COMMAND ****/
|
|
|
|
case ORTE_DAEMON_REPORT_NODE_INFO_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received node info query",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
/* if we are not the HNP, we can do nothing - report
|
|
|
|
* back 0 nodes so the tool won't hang
|
|
|
|
*/
|
|
|
|
if (!orte_process_info.hnp) {
|
|
|
|
orte_std_cntr_t zero=0;
|
|
|
|
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &zero, 1, ORTE_STD_CNTR))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* if we are the HNP, process the request */
|
|
|
|
orte_std_cntr_t i, num_nodes=0;
|
|
|
|
orte_node_t **nodes;
|
|
|
|
orte_nodeid_t nid;
|
|
|
|
|
|
|
|
/* unpack the nodeid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &nid, &n, ORTE_NODEID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup return */
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* if they asked for a specific node, then just get that info */
|
|
|
|
if (ORTE_NODEID_WILDCARD != nid) {
|
|
|
|
/* find this node */
|
|
|
|
nodes = (orte_node_t**)orte_node_pool->addr;
|
|
|
|
for (i=0; i < orte_node_pool->size; i++) {
|
|
|
|
if (NULL == nodes[i]) break; /* stop when we get past the end of data */
|
|
|
|
if (nid == nodes[i]->nodeid) {
|
|
|
|
nodes = &nodes[i];
|
|
|
|
num_nodes = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* count number of nodes */
|
|
|
|
for (i=0; i < orte_node_pool->size; i++) {
|
|
|
|
if (NULL == orte_node_pool->addr[i]) break;
|
|
|
|
num_nodes++;
|
|
|
|
}
|
|
|
|
nodes = (orte_node_t**)orte_node_pool->addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pack the answer */
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &num_nodes, 1, ORTE_STD_CNTR))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
if (0 < num_nodes) {
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, nodes, num_nodes, ORTE_NODE))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/**** REPORT_PROC_INFO_CMD COMMAND ****/
|
|
|
|
case ORTE_DAEMON_REPORT_PROC_INFO_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received proc info query",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
/* if we are not the HNP, we can do nothing - report
|
|
|
|
* back 0 procs so the tool won't hang
|
|
|
|
*/
|
|
|
|
if (!orte_process_info.hnp) {
|
|
|
|
orte_std_cntr_t zero=0;
|
|
|
|
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &zero, 1, ORTE_STD_CNTR))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* if we are the HNP, process the request */
|
|
|
|
orte_job_t *jdata;
|
2008-02-29 05:39:39 +03:00
|
|
|
orte_proc_t **procs=NULL;
|
2008-02-28 04:57:57 +03:00
|
|
|
orte_vpid_t num_procs=0, vpid;
|
|
|
|
orte_std_cntr_t i;
|
|
|
|
|
|
|
|
/* setup the answer */
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* unpack the jobid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* look up job data object */
|
|
|
|
if (NULL == (jdata = orte_get_job_data_object(job))) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
goto PACK_ANSWER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack the vpid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &vpid, &n, ORTE_VPID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto PACK_ANSWER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if they asked for a specific proc, then just get that info */
|
|
|
|
if (ORTE_VPID_WILDCARD != vpid) {
|
|
|
|
/* find this proc */
|
|
|
|
procs = (orte_proc_t**)jdata->procs->addr;
|
|
|
|
for (i=0; i < jdata->procs->size; i++) {
|
|
|
|
if (NULL == procs[i]) break; /* stop when we get past the end of data */
|
|
|
|
if (vpid == procs[i]->name.vpid) {
|
|
|
|
procs = &procs[i];
|
|
|
|
num_procs = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
procs = (orte_proc_t**)jdata->procs->addr;
|
|
|
|
num_procs = jdata->num_procs;
|
|
|
|
}
|
|
|
|
|
|
|
|
PACK_ANSWER:
|
|
|
|
/* pack number of procs */
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &num_procs, 1, ORTE_VPID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto SEND_ANSWER;
|
|
|
|
}
|
|
|
|
if (0 < num_procs) {
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, procs, jdata->num_procs, ORTE_PROC))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto SEND_ANSWER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEND_ANSWER:
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
2007-07-23 22:36:33 +04:00
|
|
|
break;
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
/**** ATTACH_STDIO COMMAND ****/
|
|
|
|
case ORTE_DAEMON_ATTACH_STDOUT_CMD:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_cmd: received attach stdio cmd",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
/* if we are not the HNP, we can do nothing - report
|
|
|
|
* back error so the tool won't hang
|
|
|
|
*/
|
|
|
|
if (!orte_process_info.hnp) {
|
|
|
|
int status=ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &status, 1, OPAL_INT))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
OBJ_RELEASE(answer);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* if we are the HNP, process the request */
|
|
|
|
int fd, status;
|
|
|
|
orte_vpid_t vpid;
|
|
|
|
orte_process_name_t source;
|
|
|
|
|
|
|
|
/* setup the answer */
|
|
|
|
answer = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* unpack the jobid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &job, &n, ORTE_JOBID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack the vpid */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &vpid, &n, ORTE_VPID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto PACK_ANSWER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack the file descriptor */
|
|
|
|
n = 1;
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &fd, &n, OPAL_INT))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto PACK_ANSWER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tell the iof to attach it */
|
|
|
|
status = orte_iof.pull(
|
|
|
|
/* if they asked for a specific proc, then just get that info */
|
|
|
|
if (ORTE_VPID_WILDCARD != vpid) {
|
|
|
|
/* find this proc */
|
|
|
|
procs = (orte_proc_t**)jdata->procs->addr;
|
|
|
|
for (i=0; i < jdata->procs->size; i++) {
|
|
|
|
if (NULL == procs[i]) break; /* stop when we get past the end of data */
|
|
|
|
if (vpid == procs[i]->name.vpid) {
|
|
|
|
procs = &procs[i];
|
|
|
|
num_procs = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
procs = (orte_proc_t**)jdata->procs->addr;
|
|
|
|
num_procs = jdata->num_procs;
|
|
|
|
}
|
|
|
|
|
|
|
|
PACK_ANSWER:
|
|
|
|
/* pack number of procs */
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &num_procs, 1, ORTE_VPID))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto SEND_ANSWER;
|
|
|
|
}
|
|
|
|
if (0 < num_procs) {
|
|
|
|
if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, procs, jdata->num_procs, ORTE_PROC))) {
|
|
|
|
ORTE_ERROR_LOG(ret);
|
|
|
|
goto SEND_ANSWER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SEND_ANSWER:
|
|
|
|
/* callback function will release buffer */
|
|
|
|
if (0 > orte_rml.send_buffer_nb(sender, answer, ORTE_RML_TAG_TOOL, 0,
|
|
|
|
send_callback, NULL)) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
|
|
|
|
ret = ORTE_ERR_COMM_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2008-02-29 23:10:31 +03:00
|
|
|
break;
|
|
|
|
|
2007-07-23 22:36:33 +04:00
|
|
|
/**** HEARTBEAT COMMAND ****/
|
|
|
|
case ORTE_DAEMON_HEARTBEAT_CMD:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_IMPLEMENTED);
|
|
|
|
ret = ORTE_ERR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
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
|
|
|
/**** SYNC FROM LOCAL PROC ****/
|
|
|
|
case ORTE_DAEMON_SYNC_BY_PROC:
|
|
|
|
if (orte_debug_daemons_flag) {
|
|
|
|
opal_output(0, "%s orted_recv: received sync from local proc %s",
|
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(sender));
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
if (ORTE_SUCCESS != (ret = orte_odls.require_sync(sender, buffer))) {
|
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(ret);
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-07-23 22:36:33 +04:00
|
|
|
default:
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
|
|
ret = ORTE_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
return ret;
|
|
|
|
}
|