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.
|
2011-06-24 00:38:02 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2015-06-24 06:59:57 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-12-22 01:16:09 +03:00
|
|
|
* 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.
|
2013-02-28 05:35:55 +04:00
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
2015-02-04 18:59:47 +03:00
|
|
|
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
2016-02-16 07:00:57 +03:00
|
|
|
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
|
2015-03-10 08:37:53 +03:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2004-12-22 01:16:09 +03:00
|
|
|
* $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2004-12-22 01:16:09 +03:00
|
|
|
* Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2004-12-22 01:16:09 +03:00
|
|
|
* $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"
|
|
|
|
|
2009-03-13 05:10:32 +03:00
|
|
|
#include <string.h>
|
2004-12-22 01:16:09 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-03-06 06:50:44 +03:00
|
|
|
#include "orte/mca/mca.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/base/base.h"
|
2009-01-31 01:47:30 +03:00
|
|
|
#include "opal/util/os_dirpath.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2009-01-31 01:47:30 +03:00
|
|
|
#include "opal/util/basename.h"
|
2008-02-28 04:57:57 +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
|
|
|
#include "orte/util/proc_info.h"
|
2008-12-10 23:40:47 +03:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "orte/util/name_fns.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
|
|
|
|
2009-07-28 21:06:16 +04:00
|
|
|
orte_iof_base_module_t orte_iof = {0};
|
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 */
|
2012-05-03 01:00:22 +04:00
|
|
|
static void orte_iof_job_construct(orte_iof_job_t *ptr)
|
|
|
|
{
|
|
|
|
ptr->jdata = NULL;
|
|
|
|
OBJ_CONSTRUCT(&ptr->xoff, opal_bitmap_t);
|
|
|
|
}
|
|
|
|
static void orte_iof_job_destruct(orte_iof_job_t *ptr)
|
|
|
|
{
|
|
|
|
if (NULL != ptr->jdata) {
|
|
|
|
OBJ_RELEASE(ptr->jdata);
|
|
|
|
}
|
|
|
|
OBJ_DESTRUCT(&ptr->xoff);
|
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_job_t,
|
|
|
|
opal_object_t,
|
|
|
|
orte_iof_job_construct,
|
|
|
|
orte_iof_job_destruct);
|
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
static void orte_iof_base_proc_construct(orte_iof_proc_t* ptr)
|
|
|
|
{
|
2016-02-19 21:10:08 +03:00
|
|
|
ptr->stdinev = NULL;
|
2008-12-10 23:40:47 +03:00
|
|
|
ptr->revstdout = NULL;
|
|
|
|
ptr->revstderr = NULL;
|
|
|
|
ptr->revstddiag = NULL;
|
2016-02-18 20:27:52 +03:00
|
|
|
ptr->subscribers = NULL;
|
|
|
|
ptr->copy = true;
|
2008-12-10 23:40:47 +03:00
|
|
|
}
|
|
|
|
static void orte_iof_base_proc_destruct(orte_iof_proc_t* ptr)
|
|
|
|
{
|
2016-02-19 21:10:08 +03:00
|
|
|
if (NULL != ptr->stdinev) {
|
|
|
|
OBJ_RELEASE(ptr->stdinev);
|
2016-02-16 07:00:57 +03:00
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
if (NULL != ptr->revstdout) {
|
|
|
|
OBJ_RELEASE(ptr->revstdout);
|
|
|
|
}
|
|
|
|
if (NULL != ptr->revstderr) {
|
|
|
|
OBJ_RELEASE(ptr->revstderr);
|
|
|
|
}
|
|
|
|
if (NULL != ptr->revstddiag) {
|
|
|
|
OBJ_RELEASE(ptr->revstddiag);
|
|
|
|
}
|
2016-02-18 20:27:52 +03:00
|
|
|
if (NULL != ptr->subscribers) {
|
|
|
|
OPAL_LIST_RELEASE(ptr->subscribers);
|
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(orte_iof_proc_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
orte_iof_base_proc_construct,
|
|
|
|
orte_iof_base_proc_destruct);
|
|
|
|
|
|
|
|
|
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
|
|
|
static void orte_iof_base_sink_construct(orte_iof_sink_t* ptr)
|
|
|
|
{
|
2009-01-31 01:47:30 +03:00
|
|
|
ptr->daemon.jobid = ORTE_JOBID_INVALID;
|
|
|
|
ptr->daemon.vpid = ORTE_VPID_INVALID;
|
2008-12-10 23:40:47 +03:00
|
|
|
ptr->wev = OBJ_NEW(orte_iof_write_event_t);
|
2012-05-03 01:00:22 +04:00
|
|
|
ptr->xoff = false;
|
2015-02-04 18:59:47 +03:00
|
|
|
ptr->exclusive = false;
|
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
|
|
|
}
|
|
|
|
static void orte_iof_base_sink_destruct(orte_iof_sink_t* ptr)
|
|
|
|
{
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_iof_base_framework.framework_output,
|
2008-12-10 23:40:47 +03:00
|
|
|
"%s iof: closing sink for process %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
ORTE_NAME_PRINT(&ptr->name)));
|
2016-03-02 05:12:53 +03:00
|
|
|
if (NULL != ptr->wev && 0 <= ptr->wev->fd) {
|
2008-12-10 23:40:47 +03:00
|
|
|
OBJ_RELEASE(ptr->wev);
|
|
|
|
}
|
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_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)
|
|
|
|
{
|
2016-02-16 07:00:57 +03:00
|
|
|
rev->proc = NULL;
|
2011-09-11 22:57:14 +04:00
|
|
|
rev->fd = -1;
|
|
|
|
rev->active = false;
|
2012-04-06 18:23:13 +04:00
|
|
|
rev->ev = opal_event_alloc();
|
2016-02-16 07:00:57 +03:00
|
|
|
rev->sink = 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
|
|
|
}
|
|
|
|
static void orte_iof_base_read_event_destruct(orte_iof_read_event_t* rev)
|
|
|
|
{
|
2016-02-16 07:00:57 +03:00
|
|
|
orte_iof_proc_t *proct = (orte_iof_proc_t*)rev->proc;
|
|
|
|
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_free(rev->ev);
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
if (0 <= rev->fd) {
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_iof_base_framework.framework_output,
|
2008-12-10 23:40:47 +03:00
|
|
|
"%s iof: closing fd %d for process %s",
|
2016-02-16 07:00:57 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), rev->fd,
|
|
|
|
(NULL == proct) ? "UNKNOWN" : ORTE_NAME_PRINT(&proct->name)));
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
close(rev->fd);
|
2011-09-11 22:57:14 +04:00
|
|
|
rev->fd = -1;
|
2008-12-10 23:40:47 +03:00
|
|
|
}
|
2016-02-16 07:00:57 +03:00
|
|
|
if (NULL != rev->sink) {
|
|
|
|
OBJ_RELEASE(rev->sink);
|
|
|
|
}
|
|
|
|
if (NULL != proct) {
|
|
|
|
OBJ_RELEASE(proct);
|
|
|
|
}
|
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_CLASS_INSTANCE(orte_iof_read_event_t,
|
2008-12-10 23:40:47 +03:00
|
|
|
opal_object_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
|
|
|
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);
|
2012-04-06 18:23:13 +04:00
|
|
|
wev->ev = opal_event_alloc();
|
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
|
|
|
}
|
|
|
|
static void orte_iof_base_write_event_destruct(orte_iof_write_event_t* wev)
|
|
|
|
{
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_free(wev->ev);
|
2014-10-10 07:58:46 +04:00
|
|
|
if (ORTE_PROC_IS_HNP && NULL != orte_xml_fp) {
|
2009-09-02 22:03:10 +04:00
|
|
|
int xmlfd = fileno(orte_xml_fp);
|
|
|
|
if (xmlfd == wev->fd) {
|
|
|
|
/* don't close this one - will get it later */
|
|
|
|
OBJ_DESTRUCT(&wev->outputs);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
if (2 < wev->fd) {
|
2013-03-28 01:14:43 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_iof_base_framework.framework_output,
|
2008-12-10 23:40:47 +03:00
|
|
|
"%s iof: closing fd %d for write event",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), wev->fd));
|
2008-12-10 23:40:47 +03:00
|
|
|
close(wev->fd);
|
|
|
|
}
|
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_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
|
|
|
|
2015-05-08 03:17:00 +03:00
|
|
|
orte_iof_base_t orte_iof_base = {0};
|
2004-12-22 01:16:09 +03:00
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
static int orte_iof_base_register(mca_base_register_flag_t flags)
|
2013-03-28 01:09:41 +04:00
|
|
|
{
|
|
|
|
/* check for maximum number of pending output messages */
|
2013-11-13 23:36:43 +04:00
|
|
|
orte_iof_base.output_limit = (size_t) INT_MAX;
|
2013-03-28 01:09:41 +04:00
|
|
|
(void) mca_base_var_register("orte", "iof", "base", "output_limit",
|
|
|
|
"Maximum backlog of output messages [default: unlimited]",
|
|
|
|
MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&orte_iof_base.output_limit);
|
|
|
|
|
|
|
|
/* check for files to be sent to stdin of procs */
|
|
|
|
orte_iof_base.input_files = NULL;
|
|
|
|
(void) mca_base_var_register("orte", "iof","base", "input_files",
|
|
|
|
"Comma-separated list of input files to be read and sent to stdin of procs (default: NULL)",
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&orte_iof_base.input_files);
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
2004-12-22 01:16:09 +03:00
|
|
|
|
2013-03-28 01:14:43 +04:00
|
|
|
static int orte_iof_base_close(void)
|
|
|
|
{
|
|
|
|
/* Close the selected component */
|
|
|
|
if (NULL != orte_iof.finalize) {
|
|
|
|
orte_iof.finalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
return mca_base_framework_components_close(&orte_iof_base_framework, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-03-28 01:14:43 +04:00
|
|
|
static int orte_iof_base_open(mca_base_open_flag_t flags)
|
2004-12-22 01:16:09 +03:00
|
|
|
{
|
2009-09-02 22:03:10 +04:00
|
|
|
int rc, xmlfd;
|
2013-03-28 01:09:41 +04:00
|
|
|
|
2009-01-31 01:47:30 +03:00
|
|
|
/* did the user request we print output to files? */
|
|
|
|
if (NULL != orte_output_filename) {
|
|
|
|
/* we will setup the files themselves as needed in the iof
|
|
|
|
* module. For now, let's see if the filename contains a
|
|
|
|
* path, or just a name
|
|
|
|
*/
|
|
|
|
char *path;
|
|
|
|
path = opal_dirname(orte_output_filename);
|
2015-03-10 08:37:53 +03:00
|
|
|
if (NULL == path) {
|
|
|
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2009-01-31 01:47:30 +03:00
|
|
|
if (0 != strcmp(path, orte_output_filename)) {
|
|
|
|
/* there is a path in this name - ensure that the directory
|
|
|
|
* exists, and create it if not
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = opal_os_dirpath_create(path, S_IRWXU))) {
|
2015-03-10 08:37:53 +03:00
|
|
|
free(path);
|
2009-01-31 01:47:30 +03:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
2015-03-10 08:37:53 +03:00
|
|
|
free(path);
|
2009-01-31 01:47:30 +03:00
|
|
|
}
|
2012-05-03 01:00:22 +04: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
|
|
|
/* daemons do not need to do this as they do not write out stdout/err */
|
2011-02-17 02:02:23 +03:00
|
|
|
if (!ORTE_PROC_IS_DAEMON ||
|
|
|
|
(ORTE_PROC_IS_DAEMON && ORTE_PROC_IS_CM)) {
|
2009-09-02 22:03:10 +04:00
|
|
|
if (orte_xml_output) {
|
|
|
|
if (NULL != orte_xml_fp) {
|
|
|
|
/* user wants all xml-formatted output sent to file */
|
|
|
|
xmlfd = fileno(orte_xml_fp);
|
|
|
|
} else {
|
|
|
|
xmlfd = 1;
|
|
|
|
}
|
|
|
|
/* setup the stdout event */
|
|
|
|
ORTE_IOF_SINK_DEFINE(&orte_iof_base.iof_write_stdout, ORTE_PROC_MY_NAME,
|
2016-02-16 07:00:57 +03:00
|
|
|
xmlfd, ORTE_IOF_STDOUT, orte_iof_base_write_handler);
|
2009-09-02 22:03:10 +04:00
|
|
|
/* don't create a stderr event - all output will go to
|
|
|
|
* the stdout channel
|
|
|
|
*/
|
|
|
|
} else {
|
|
|
|
/* setup the stdout event */
|
|
|
|
ORTE_IOF_SINK_DEFINE(&orte_iof_base.iof_write_stdout, ORTE_PROC_MY_NAME,
|
2016-02-16 07:00:57 +03:00
|
|
|
1, ORTE_IOF_STDOUT, orte_iof_base_write_handler);
|
2009-09-02 22:03:10 +04:00
|
|
|
/* setup the stderr event */
|
|
|
|
ORTE_IOF_SINK_DEFINE(&orte_iof_base.iof_write_stderr, ORTE_PROC_MY_NAME,
|
2016-02-16 07:00:57 +03:00
|
|
|
2, ORTE_IOF_STDERR, orte_iof_base_write_handler);
|
2009-09-02 22:03:10 +04:00
|
|
|
}
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2008-10-24 05:42:58 +04:00
|
|
|
/* do NOT set these file descriptors to non-blocking. If we do so,
|
|
|
|
* we set the file descriptor to non-blocking for everyone that has
|
|
|
|
* that file descriptor, which includes everyone else in our shell
|
|
|
|
* pipeline chain. (See
|
|
|
|
* http://lists.freebsd.org/pipermail/freebsd-hackers/2005-January/009742.html).
|
|
|
|
* This causes things like "mpirun -np 1 big_app | cat" to lose
|
|
|
|
* output, because cat's stdout is then ALSO non-blocking and cat
|
|
|
|
* isn't built to deal with that case (same with almost all other
|
2015-06-24 06:59:57 +03:00
|
|
|
* unix text utils).
|
|
|
|
*/
|
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
|
|
|
}
|
2013-03-28 01:14:43 +04:00
|
|
|
|
2005-01-12 23:51:34 +03:00
|
|
|
/* Open up all available components */
|
2013-03-28 01:14:43 +04:00
|
|
|
return mca_base_framework_components_open(&orte_iof_base_framework, flags);
|
2004-12-22 01:16:09 +03:00
|
|
|
}
|
2013-03-28 01:14:43 +04:00
|
|
|
|
|
|
|
MCA_BASE_FRAMEWORK_DECLARE(orte, iof, "ORTE I/O Forwarding",
|
|
|
|
orte_iof_base_register, orte_iof_base_open, orte_iof_base_close,
|
|
|
|
mca_iof_base_static_components, 0);
|
|
|
|
|