* Add support for using ptys for stdout when doing I/O forwarding. This is
enough to make use applications be line buffered instead of block buffered, which makes output come much faster :) This commit was SVN r5400.
Этот коммит содержится в:
родитель
fe70c2ceed
Коммит
e3587652b7
@ -341,4 +341,19 @@ fi
|
||||
AC_MSG_RESULT([$OMPI_FORTRAN_MAX_ARRAY_RANK])
|
||||
AC_SUBST(OMPI_FORTRAN_MAX_ARRAY_RANK)
|
||||
|
||||
# do we want PTY support?
|
||||
AC_MSG_CHECKING([if pty support should be enabled])
|
||||
AC_ARG_ENABLE(pty-support,
|
||||
AC_HELP_STRING([--enable-pty-support],
|
||||
[Enable/disable PTY support for STDIO forwarding. default: enabled]))
|
||||
if test "$enable_pty_support" = "no" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
OMPI_ENABLE_PTY_SUPPORT=0
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
OMPI_ENABLE_PTY_SUPPORT=1
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([OMPI_ENABLE_PTY_SUPPORT], [$OMPI_ENABLE_PTY_SUPPORT],
|
||||
[Whether user wants PTY support or not])
|
||||
|
||||
])
|
||||
|
26
configure.ac
26
configure.ac
@ -980,13 +980,16 @@ AC_DEFINE_UNQUOTED(OMPI_RANGE_F90_COMPLEX32, $OMPI_RANGE_F90_COMPLEX32,
|
||||
|
||||
ompi_show_title "Header file tests"
|
||||
|
||||
AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h dlfcn.h execinfo.h \
|
||||
fcntl.h sys/fcntl.h inttypes.h libgen.h net/if.h netdb.h netinet/in.h netinet/tcp.h \
|
||||
sys/stat.h poll.h pthread.h pwd.h sched.h stdint.h string.hstrings.h stropts.h \
|
||||
sys/types.h sys/ipc.h sys/mman.h sys/resource.h sys/select.h sys/socket.h \
|
||||
sys/ioctl.h err.h sys/statvfs.h sys/time.h sys/uio.h sys/utsname.h sys/wait.h \
|
||||
syslog.h termios.h ulimit.h unistd.h sys/param.h sys/tree.h sys/queue.h \
|
||||
sys/sockio.h time.h])
|
||||
AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
|
||||
dlfcn.h execinfo.h err.h fcntl.h inttypes.h libgen.h \
|
||||
net/if.h netdb.h netinet/in.h netinet/tcp.h \
|
||||
poll.h pthread.h pty.h pwd.h sched.h stdint.h \
|
||||
string.h strings.h stropts.h sys/fcntl.h sys/ipc.h \
|
||||
sys/ioctl.h sys/mman.h sys/param.h sys/queue.h \
|
||||
sys/resource.h sys/select.h sys/socket.h sys/sockio.h \
|
||||
sys/stat.h sys/statvfs.h sys/time.h sys/tree.h \
|
||||
sys/types.h sys/uio.h sys/utsname.h sys/wait.h syslog.h \
|
||||
time.h termios.h ulimit.h unistd.h util.h])
|
||||
|
||||
# SA_RESTART in signal.h
|
||||
AC_MSG_CHECKING([if SA_RESTART defined in signal.h])
|
||||
@ -1053,17 +1056,15 @@ ompi_show_title "Library and Function tests"
|
||||
|
||||
# -lsocket
|
||||
# -lnsl
|
||||
# -lutil (openpty)
|
||||
# openpty
|
||||
# atexit
|
||||
# getcwd
|
||||
# snprintf
|
||||
# atoll
|
||||
# strtoll
|
||||
# yield
|
||||
# vscanf
|
||||
|
||||
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf])
|
||||
AC_CHECK_LIB([util], [openpty], [WRAPPER_EXTRA_LIBS="$WRAPPER_EXTRA_LIBS -lutil" LIBLAM_EXTRA_LIBS="$LIBLAMEXTRALIBS -lutil" LIBS="$LIBS -lutil]")
|
||||
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty])
|
||||
|
||||
#
|
||||
# Make sure we can copy va_lists (need check declared, not linkable)
|
||||
@ -1247,10 +1248,7 @@ AC_WORDS_BIGENDIAN
|
||||
|
||||
# all: SYSV semaphores
|
||||
# all: SYSV shared memory
|
||||
# all: thread flavor
|
||||
# all: size of FD_SET
|
||||
# all: FD passing (or not!!)
|
||||
# all: BSD vs. SYSV ptys
|
||||
# all: sizeof struct stat members
|
||||
# all: type of getsockopt optlen
|
||||
# all: type of recvfrom optlen
|
||||
|
@ -28,7 +28,8 @@ headers = \
|
||||
base.h \
|
||||
iof_base_header.h \
|
||||
iof_base_endpoint.h \
|
||||
iof_base_fragment.h
|
||||
iof_base_fragment.h \
|
||||
iof_base_setup.h
|
||||
|
||||
libmca_iof_base_la_SOURCES = \
|
||||
$(headers) \
|
||||
@ -37,7 +38,8 @@ libmca_iof_base_la_SOURCES = \
|
||||
iof_base_flush.c \
|
||||
iof_base_endpoint.c \
|
||||
iof_base_fragment.c \
|
||||
iof_base_select.c
|
||||
iof_base_select.c \
|
||||
iof_base_setup.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "runtime/orte_wait.h"
|
||||
#include "mca/errmgr/errmgr.h"
|
||||
#include "mca/iof/iof.h"
|
||||
#include "mca/iof/base/iof_base_setup.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
#include "mca/ns/ns.h"
|
||||
#include "mca/ns/base/ns_base_nds.h"
|
||||
@ -109,12 +110,15 @@ static int orte_pls_fork_proc(
|
||||
orte_vpid_t vpid_range)
|
||||
{
|
||||
pid_t pid;
|
||||
int p_stdout[2];
|
||||
int p_stderr[2];
|
||||
mca_iof_base_io_conf_t opts;
|
||||
int rc;
|
||||
|
||||
if(pipe(p_stdout) < 0 ||
|
||||
pipe(p_stderr) < 0) {
|
||||
/* should pull this information from MPIRUN instead of going with
|
||||
default */
|
||||
opts.usepty = OMPI_ENABLE_PTY_SUPPORT;
|
||||
|
||||
rc = iof_base_setup_prefork(&opts);
|
||||
if (OMPI_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -167,16 +171,7 @@ static int orte_pls_fork_proc(
|
||||
&environ_copy);
|
||||
|
||||
/* setup stdout/stderr */
|
||||
close(p_stdout[0]);
|
||||
close(p_stderr[0]);
|
||||
if(p_stdout[1] != STDOUT_FILENO) {
|
||||
dup2(p_stdout[1], STDOUT_FILENO);
|
||||
close(p_stdout[1]);
|
||||
}
|
||||
if(p_stderr[1] != STDERR_FILENO) {
|
||||
dup2(p_stderr[1], STDERR_FILENO);
|
||||
close(p_stderr[1]);
|
||||
}
|
||||
iof_base_setup_child(&opts);
|
||||
|
||||
/* execute application */
|
||||
new_env = ompi_environ_merge(context->env, environ_copy);
|
||||
@ -202,10 +197,6 @@ static int orte_pls_fork_proc(
|
||||
OBJ_RETAIN(proc);
|
||||
orte_wait_cb(pid, orte_pls_fork_wait_proc, proc);
|
||||
|
||||
/* close write end of pipes */
|
||||
close(p_stdout[1]);
|
||||
close(p_stderr[1]);
|
||||
|
||||
/* save the pid in the registry */
|
||||
if(ORTE_SUCCESS != (rc = orte_pls_base_set_proc_pid(&proc->proc_name, pid))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
@ -213,13 +204,7 @@ static int orte_pls_fork_proc(
|
||||
}
|
||||
|
||||
/* connect read end to IOF */
|
||||
rc = orte_iof.iof_publish(&proc->proc_name, ORTE_IOF_SOURCE, ORTE_IOF_STDOUT, p_stdout[0]);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = orte_iof.iof_publish(&proc->proc_name, ORTE_IOF_SOURCE, ORTE_IOF_STDERR, p_stderr[0]);
|
||||
rc = iof_base_setup_parent(&proc->proc_name, &opts);
|
||||
if(ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user