Roll in the revamped IOF subsystem. Per the devel mailing list email, this is a complete rewrite of the iof framework designed to simplify the code for maintainability, and to support features we had planned to do, but were too difficult to implement in the old code. Specifically, the new code:
1. completely and cleanly separates responsibilities between the HNP, orted, and tool components.
2. removes all wireup messaging during launch and shutdown.
3. maintains flow control for stdin to avoid large-scale consumption of memory by orteds when large input files are forwarded. This is done using an xon/xoff protocol.
4. enables specification of stdin recipients on the mpirun cmd line. Allowed options include rank, "all", or "none". Default is rank 0.
5. creates a new MPI_Info key "ompi_stdin_target" that supports the above options for child jobs. Default is "none".
6. adds a new tool "orte-iof" that can connect to a running mpirun and display the output. Cmd line options allow selection of any combination of stdout, stderr, and stddiag. Default is stdout.
7. adds a new mpirun and orte-iof cmd line option "tag-output" that will tag each line of output with process name and stream ident. For example, "[1,0]<stdout>this is output"
This is not intended for the 1.3 release as it is a major change requiring considerable soak time.
This commit was SVN r19767.
2008-10-18 00:00:49 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-01-11 02:30:00 +00:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
Roll in the revamped IOF subsystem. Per the devel mailing list email, this is a complete rewrite of the iof framework designed to simplify the code for maintainability, and to support features we had planned to do, but were too difficult to implement in the old code. Specifically, the new code:
1. completely and cleanly separates responsibilities between the HNP, orted, and tool components.
2. removes all wireup messaging during launch and shutdown.
3. maintains flow control for stdin to avoid large-scale consumption of memory by orteds when large input files are forwarded. This is done using an xon/xoff protocol.
4. enables specification of stdin recipients on the mpirun cmd line. Allowed options include rank, "all", or "none". Default is rank 0.
5. creates a new MPI_Info key "ompi_stdin_target" that supports the above options for child jobs. Default is "none".
6. adds a new tool "orte-iof" that can connect to a running mpirun and display the output. Cmd line options allow selection of any combination of stdout, stderr, and stddiag. Default is stdout.
7. adds a new mpirun and orte-iof cmd line option "tag-output" that will tag each line of output with process name and stream ident. For example, "[1,0]<stdout>this is output"
This is not intended for the 1.3 release as it is a major change requiring considerable soak time.
This commit was SVN r19767.
2008-10-18 00:00:49 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "orte_config.h"
|
|
|
|
#include "orte/constants.h"
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif /* HAVE_STRING_H */
|
|
|
|
|
|
|
|
|
|
|
|
#include "orte/mca/rml/rml.h"
|
2009-02-14 02:26:12 +00:00
|
|
|
#include "orte/mca/rml/rml_types.h"
|
Roll in the revamped IOF subsystem. Per the devel mailing list email, this is a complete rewrite of the iof framework designed to simplify the code for maintainability, and to support features we had planned to do, but were too difficult to implement in the old code. Specifically, the new code:
1. completely and cleanly separates responsibilities between the HNP, orted, and tool components.
2. removes all wireup messaging during launch and shutdown.
3. maintains flow control for stdin to avoid large-scale consumption of memory by orteds when large input files are forwarded. This is done using an xon/xoff protocol.
4. enables specification of stdin recipients on the mpirun cmd line. Allowed options include rank, "all", or "none". Default is rank 0.
5. creates a new MPI_Info key "ompi_stdin_target" that supports the above options for child jobs. Default is "none".
6. adds a new tool "orte-iof" that can connect to a running mpirun and display the output. Cmd line options allow selection of any combination of stdout, stderr, and stddiag. Default is stdout.
7. adds a new mpirun and orte-iof cmd line option "tag-output" that will tag each line of output with process name and stream ident. For example, "[1,0]<stdout>this is output"
This is not intended for the 1.3 release as it is a major change requiring considerable soak time.
This commit was SVN r19767.
2008-10-18 00:00:49 +00:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "orte/runtime/orte_wait.h"
|
|
|
|
|
|
|
|
#include "orte/mca/iof/iof.h"
|
|
|
|
#include "orte/mca/iof/base/base.h"
|
|
|
|
|
|
|
|
#include "iof_tool.h"
|
|
|
|
|
|
|
|
|
|
|
|
static int tool_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag, int fd);
|
|
|
|
|
|
|
|
static int tool_pull(const orte_process_name_t* src_name,
|
|
|
|
orte_iof_tag_t src_tag,
|
|
|
|
int fd);
|
|
|
|
|
|
|
|
static int tool_close(const orte_process_name_t* peer,
|
|
|
|
orte_iof_tag_t source_tag);
|
|
|
|
|
|
|
|
static int tool_ft_event(int state);
|
|
|
|
|
|
|
|
orte_iof_base_module_t orte_iof_tool_module = {
|
|
|
|
tool_push,
|
|
|
|
tool_pull,
|
|
|
|
tool_close,
|
|
|
|
tool_ft_event
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Push data from the specified file descriptor
|
|
|
|
* to the indicated SINK set of peers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int tool_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag, int fd)
|
|
|
|
{
|
|
|
|
/* at this time, we do not allow tools to push data into the
|
|
|
|
* stdin of a job. This is due to potential confusion over which
|
|
|
|
* stdin is being read/used, and the impossibility of resolving
|
|
|
|
* potential interleaving of the data
|
|
|
|
*/
|
|
|
|
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Callback when non-blocking RML send completes.
|
|
|
|
*/
|
|
|
|
static void send_cb(int status, orte_process_name_t *peer,
|
|
|
|
opal_buffer_t *buf, orte_rml_tag_t tag,
|
|
|
|
void *cbdata)
|
|
|
|
{
|
|
|
|
/* nothing to do here - just release buffer and return */
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pull data from the specified set of SOURCE peers and
|
|
|
|
* dump to the indicated file descriptor.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int tool_pull(const orte_process_name_t* src_name,
|
|
|
|
orte_iof_tag_t src_tag,
|
|
|
|
int fd)
|
|
|
|
{
|
|
|
|
/* if we are a tool, then we need to request the HNP to please
|
|
|
|
* forward the data from the specified process to us. Note that
|
|
|
|
* the HNP will return an error if the specified stream of any
|
|
|
|
* intended recipient is not open. By default, stdout/err/diag
|
|
|
|
* are all left open. However, the user can also direct us to
|
|
|
|
* close any or all of those streams, so the success of this call
|
|
|
|
* will depend upon how the user executed the application
|
|
|
|
*/
|
|
|
|
|
|
|
|
opal_buffer_t *buf;
|
|
|
|
orte_iof_tag_t tag;
|
|
|
|
orte_process_name_t hnp;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"%s pulling output for proc %s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(src_name)));
|
Roll in the revamped IOF subsystem. Per the devel mailing list email, this is a complete rewrite of the iof framework designed to simplify the code for maintainability, and to support features we had planned to do, but were too difficult to implement in the old code. Specifically, the new code:
1. completely and cleanly separates responsibilities between the HNP, orted, and tool components.
2. removes all wireup messaging during launch and shutdown.
3. maintains flow control for stdin to avoid large-scale consumption of memory by orteds when large input files are forwarded. This is done using an xon/xoff protocol.
4. enables specification of stdin recipients on the mpirun cmd line. Allowed options include rank, "all", or "none". Default is rank 0.
5. creates a new MPI_Info key "ompi_stdin_target" that supports the above options for child jobs. Default is "none".
6. adds a new tool "orte-iof" that can connect to a running mpirun and display the output. Cmd line options allow selection of any combination of stdout, stderr, and stddiag. Default is stdout.
7. adds a new mpirun and orte-iof cmd line option "tag-output" that will tag each line of output with process name and stream ident. For example, "[1,0]<stdout>this is output"
This is not intended for the 1.3 release as it is a major change requiring considerable soak time.
This commit was SVN r19767.
2008-10-18 00:00:49 +00:00
|
|
|
|
|
|
|
buf = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* setup the tag to pull from HNP */
|
|
|
|
tag = src_tag | ORTE_IOF_PULL;
|
|
|
|
|
|
|
|
/* pack the tag - we do this first so that flow control messages can
|
|
|
|
* consist solely of the tag
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, &tag, 1, ORTE_IOF_TAG))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
/* pack the name of the source */
|
|
|
|
if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, src_name, 1, ORTE_NAME))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* send the buffer to the correct HNP */
|
|
|
|
ORTE_HNP_NAME_FROM_JOB(&hnp, src_name->jobid);
|
|
|
|
orte_rml.send_buffer_nb(&hnp, buf, ORTE_RML_TAG_IOF_HNP,
|
|
|
|
0, send_cb, NULL);
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int tool_close(const orte_process_name_t* src_name,
|
|
|
|
orte_iof_tag_t src_tag)
|
|
|
|
{
|
|
|
|
/* if we are a tool, then we need to request the HNP to stop
|
|
|
|
* forwarding data from this process/stream
|
|
|
|
*/
|
|
|
|
|
|
|
|
opal_buffer_t *buf;
|
|
|
|
orte_iof_tag_t tag;
|
|
|
|
orte_process_name_t hnp;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"%s closing output for proc %s",
|
2009-03-05 21:50:47 +00:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(src_name)));
|
Roll in the revamped IOF subsystem. Per the devel mailing list email, this is a complete rewrite of the iof framework designed to simplify the code for maintainability, and to support features we had planned to do, but were too difficult to implement in the old code. Specifically, the new code:
1. completely and cleanly separates responsibilities between the HNP, orted, and tool components.
2. removes all wireup messaging during launch and shutdown.
3. maintains flow control for stdin to avoid large-scale consumption of memory by orteds when large input files are forwarded. This is done using an xon/xoff protocol.
4. enables specification of stdin recipients on the mpirun cmd line. Allowed options include rank, "all", or "none". Default is rank 0.
5. creates a new MPI_Info key "ompi_stdin_target" that supports the above options for child jobs. Default is "none".
6. adds a new tool "orte-iof" that can connect to a running mpirun and display the output. Cmd line options allow selection of any combination of stdout, stderr, and stddiag. Default is stdout.
7. adds a new mpirun and orte-iof cmd line option "tag-output" that will tag each line of output with process name and stream ident. For example, "[1,0]<stdout>this is output"
This is not intended for the 1.3 release as it is a major change requiring considerable soak time.
This commit was SVN r19767.
2008-10-18 00:00:49 +00:00
|
|
|
|
|
|
|
buf = OBJ_NEW(opal_buffer_t);
|
|
|
|
|
|
|
|
/* setup the tag to stop the copy */
|
|
|
|
tag = src_tag | ORTE_IOF_CLOSE;
|
|
|
|
|
|
|
|
/* pack the tag - we do this first so that flow control messages can
|
|
|
|
* consist solely of the tag
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, &tag, 1, ORTE_IOF_TAG))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
/* pack the name of the source */
|
|
|
|
if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, src_name, 1, ORTE_NAME))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
OBJ_RELEASE(buf);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* flag that the close is incomplete */
|
|
|
|
mca_iof_tool_component.closed = false;
|
|
|
|
|
|
|
|
/* send the buffer to the correct HNP */
|
|
|
|
ORTE_HNP_NAME_FROM_JOB(&hnp, src_name->jobid);
|
|
|
|
orte_rml.send_buffer_nb(&hnp, buf, ORTE_RML_TAG_IOF_HNP,
|
|
|
|
0, send_cb, NULL);
|
|
|
|
|
|
|
|
/* wait right here until the close is confirmed */
|
|
|
|
ORTE_PROGRESSED_WAIT(mca_iof_tool_component.closed, 0, 1);
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FT event
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int tool_ft_event(int state)
|
|
|
|
{
|
|
|
|
return ORTE_ERR_NOT_IMPLEMENTED;
|
|
|
|
}
|