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
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* 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
|
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
|
|
|
* 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 Sun Microsystems, Inc. All rights reserved.
|
2009-01-11 05:30:00 +03:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
2013-02-13 05:53:12 +04:00
|
|
|
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
2012-04-06 18:23:13 +04:00
|
|
|
* 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 04:00:49 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#include "orte_config.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.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/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 */
|
|
|
|
|
2008-10-24 05:42:58 +04:00
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_SYS_FCNTL_H
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
#include "opal/mca/event/event.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/runtime/orte_globals.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2011-06-24 00:38:02 +04:00
|
|
|
#include "orte/mca/ess/ess.h"
|
2010-04-16 22:51:27 +04:00
|
|
|
#include "orte/mca/rml/rml.h"
|
2009-01-31 01:47:30 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
|
|
|
#include "orte/mca/odls/odls_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 04:00:49 +04:00
|
|
|
|
|
|
|
#include "orte/mca/iof/base/base.h"
|
|
|
|
#include "iof_hnp.h"
|
|
|
|
|
|
|
|
/* LOCAL FUNCTIONS */
|
|
|
|
static void stdin_write_handler(int fd, short event, void *cbdata);
|
|
|
|
|
2010-04-16 22:51:27 +04:00
|
|
|
static void
|
|
|
|
orte_iof_hnp_exception_handler(const orte_process_name_t* peer, orte_rml_exception_t reason);
|
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
|
|
|
|
|
|
|
/* API FUNCTIONS */
|
2010-04-16 22:51:27 +04:00
|
|
|
static int init(void);
|
|
|
|
|
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 int hnp_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag, int fd);
|
|
|
|
|
|
|
|
static int hnp_pull(const orte_process_name_t* src_name,
|
|
|
|
orte_iof_tag_t src_tag,
|
|
|
|
int fd);
|
|
|
|
|
|
|
|
static int hnp_close(const orte_process_name_t* peer,
|
|
|
|
orte_iof_tag_t source_tag);
|
|
|
|
|
2010-04-16 22:51:27 +04:00
|
|
|
static int finalize(void);
|
|
|
|
|
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 int hnp_ft_event(int state);
|
|
|
|
|
|
|
|
/* The API's in this module are solely used to support LOCAL
|
|
|
|
* procs - i.e., procs that are co-located to the HNP. Remote
|
|
|
|
* procs interact with the HNP's IOF via the HNP's receive function,
|
|
|
|
* which operates independently and is in the iof_hnp_receive.c file
|
|
|
|
*/
|
|
|
|
|
|
|
|
orte_iof_base_module_t orte_iof_hnp_module = {
|
2010-04-16 22:51:27 +04:00
|
|
|
init,
|
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
|
|
|
hnp_push,
|
|
|
|
hnp_pull,
|
|
|
|
hnp_close,
|
2012-05-03 01:00:22 +04:00
|
|
|
NULL,
|
2010-04-16 22:51:27 +04:00
|
|
|
finalize,
|
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
|
|
|
hnp_ft_event
|
|
|
|
};
|
|
|
|
|
2010-04-16 22:51:27 +04:00
|
|
|
/* Initialize the module */
|
|
|
|
static int init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* post non-blocking recv to catch forwarded IO from
|
|
|
|
* the orteds
|
|
|
|
*/
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD,
|
|
|
|
ORTE_RML_TAG_IOF_HNP,
|
2011-08-10 01:30:12 +04:00
|
|
|
ORTE_RML_PERSISTENT,
|
2010-04-16 22:51:27 +04:00
|
|
|
orte_iof_hnp_recv,
|
|
|
|
NULL))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ORTE_SUCCESS != (rc = orte_rml.add_exception_handler(orte_iof_hnp_exception_handler))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_IOF_HNP);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&mca_iof_hnp_component.sinks, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_iof_hnp_component.procs, opal_list_t);
|
|
|
|
mca_iof_hnp_component.stdinev = NULL;
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/* Setup to read local data. If the tag is other than STDIN,
|
|
|
|
* then this is output being pushed from one of my child processes
|
|
|
|
* and I'll write the data out myself. If the tag is STDIN,
|
|
|
|
* then I need to setup to read from my stdin, and send anything
|
|
|
|
* I get to the specified dst_name. The dst_name in this case tells
|
|
|
|
* us which procs are to get stdin - only two options are supported:
|
|
|
|
*
|
|
|
|
* (a) a specific name, usually vpid=0; or
|
|
|
|
*
|
|
|
|
* (b) all procs, specified by vpid=ORTE_VPID_WILDCARD
|
|
|
|
*
|
|
|
|
* The orte_plm_base_launch_apps function calls iof.push after
|
|
|
|
* the procs are launched and tells us how to distribute stdin. This
|
|
|
|
* ensures that the procs are started -before- we begin reading stdin
|
|
|
|
* and attempting to send it to remote procs
|
|
|
|
*/
|
|
|
|
static int hnp_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag, int fd)
|
|
|
|
{
|
|
|
|
orte_job_t *jdata;
|
2009-09-26 07:33:55 +04:00
|
|
|
orte_proc_t *proc;
|
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_sink_t *sink;
|
2008-12-10 23:40:47 +03:00
|
|
|
orte_iof_proc_t *proct;
|
|
|
|
opal_list_item_t *item;
|
2008-10-24 05:42:58 +04:00
|
|
|
int flags;
|
2009-01-31 01:47:30 +03:00
|
|
|
char *outfile;
|
|
|
|
int fdout;
|
|
|
|
int np, numdigs;
|
2011-06-24 00:38:02 +04:00
|
|
|
orte_ns_cmp_bitmask_t mask;
|
2008-10-24 05:42:58 +04:00
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
/* don't do this if the dst vpid is invalid or the fd is negative! */
|
|
|
|
if (ORTE_VPID_INVALID == dst_name->vpid || fd < 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
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"%s iof:hnp pushing fd %d for process %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
fd, ORTE_NAME_PRINT(dst_name)));
|
2008-12-10 23:40:47 +03:00
|
|
|
|
2008-10-23 23:11:05 +04:00
|
|
|
if (!(src_tag & ORTE_IOF_STDIN)) {
|
2008-10-24 05:42:58 +04:00
|
|
|
/* set the file descriptor to non-blocking - do this before we setup
|
|
|
|
* and activate the read event in case it fires right away
|
|
|
|
*/
|
|
|
|
if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
|
|
|
|
opal_output(orte_iof_base.iof_output, "[%s:%d]: fcntl(F_GETFL) failed with errno=%d\n",
|
|
|
|
__FILE__, __LINE__, errno);
|
|
|
|
} else {
|
|
|
|
flags |= O_NONBLOCK;
|
|
|
|
fcntl(fd, F_SETFL, flags);
|
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
/* do we already have this process in our list? */
|
|
|
|
for (item = opal_list_get_first(&mca_iof_hnp_component.procs);
|
|
|
|
item != opal_list_get_end(&mca_iof_hnp_component.procs);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
proct = (orte_iof_proc_t*)item;
|
2011-06-24 00:38:02 +04:00
|
|
|
mask = ORTE_NS_CMP_ALL;
|
|
|
|
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &proct->name, dst_name)) {
|
2008-12-10 23:40:47 +03:00
|
|
|
/* found it */
|
|
|
|
goto SETUP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if we get here, then we don't yet have this proc in our list */
|
|
|
|
proct = OBJ_NEW(orte_iof_proc_t);
|
|
|
|
proct->name.jobid = dst_name->jobid;
|
|
|
|
proct->name.vpid = dst_name->vpid;
|
|
|
|
opal_list_append(&mca_iof_hnp_component.procs, &proct->super);
|
2009-01-31 01:47:30 +03:00
|
|
|
/* see if we are to output to a file */
|
|
|
|
if (NULL != orte_output_filename) {
|
2012-04-06 18:23:13 +04:00
|
|
|
/* get the jobdata for this proc */
|
|
|
|
if (NULL == (jdata = orte_get_job_data_object(dst_name->jobid))) {
|
2009-02-03 23:04:27 +03:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
2012-04-06 18:23:13 +04:00
|
|
|
np = jdata->num_procs / 10;
|
2009-01-31 01:47:30 +03:00
|
|
|
/* determine the number of digits required for max vpid */
|
|
|
|
numdigs = 1;
|
|
|
|
while (np > 0) {
|
|
|
|
numdigs++;
|
|
|
|
np = np / 10;
|
|
|
|
}
|
|
|
|
/* construct the filename */
|
2010-07-13 01:43:49 +04:00
|
|
|
asprintf(&outfile, "%s.%d.%0*lu", orte_output_filename,
|
|
|
|
(int)ORTE_LOCAL_JOBID(proct->name.jobid),
|
|
|
|
numdigs, (unsigned long)proct->name.vpid);
|
2009-01-31 01:47:30 +03:00
|
|
|
/* create the file */
|
|
|
|
fdout = open(outfile, O_CREAT|O_RDWR|O_TRUNC, 0644);
|
|
|
|
free(outfile);
|
|
|
|
if (fdout < 0) {
|
|
|
|
/* couldn't be opened */
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
|
|
|
|
return ORTE_ERR_FILE_OPEN_FAILURE;
|
|
|
|
}
|
|
|
|
/* define a sink to that file descriptor */
|
|
|
|
ORTE_IOF_SINK_DEFINE(&sink, dst_name, fdout, ORTE_IOF_STDOUTALL,
|
|
|
|
orte_iof_base_write_handler,
|
|
|
|
&mca_iof_hnp_component.sinks);
|
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
|
|
|
|
SETUP:
|
2008-10-24 05:42:58 +04:00
|
|
|
/* define a read event and activate it */
|
2008-12-10 23:40:47 +03:00
|
|
|
if (src_tag & ORTE_IOF_STDOUT) {
|
|
|
|
ORTE_IOF_READ_EVENT(&proct->revstdout, dst_name, fd, ORTE_IOF_STDOUT,
|
2009-01-31 01:47:30 +03:00
|
|
|
orte_iof_hnp_read_local_handler, false);
|
2008-12-10 23:40:47 +03:00
|
|
|
} else if (src_tag & ORTE_IOF_STDERR) {
|
|
|
|
ORTE_IOF_READ_EVENT(&proct->revstderr, dst_name, fd, ORTE_IOF_STDERR,
|
2009-01-31 01:47:30 +03:00
|
|
|
orte_iof_hnp_read_local_handler, false);
|
2008-12-10 23:40:47 +03:00
|
|
|
} else if (src_tag & ORTE_IOF_STDDIAG) {
|
|
|
|
ORTE_IOF_READ_EVENT(&proct->revstddiag, dst_name, fd, ORTE_IOF_STDDIAG,
|
2009-01-31 01:47:30 +03:00
|
|
|
orte_iof_hnp_read_local_handler, false);
|
|
|
|
}
|
|
|
|
/* if -all- of the readevents for this proc have been defined, then
|
|
|
|
* activate them. Otherwise, we can think that the proc is complete
|
|
|
|
* because one of the readevents fires -prior- to all of them having
|
|
|
|
* been defined!
|
|
|
|
*/
|
|
|
|
if (NULL != proct->revstdout && NULL != proct->revstderr && NULL != proct->revstddiag) {
|
|
|
|
proct->revstdout->active = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(proct->revstdout->ev, 0);
|
2009-01-31 01:47:30 +03:00
|
|
|
proct->revstderr->active = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(proct->revstderr->ev, 0);
|
2009-01-31 01:47:30 +03:00
|
|
|
proct->revstddiag->active = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(proct->revstddiag->ev, 0);
|
2008-12-10 23:40:47 +03:00
|
|
|
}
|
2008-10-23 23:11:05 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we are pushing stdin, this is happening only during launch - setup
|
|
|
|
* a target for this destination if it is going somewhere other than me
|
|
|
|
*/
|
|
|
|
if (ORTE_VPID_WILDCARD == dst_name->vpid) {
|
|
|
|
/* if wildcard, define a sink with that info so it gets sent out */
|
2008-12-10 23:40:47 +03:00
|
|
|
ORTE_IOF_SINK_DEFINE(&sink, dst_name, -1, ORTE_IOF_STDIN,
|
2008-10-23 23:11:05 +04:00
|
|
|
stdin_write_handler,
|
|
|
|
&mca_iof_hnp_component.sinks);
|
2012-03-06 19:47:04 +04:00
|
|
|
sink->daemon.jobid = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
sink->daemon.vpid = ORTE_VPID_WILDCARD;
|
|
|
|
} else {
|
2008-10-23 23:11:05 +04:00
|
|
|
/* no - lookup the proc's daemon and set that into sink */
|
|
|
|
if (NULL == (jdata = orte_get_job_data_object(dst_name->jobid))) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
|
|
return ORTE_ERR_BAD_PARAM;
|
|
|
|
}
|
2009-09-26 07:33:55 +04:00
|
|
|
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, dst_name->vpid))) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
|
|
|
return ORTE_ERR_NOT_FOUND;
|
|
|
|
}
|
2008-10-23 23:11:05 +04:00
|
|
|
/* if it is me, then don't set this up - we'll get it on the pull */
|
2009-09-26 07:33:55 +04:00
|
|
|
if (ORTE_PROC_MY_NAME->vpid != proc->node->daemon->name.vpid) {
|
2008-12-10 23:40:47 +03:00
|
|
|
ORTE_IOF_SINK_DEFINE(&sink, dst_name, -1, ORTE_IOF_STDIN,
|
2008-10-23 23:11:05 +04:00
|
|
|
stdin_write_handler,
|
|
|
|
&mca_iof_hnp_component.sinks);
|
|
|
|
sink->daemon.jobid = ORTE_PROC_MY_NAME->jobid;
|
2009-09-26 07:33:55 +04:00
|
|
|
sink->daemon.vpid = proc->node->daemon->name.vpid;
|
2008-10-23 23:11:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now setup the read - but check to only do this once */
|
|
|
|
if (NULL == mca_iof_hnp_component.stdinev) {
|
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
|
|
|
/* Since we are the HNP, we don't want to set nonblocking on our
|
2008-10-24 05:42:58 +04:00
|
|
|
* stdio stream. If we do so, we set the file descriptor to
|
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
|
|
|
* 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
|
|
|
|
* unix text utils).
|
|
|
|
*/
|
2008-10-24 05:42:58 +04:00
|
|
|
if (0 != fd) {
|
|
|
|
if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
|
|
|
|
opal_output(orte_iof_base.iof_output, "[%s:%d]: fcntl(F_GETFL) failed with errno=%d\n",
|
|
|
|
__FILE__, __LINE__, errno);
|
|
|
|
} else {
|
|
|
|
flags |= O_NONBLOCK;
|
|
|
|
fcntl(fd, F_SETFL, flags);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
if (isatty(fd)) {
|
|
|
|
/* We should avoid trying to read from stdin if we
|
|
|
|
* have a terminal, but are backgrounded. Catch the
|
|
|
|
* signals that are commonly used when we switch
|
|
|
|
* between being backgrounded and not. If the
|
|
|
|
* filedescriptor is not a tty, don't worry about it
|
|
|
|
* and always stay connected.
|
|
|
|
*/
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_signal_set(orte_event_base, &mca_iof_hnp_component.stdinsig,
|
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
|
|
|
SIGCONT, orte_iof_hnp_stdin_cb,
|
|
|
|
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
|
|
|
|
|
|
|
/* setup a read event to read stdin, but don't activate it yet. The
|
|
|
|
* dst_name indicates who should receive the stdin. If that recipient
|
|
|
|
* doesn't do a corresponding pull, however, then the stdin will
|
|
|
|
* be dropped upon receipt at the local daemon
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
ORTE_IOF_READ_EVENT(&mca_iof_hnp_component.stdinev,
|
|
|
|
dst_name, fd, ORTE_IOF_STDIN,
|
|
|
|
orte_iof_hnp_read_local_handler, 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
|
|
|
|
|
|
|
/* check to see if we want the stdin read event to be
|
|
|
|
* active - we will always at least define the event,
|
|
|
|
* but may delay its activation
|
|
|
|
*/
|
|
|
|
if (!(src_tag & ORTE_IOF_STDIN) || orte_iof_hnp_stdin_check(fd)) {
|
|
|
|
mca_iof_hnp_component.stdinev->active = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(mca_iof_hnp_component.stdinev->ev, 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
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
} else {
|
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
|
|
|
/* if we are not looking at a tty, just setup a read event
|
|
|
|
* and activate it
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
ORTE_IOF_READ_EVENT(&mca_iof_hnp_component.stdinev,
|
|
|
|
dst_name, fd, ORTE_IOF_STDIN,
|
|
|
|
orte_iof_hnp_read_local_handler, true);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since we are the HNP, the only "pull" call comes from a local
|
|
|
|
* process so we can record the file descriptor for its stdin.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int hnp_pull(const orte_process_name_t* dst_name,
|
|
|
|
orte_iof_tag_t src_tag,
|
|
|
|
int fd)
|
|
|
|
{
|
|
|
|
orte_iof_sink_t *sink;
|
2008-10-24 05:42:58 +04:00
|
|
|
int flags;
|
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
|
|
|
|
|
|
|
/* this is a local call - only stdin is supported */
|
|
|
|
if (ORTE_IOF_STDIN != src_tag) {
|
|
|
|
return ORTE_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
2008-12-10 23:40:47 +03:00
|
|
|
"%s iof:hnp pulling fd %d for process %s",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
|
|
|
fd, ORTE_NAME_PRINT(dst_name)));
|
2008-12-10 23:40:47 +03:00
|
|
|
|
2008-10-24 05:42:58 +04:00
|
|
|
/* set the file descriptor to non-blocking - do this before we setup
|
|
|
|
* the sink in case it fires right away
|
|
|
|
*/
|
|
|
|
if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
|
|
|
|
opal_output(orte_iof_base.iof_output, "[%s:%d]: fcntl(F_GETFL) failed with errno=%d\n",
|
|
|
|
__FILE__, __LINE__, errno);
|
|
|
|
} else {
|
|
|
|
flags |= O_NONBLOCK;
|
|
|
|
fcntl(fd, F_SETFL, flags);
|
|
|
|
}
|
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
ORTE_IOF_SINK_DEFINE(&sink, dst_name, fd, ORTE_IOF_STDIN,
|
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
|
|
|
stdin_write_handler,
|
|
|
|
&mca_iof_hnp_component.sinks);
|
|
|
|
sink->daemon.jobid = ORTE_PROC_MY_NAME->jobid;
|
|
|
|
sink->daemon.vpid = ORTE_PROC_MY_NAME->vpid;
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* One of our local procs wants us to close the specifed
|
|
|
|
* stream(s), thus terminating any potential io to/from it.
|
|
|
|
*/
|
|
|
|
static int hnp_close(const orte_process_name_t* peer,
|
2008-10-31 21:05:28 +03:00
|
|
|
orte_iof_tag_t source_tag)
|
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
|
|
|
{
|
2008-10-31 21:05:28 +03:00
|
|
|
opal_list_item_t *item, *next_item;
|
2008-12-10 23:40:47 +03:00
|
|
|
orte_iof_sink_t* sink;
|
2011-06-24 00:38:02 +04:00
|
|
|
orte_ns_cmp_bitmask_t mask;
|
2008-11-14 23:36:18 +03:00
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
for(item = opal_list_get_first(&mca_iof_hnp_component.sinks);
|
|
|
|
item != opal_list_get_end(&mca_iof_hnp_component.sinks);
|
2008-11-14 23:36:18 +03:00
|
|
|
item = next_item ) {
|
2008-12-10 23:40:47 +03:00
|
|
|
sink = (orte_iof_sink_t*)item;
|
2008-11-14 23:36:18 +03:00
|
|
|
next_item = opal_list_get_next(item);
|
2011-06-24 00:38:02 +04:00
|
|
|
|
|
|
|
mask = ORTE_NS_CMP_ALL;
|
2008-12-10 23:40:47 +03:00
|
|
|
|
2011-06-24 00:38:02 +04:00
|
|
|
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &sink->name, peer) &&
|
2008-12-10 23:40:47 +03:00
|
|
|
(source_tag & sink->tag)) {
|
2008-11-14 23:36:18 +03:00
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
/* No need to delete the event or close the file
|
|
|
|
* descriptor - the destructor will automatically
|
2008-11-14 23:36:18 +03:00
|
|
|
* do it for us.
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
opal_list_remove_item(&mca_iof_hnp_component.sinks, item);
|
2008-11-14 23:36:18 +03:00
|
|
|
OBJ_RELEASE(item);
|
2008-12-10 23:40:47 +03:00
|
|
|
break;
|
2008-10-31 21:05:28 +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
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-04-16 22:51:27 +04:00
|
|
|
static int finalize(void)
|
|
|
|
{
|
|
|
|
opal_list_item_t* item;
|
|
|
|
orte_iof_write_output_t *output;
|
|
|
|
orte_iof_write_event_t *wev;
|
|
|
|
int num_written;
|
|
|
|
bool dump;
|
|
|
|
|
|
|
|
/* check if anything is still trying to be written out */
|
|
|
|
wev = orte_iof_base.iof_write_stdout->wev;
|
|
|
|
if (!opal_list_is_empty(&wev->outputs)) {
|
|
|
|
dump = false;
|
|
|
|
/* make one last attempt to write this out */
|
|
|
|
while (NULL != (item = opal_list_remove_first(&wev->outputs))) {
|
|
|
|
output = (orte_iof_write_output_t*)item;
|
|
|
|
if (!dump) {
|
|
|
|
num_written = write(wev->fd, output->data, output->numbytes);
|
|
|
|
if (num_written < output->numbytes) {
|
|
|
|
/* don't retry - just cleanout the list and dump it */
|
|
|
|
dump = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!orte_xml_output) {
|
|
|
|
/* we only opened stderr channel if we are NOT doing xml output */
|
|
|
|
wev = orte_iof_base.iof_write_stderr->wev;
|
|
|
|
if (!opal_list_is_empty(&wev->outputs)) {
|
|
|
|
dump = false;
|
|
|
|
/* make one last attempt to write this out */
|
|
|
|
while (NULL != (item = opal_list_remove_first(&wev->outputs))) {
|
|
|
|
output = (orte_iof_write_output_t*)item;
|
|
|
|
if (!dump) {
|
|
|
|
num_written = write(wev->fd, output->data, output->numbytes);
|
|
|
|
if (num_written < output->numbytes) {
|
|
|
|
/* don't retry - just cleanout the list and dump it */
|
|
|
|
dump = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_IOF_HNP);
|
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
|
|
|
|
2010-04-16 22:51:27 +04:00
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
int hnp_ft_event(int state) {
|
|
|
|
/*
|
|
|
|
* Replica doesn't need to do anything for a checkpoint
|
|
|
|
*/
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-13 05:53:12 +04:00
|
|
|
/* this function is called by the event library and thus
|
|
|
|
* can access information global to the state machine
|
|
|
|
*/
|
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 stdin_write_handler(int fd, short event, void *cbdata)
|
|
|
|
{
|
2008-12-10 23:40:47 +03:00
|
|
|
orte_iof_sink_t *sink = (orte_iof_sink_t*)cbdata;
|
|
|
|
orte_iof_write_event_t *wev = sink->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
|
|
|
opal_list_item_t *item;
|
|
|
|
orte_iof_write_output_t *output;
|
|
|
|
int num_written;
|
|
|
|
|
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"%s hnp:stdin:write:handler writing data to %d",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_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 04:00:49 +04:00
|
|
|
wev->fd));
|
|
|
|
|
2008-12-10 23:40:47 +03:00
|
|
|
wev->pending = 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
|
|
|
|
|
|
|
while (NULL != (item = opal_list_remove_first(&wev->outputs))) {
|
|
|
|
output = (orte_iof_write_output_t*)item;
|
2009-02-27 12:31:34 +03:00
|
|
|
/* if an abnormal termination has occurred, just dump
|
|
|
|
* this data as we are aborting
|
|
|
|
*/
|
|
|
|
if (orte_abnormal_term_ordered) {
|
|
|
|
OBJ_RELEASE(output);
|
|
|
|
continue;
|
|
|
|
}
|
2008-10-23 23:11:05 +04:00
|
|
|
if (0 == output->numbytes) {
|
|
|
|
/* this indicates we are to close the fd - there is
|
|
|
|
* nothing to write
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_iof_base.iof_output,
|
|
|
|
"%s iof:hnp closing fd %d on write event due to zero bytes output",
|
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
|
|
|
OBJ_RELEASE(wev);
|
|
|
|
sink->wev = NULL;
|
2008-10-23 23:11:05 +04:00
|
|
|
/* just leave - we don't want to restart the
|
|
|
|
* read event!
|
|
|
|
*/
|
2013-02-13 05:53:12 +04:00
|
|
|
return;
|
2008-10-23 23:11:05 +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
|
|
|
num_written = write(wev->fd, output->data, output->numbytes);
|
2008-12-10 23:40:47 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"%s hnp:stdin:write:handler wrote %d bytes",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2008-12-10 23:40:47 +03:00
|
|
|
num_written));
|
2008-10-24 05:42:58 +04:00
|
|
|
if (num_written < 0) {
|
|
|
|
if (EAGAIN == errno || EINTR == errno) {
|
|
|
|
/* push this item back on the front of the list */
|
|
|
|
opal_list_prepend(&wev->outputs, item);
|
|
|
|
/* leave the write event running so it will call us again
|
|
|
|
* when the fd is ready.
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
wev->pending = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(wev->ev, 0);
|
2008-10-24 05:42:58 +04:00
|
|
|
goto CHECK;
|
|
|
|
}
|
2008-12-10 23:40:47 +03:00
|
|
|
/* otherwise, something bad happened so all we can do is declare an
|
|
|
|
* error and abort
|
2008-10-24 05:42:58 +04:00
|
|
|
*/
|
|
|
|
OBJ_RELEASE(output);
|
2008-12-10 23:40:47 +03:00
|
|
|
OPAL_OUTPUT_VERBOSE((20, orte_iof_base.iof_output,
|
|
|
|
"%s iof:hnp closing fd %d on write event due to negative bytes written",
|
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
|
|
|
OBJ_RELEASE(wev);
|
|
|
|
sink->wev = NULL;
|
2013-02-13 05:53:12 +04:00
|
|
|
return;
|
2008-10-24 05:42:58 +04:00
|
|
|
} else if (num_written < output->numbytes) {
|
2008-10-23 23:11:05 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
2008-12-10 23:40:47 +03:00
|
|
|
"%s hnp:stdin:write:handler incomplete write %d - adjusting data",
|
2009-03-06 00:50:47 +03:00
|
|
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), num_written));
|
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
|
|
|
/* incomplete write - adjust data to avoid duplicate output */
|
|
|
|
memmove(output->data, &output->data[num_written], output->numbytes - num_written);
|
|
|
|
/* push this item back on the front of the list */
|
|
|
|
opal_list_prepend(&wev->outputs, item);
|
|
|
|
/* leave the write event running so it will call us again
|
|
|
|
* when the fd is ready.
|
|
|
|
*/
|
2008-12-10 23:40:47 +03:00
|
|
|
wev->pending = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(wev->ev, 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
|
|
|
goto CHECK;
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(output);
|
|
|
|
}
|
2008-12-10 23:40:47 +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
|
|
|
CHECK:
|
2008-12-10 23:40:47 +03:00
|
|
|
if (NULL != mca_iof_hnp_component.stdinev &&
|
2009-02-27 12:31:34 +03:00
|
|
|
!orte_abnormal_term_ordered &&
|
2008-12-10 23:40:47 +03:00
|
|
|
!mca_iof_hnp_component.stdinev->active) {
|
2008-10-23 23:11:05 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"read event is off - checking if okay to restart"));
|
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
|
|
|
/* if we have turned off the read event, check to
|
|
|
|
* see if the output list has shrunk enough to
|
|
|
|
* turn it back on
|
|
|
|
*
|
|
|
|
* RHC: Note that when multiple procs want stdin, we
|
|
|
|
* can get into a fight between a proc turnin stdin
|
|
|
|
* back "on" and other procs turning it "off". There
|
|
|
|
* is no clear way to resolve this as different procs
|
|
|
|
* may take input at different rates.
|
|
|
|
*/
|
|
|
|
if (opal_list_get_size(&wev->outputs) < ORTE_IOF_MAX_INPUT_BUFFERS) {
|
|
|
|
/* restart the read */
|
2008-10-23 23:11:05 +04:00
|
|
|
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
|
|
|
|
"restarting read event"));
|
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
|
|
|
mca_iof_hnp_component.stdinev->active = true;
|
2012-04-06 18:23:13 +04:00
|
|
|
opal_event_add(mca_iof_hnp_component.stdinev->ev, 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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-16 22:51:27 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback when peer is disconnected
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
orte_iof_hnp_exception_handler(const orte_process_name_t* peer, orte_rml_exception_t reason)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
orte_iof_base_endpoint_t *endpoint;
|
|
|
|
opal_output_verbose(1, orte_iof_base.iof_output,
|
|
|
|
"iof svc exception handler! %s\n",
|
|
|
|
ORTE_NAME_PRINT((orte_process_name_t*)peer));
|
|
|
|
|
|
|
|
/* If we detect an exception on the RML connection to a peer,
|
|
|
|
delete all of its subscriptions and publications. Note that
|
|
|
|
exceptions can be detected during a normal RML shutdown; they
|
|
|
|
are recoverable events (no need to abort). */
|
|
|
|
orte_iof_hnp_sub_delete_all(peer);
|
|
|
|
orte_iof_hnp_pub_delete_all(peer);
|
|
|
|
opal_output_verbose(1, orte_iof_base.iof_output, "deleted all pubs and subs\n");
|
|
|
|
|
|
|
|
/* Find any streams on any endpoints for this peer and close them */
|
|
|
|
while (NULL !=
|
|
|
|
(endpoint = orte_iof_base_endpoint_match(peer, ORTE_NS_CMP_ALL,
|
|
|
|
ORTE_IOF_ANY))) {
|
|
|
|
orte_iof_base_endpoint_closed(endpoint);
|
|
|
|
|
|
|
|
/* Delete the endpoint that we just matched */
|
|
|
|
orte_iof_base_endpoint_delete(peer, ORTE_NS_CMP_ALL, ORTE_IOF_ANY);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
opal_output_verbose(1, orte_iof_base.iof_output, "done with exception handler\n");
|
|
|
|
}
|