4f3a11b4db
A bunch of fixes from the /tmp/iof-fixes branch that fix up ''some'' (but not ''all'') of the problems that we have seen with iof: * Reading very large files via stdin redirected to orteun (Sun saw this) * Reading a little bit of a large file redirected to orterun's stdin and then either closing stdin or exiting the process The Big Change was to make the proxy iof (the one running in non-HNP orteds) send back a "I'm closing the stream" ACK back to the service iof. This tells the HNP that there will be nothing more coming from that peer, and therefore the iof forward should be removed. Many other minor cleanups/fixes, terminology changes, and documentation additions are included in this commit as well. However, there are still some pretty big outstanding issues with IOF that are not addressed either by #967 or this commit. A few examples: * IOF was designed to allow multiple subscribers to a single stream. We're not entirely sure that this works (for one thing, there is nothing in the ORTE/OMPI code base that uses this functionality). * There are also resources leaked when processes/jobs exit (per Ralph's first comment on this ticket). * There is no feedback to close orterun's stdin when all subscribers to the corresponding stream have closed stdin. This commit was SVN r14967. The following Trac tickets were found above: Ticket 967 --> https://svn.open-mpi.org/trac/ompi/ticket/967
119 строки
3.2 KiB
C
119 строки
3.2 KiB
C
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
#include <errno.h>
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_FCNTL_H
|
|
#include <sys/fcntl.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
#include "opal/util/output.h"
|
|
#include "orte/mca/rml/rml.h"
|
|
#include "orte/mca/rml/rml_types.h"
|
|
#include "orte/mca/iof/base/base.h"
|
|
#include "orte/mca/iof/base/iof_base_endpoint.h"
|
|
#include "orte/mca/iof/base/iof_base_fragment.h"
|
|
|
|
|
|
/**
|
|
*
|
|
*/
|
|
|
|
static void orte_iof_base_frag_construct(orte_iof_base_frag_t* frag)
|
|
{
|
|
OMPI_DEBUG_ZERO(*frag);
|
|
frag->frag_owner = NULL;
|
|
frag->frag_len = 0;
|
|
frag->frag_iov[0].iov_base = (IOVBASE_TYPE*)&frag->frag_hdr;
|
|
frag->frag_iov[0].iov_len = sizeof(frag->frag_hdr);
|
|
frag->frag_iov[1].iov_base = (IOVBASE_TYPE*)frag->frag_data;
|
|
frag->frag_iov[1].iov_len = sizeof(frag->frag_data);
|
|
}
|
|
|
|
|
|
static void orte_iof_base_frag_destruct(orte_iof_base_frag_t* frag)
|
|
{
|
|
frag->frag_iov[0].iov_base = (IOVBASE_TYPE*)&frag->frag_hdr;
|
|
frag->frag_iov[0].iov_len = sizeof(frag->frag_hdr);
|
|
frag->frag_iov[1].iov_base = (IOVBASE_TYPE*)frag->frag_data;
|
|
frag->frag_iov[1].iov_len = sizeof(frag->frag_data);
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
orte_iof_base_frag_t,
|
|
opal_free_list_item_t,
|
|
orte_iof_base_frag_construct,
|
|
orte_iof_base_frag_destruct);
|
|
|
|
/*
|
|
*
|
|
*/
|
|
|
|
static void orte_iof_base_frag_send_cb(
|
|
int status,
|
|
orte_process_name_t* peer,
|
|
struct iovec* msg,
|
|
int count,
|
|
orte_rml_tag_t tag,
|
|
void* cbdata)
|
|
{
|
|
orte_iof_base_frag_t* frag = (orte_iof_base_frag_t*)cbdata;
|
|
ORTE_IOF_BASE_FRAG_RETURN(frag);
|
|
}
|
|
|
|
/*
|
|
*
|
|
*/
|
|
|
|
int _orte_iof_base_frag_ack(orte_iof_base_frag_t* frag, bool do_close,
|
|
const char* file, int line)
|
|
{
|
|
int rc = ORTE_SUCCESS;
|
|
|
|
if(frag->frag_hdr.hdr_msg.msg_len > 0) {
|
|
frag->frag_hdr.hdr_common.hdr_type =
|
|
do_close ? ORTE_IOF_BASE_HDR_CLOSE : ORTE_IOF_BASE_HDR_ACK;
|
|
ORTE_IOF_BASE_HDR_MSG_HTON(frag->frag_hdr.hdr_msg);
|
|
|
|
/* start non-blocking OOB call to forward header */
|
|
rc = orte_rml.send_nb(
|
|
&frag->frag_src,
|
|
frag->frag_iov,
|
|
1,
|
|
ORTE_RML_TAG_IOF_SVC,
|
|
0,
|
|
orte_iof_base_frag_send_cb,
|
|
frag);
|
|
if(rc != ORTE_SUCCESS) {
|
|
opal_output(0, "orte_iof_base_frag_ack: orte_oob_send failed with status=%d\n", rc);
|
|
}
|
|
}
|
|
return rc;
|
|
}
|
|
|