2004-12-22 01:16:09 +03:00
|
|
|
/*
|
2007-06-09 02:59:31 +04:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-12-22 01:16:09 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-12-22 01:16:09 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/constants.h"
|
|
|
|
|
2004-12-22 01:16:09 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_param.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.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 04:00:49 +04:00
|
|
|
#include "orte/util/proc_info.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/iof/iof.h"
|
|
|
|
#include "orte/mca/iof/base/base.h"
|
2008-06-18 07:15:56 +04:00
|
|
|
|
2004-12-22 01:16:09 +03:00
|
|
|
/*
|
|
|
|
* The following file was created by configure. It contains extern
|
|
|
|
* statements and the definition of an array of pointers to each
|
2005-03-14 23:57:21 +03:00
|
|
|
* component's public orte_base_component_t struct.
|
2004-12-22 01:16:09 +03:00
|
|
|
*/
|
|
|
|
|
2005-07-04 22:24:58 +04:00
|
|
|
#include "orte/mca/iof/base/static-components.h"
|
2004-12-22 01:16:09 +03:00
|
|
|
|
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 04:00:49 +04:00
|
|
|
orte_iof_base_module_t orte_iof;
|
|
|
|
|
|
|
|
|
2008-06-18 07:15:56 +04:00
|
|
|
#if ORTE_DISABLE_FULL_SUPPORT
|
|
|
|
/* have to include a bogus function here so that
|
|
|
|
* the build system sees at least one function
|
|
|
|
* in the library
|
|
|
|
*/
|
|
|
|
int orte_iof_base_open(void)
|
|
|
|
{
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2004-12-22 01:16:09 +03:00
|
|
|
|
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 04:00:49 +04:00
|
|
|
/* class instances */
|
|
|
|
static void orte_iof_base_sink_construct(orte_iof_sink_t* ptr)
|
|
|
|
{
|
|
|
|
OBJ_CONSTRUCT(&ptr->wev, orte_iof_write_event_t);
|
|
|
|
}
|
|
|
|
static void orte_iof_base_sink_destruct(orte_iof_sink_t* ptr)
|
|
|
|
{
|
|
|
|
OBJ_DESTRUCT(&ptr->wev);
|
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_sink_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
orte_iof_base_sink_construct,
|
|
|
|
orte_iof_base_sink_destruct);
|
|
|
|
|
|
|
|
|
|
|
|
static void orte_iof_base_read_event_construct(orte_iof_read_event_t* rev)
|
|
|
|
{
|
|
|
|
memset(&rev->ev,0,sizeof(rev->ev));
|
|
|
|
}
|
|
|
|
static void orte_iof_base_read_event_destruct(orte_iof_read_event_t* rev)
|
|
|
|
{
|
|
|
|
opal_event_del(&rev->ev);
|
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_read_event_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
orte_iof_base_read_event_construct,
|
|
|
|
orte_iof_base_read_event_destruct);
|
|
|
|
|
|
|
|
static void orte_iof_base_write_event_construct(orte_iof_write_event_t* wev)
|
|
|
|
{
|
|
|
|
wev->pending = false;
|
|
|
|
wev->fd = -1;
|
|
|
|
OBJ_CONSTRUCT(&wev->outputs, opal_list_t);
|
|
|
|
}
|
|
|
|
static void orte_iof_base_write_event_destruct(orte_iof_write_event_t* wev)
|
|
|
|
{
|
|
|
|
opal_event_del(&wev->ev);
|
|
|
|
OBJ_DESTRUCT(&wev->outputs);
|
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_write_event_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
orte_iof_base_write_event_construct,
|
|
|
|
orte_iof_base_write_event_destruct);
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_write_output_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2004-12-22 01:16:09 +03:00
|
|
|
/*
|
|
|
|
* Global variables
|
|
|
|
*/
|
2005-01-12 23:51:34 +03:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
orte_iof_base_t orte_iof_base;
|
2004-12-22 01:16:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components, or the one
|
|
|
|
* that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_iof_base_open(void)
|
2004-12-22 01:16:09 +03:00
|
|
|
{
|
2005-01-12 23:51:34 +03:00
|
|
|
/* Initialize globals */
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&orte_iof_base.iof_components_opened, opal_list_t);
|
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 04:00:49 +04:00
|
|
|
OBJ_CONSTRUCT(&orte_iof_base.iof_write_output_lock, opal_mutex_t);
|
|
|
|
|
|
|
|
/* daemons do not need to do this as they do not write out stdout/err */
|
|
|
|
if (!orte_process_info.daemon) {
|
|
|
|
/* setup the stdout event */
|
|
|
|
OBJ_CONSTRUCT(&orte_iof_base.iof_write_stdout, orte_iof_write_event_t);
|
|
|
|
orte_iof_base.iof_write_stdout.fd = 1;
|
|
|
|
/* create the write event, but don't add it until we need it */
|
|
|
|
opal_event_set(&orte_iof_base.iof_write_stdout.ev,
|
|
|
|
orte_iof_base.iof_write_stdout.fd,
|
|
|
|
OPAL_EV_WRITE|OPAL_EV_PERSIST,
|
|
|
|
orte_iof_base_write_handler,
|
|
|
|
&orte_iof_base.iof_write_stdout);
|
|
|
|
|
|
|
|
/* setup the stderr event */
|
|
|
|
OBJ_CONSTRUCT(&orte_iof_base.iof_write_stderr, orte_iof_write_event_t);
|
|
|
|
orte_iof_base.iof_write_stderr.fd = 2;
|
|
|
|
/* create the write event, but don't add it until we need it */
|
|
|
|
opal_event_set(&orte_iof_base.iof_write_stderr.ev,
|
|
|
|
orte_iof_base.iof_write_stderr.fd,
|
|
|
|
OPAL_EV_WRITE|OPAL_EV_PERSIST,
|
|
|
|
orte_iof_base_write_handler,
|
|
|
|
&orte_iof_base.iof_write_stderr);
|
|
|
|
}
|
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
orte_iof_base.iof_output = opal_output_open(NULL);
|
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 04:00:49 +04:00
|
|
|
|
2005-01-12 23:51:34 +03:00
|
|
|
/* Open up all available components */
|
2006-02-12 04:33:29 +03:00
|
|
|
if (ORTE_SUCCESS !=
|
2005-08-15 22:25:35 +04:00
|
|
|
mca_base_components_open("iof", orte_iof_base.iof_output,
|
|
|
|
mca_iof_base_static_components,
|
2005-04-13 07:19:48 +04:00
|
|
|
&orte_iof_base.iof_components_opened,
|
|
|
|
true)) {
|
2005-08-15 22:25:35 +04:00
|
|
|
return ORTE_ERROR;
|
2005-01-12 23:51:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
2005-08-15 22:25:35 +04:00
|
|
|
return ORTE_SUCCESS;
|
2004-12-22 01:16:09 +03:00
|
|
|
}
|
2008-06-18 07:15:56 +04:00
|
|
|
#endif
|