Merge pull request #4531 from rhc54/topic/fds
Save one more file descriptor per process
Этот коммит содержится в:
Коммит
394508757a
@ -245,6 +245,7 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
|
||||
|
||||
AC_MSG_CHECKING([if user requested external PMIx support($with_pmix)])
|
||||
opal_prun_happy=no
|
||||
opal_external_have_pmix1=0
|
||||
AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "internal"],
|
||||
[AC_MSG_RESULT([no])
|
||||
opal_external_pmix_happy=no
|
||||
@ -299,7 +300,8 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
|
||||
AS_IF([test "x`ls $pmix_ext_install_dir/include/pmix_version.h 2> /dev/null`" = "x"],
|
||||
[AC_MSG_RESULT([version file not found - assuming v1.1.4])
|
||||
opal_external_pmix_version_found=1
|
||||
opal_external_pmix_version=114],
|
||||
opal_external_pmix_version=114
|
||||
opal_external_have_pmix1=1],
|
||||
[AC_MSG_RESULT([version file found])
|
||||
opal_external_pmix_version_found=0])
|
||||
|
||||
@ -342,7 +344,8 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
|
||||
], [])],
|
||||
[AC_MSG_RESULT([found])
|
||||
opal_external_pmix_version=1x
|
||||
opal_external_pmix_version_found=1],
|
||||
opal_external_pmix_version_found=1
|
||||
opal_external_have_pmix1=1],
|
||||
[AC_MSG_RESULT([not found])])])
|
||||
|
||||
AS_IF([test "x$opal_external_pmix_version" = "x"],
|
||||
@ -361,6 +364,8 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
|
||||
opal_external_pmix_LIBS=-lpmix
|
||||
opal_external_pmix_happy=yes])
|
||||
|
||||
AC_DEFINE_UNQUOTED([OPAL_PMIX_V1],[$opal_external_have_pmix1],
|
||||
[Whether the external PMIx library is v1])
|
||||
AM_CONDITIONAL([OPAL_WANT_PRUN], [test "$opal_prun_happy" = "yes"])
|
||||
OPAL_VAR_SCOPE_POP
|
||||
])
|
||||
|
@ -54,7 +54,6 @@ int mca_common_monitoring_coll_cache_name(ompi_communicator_t*comm)
|
||||
|
||||
static inline void mca_common_monitoring_coll_cache(mca_monitoring_coll_data_t*data)
|
||||
{
|
||||
int world_rank;
|
||||
if( -1 == data->world_rank ) {
|
||||
/* Get current process world_rank */
|
||||
mca_common_monitoring_get_world_rank(ompi_comm_rank(data->p_comm), data->p_comm,
|
||||
@ -95,7 +94,7 @@ mca_monitoring_coll_data_t*mca_common_monitoring_coll_new( ompi_communicator_t*c
|
||||
}
|
||||
|
||||
data->p_comm = comm;
|
||||
|
||||
|
||||
/* Allocate hashtable */
|
||||
if( NULL == comm_data ) {
|
||||
comm_data = OBJ_NEW(opal_hash_table_t);
|
||||
@ -105,7 +104,7 @@ mca_monitoring_coll_data_t*mca_common_monitoring_coll_new( ompi_communicator_t*c
|
||||
}
|
||||
opal_hash_table_init(comm_data, 2048);
|
||||
}
|
||||
|
||||
|
||||
/* Insert in hashtable */
|
||||
uint64_t key = *((uint64_t*)&comm);
|
||||
if( OPAL_SUCCESS != opal_hash_table_set_value_uint64(comm_data, key, (void*)data) ) {
|
||||
@ -127,7 +126,7 @@ void mca_common_monitoring_coll_release(mca_monitoring_coll_data_t*data)
|
||||
return;
|
||||
}
|
||||
#endif /* OPAL_ENABLE_DEBUG */
|
||||
|
||||
|
||||
/* not flushed yet */
|
||||
data->is_released = 1;
|
||||
mca_common_monitoring_coll_cache(data);
|
||||
@ -141,7 +140,7 @@ static void mca_common_monitoring_coll_cond_release(mca_monitoring_coll_data_t*d
|
||||
return;
|
||||
}
|
||||
#endif /* OPAL_ENABLE_DEBUG */
|
||||
|
||||
|
||||
if( data->is_released ) { /* if the communicator is already released */
|
||||
opal_hash_table_remove_value_uint64(comm_data, *((uint64_t*)&data->p_comm));
|
||||
data->p_comm = NULL;
|
||||
|
@ -65,10 +65,10 @@ static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, s
|
||||
static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, size_t size, int disp_unit,
|
||||
struct ompi_communicator_t *comm, struct opal_info_t *info,
|
||||
int flavor, int *model);
|
||||
|
||||
#if 0 // stale code?
|
||||
static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct opal_info_t *info);
|
||||
static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct opal_info_t **info_used);
|
||||
|
||||
#endif
|
||||
static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, struct mca_btl_base_module_t **btl);
|
||||
|
||||
static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value);
|
||||
@ -1250,12 +1250,13 @@ static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *ke
|
||||
}
|
||||
/* enforce collectiveness... */
|
||||
module->comm->c_coll->coll_barrier(module->comm, module->comm->c_coll->coll_barrier_module);
|
||||
/*
|
||||
/*
|
||||
* Accept any value
|
||||
*/
|
||||
return module->no_locks ? "true" : "false";
|
||||
}
|
||||
|
||||
#if 0 // stale code?
|
||||
static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct opal_info_t *info)
|
||||
{
|
||||
ompi_osc_rdma_module_t *module = GET_MODULE(win);
|
||||
@ -1302,5 +1303,5 @@ static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct opal_info_t **
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
OBJ_CLASS_INSTANCE(ompi_osc_rdma_aggregation_t, opal_list_item_t, NULL, NULL);
|
||||
|
@ -133,7 +133,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
** and then mapping it to memory
|
||||
** For sharedfp we also want to put the file backed shared memory into the tmp directory
|
||||
*/
|
||||
filename_basename = basename(filename);
|
||||
filename_basename = basename((char*)filename);
|
||||
/* format is "%s/%s_cid-%d.sm", see below */
|
||||
sm_filename_length = strlen(ompi_process_info.job_session_dir) + 1 + strlen(filename_basename) + 5 + (3*sizeof(uint32_t)+1) + 4;
|
||||
sm_filename = (char*) malloc( sizeof(char) * sm_filename_length);
|
||||
@ -191,7 +191,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
#if defined(HAVE_SEM_OPEN)
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#if defined (__APPLE__)
|
||||
sm_data->sem_name = (char*) malloc( sizeof(char) * 32);
|
||||
snprintf(sm_data->sem_name,31,"OMPIO_%s",filename_basename);
|
||||
#else
|
||||
|
@ -1,9 +1,11 @@
|
||||
typedef struct _com_mat_t{
|
||||
double **comm;
|
||||
double **comm;
|
||||
int n; /*comm is of size n by n the other element are zeroes*/
|
||||
|
||||
|
||||
} com_mat_t;
|
||||
|
||||
|
||||
int *kpartition(int, com_mat_t*, int, int *, int);
|
||||
tm_tree_t * kpartition_build_tree_from_topology(tm_topology_t *topology,double **com_mat,int N, int *constraints, int nb_constraints, double *obj_weight, double *com_speed);
|
||||
|
||||
#define HAVE_LIBSCOTCH 0 // missing configure setup?
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
|
@ -361,7 +361,9 @@ opal_net_addr_isipv4public(const struct sockaddr *addr)
|
||||
bool
|
||||
opal_net_addr_isipv6linklocal(const struct sockaddr *addr)
|
||||
{
|
||||
#if OPAL_ENABLE_IPV6
|
||||
struct sockaddr_in6 if_addr;
|
||||
#endif
|
||||
|
||||
switch (addr->sa_family) {
|
||||
#if OPAL_ENABLE_IPV6
|
||||
|
@ -126,7 +126,9 @@ typedef struct {
|
||||
orte_iof_sink_t *stdinev;
|
||||
orte_iof_read_event_t *revstdout;
|
||||
orte_iof_read_event_t *revstderr;
|
||||
#if OPAL_PMIX_V1
|
||||
orte_iof_read_event_t *revstddiag;
|
||||
#endif
|
||||
opal_list_t *subscribers;
|
||||
bool copy;
|
||||
} orte_iof_proc_t;
|
||||
|
@ -211,7 +211,9 @@ static void orte_iof_base_proc_construct(orte_iof_proc_t* ptr)
|
||||
ptr->stdinev = NULL;
|
||||
ptr->revstdout = NULL;
|
||||
ptr->revstderr = NULL;
|
||||
#if OPAL_PMIX_V1
|
||||
ptr->revstddiag = NULL;
|
||||
#endif
|
||||
ptr->subscribers = NULL;
|
||||
ptr->copy = true;
|
||||
}
|
||||
@ -226,9 +228,11 @@ static void orte_iof_base_proc_destruct(orte_iof_proc_t* ptr)
|
||||
if (NULL != ptr->revstderr) {
|
||||
OBJ_RELEASE(ptr->revstderr);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != ptr->revstddiag) {
|
||||
OBJ_RELEASE(ptr->revstddiag);
|
||||
}
|
||||
#endif
|
||||
if (NULL != ptr->subscribers) {
|
||||
OPAL_LIST_RELEASE(ptr->subscribers);
|
||||
}
|
||||
|
@ -119,11 +119,12 @@ orte_iof_base_setup_prefork(orte_iof_base_io_conf_t *opts)
|
||||
return ORTE_ERR_SYS_LIMITS_PIPES;
|
||||
}
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (pipe(opts->p_internal) < 0) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_SYS_LIMITS_PIPES);
|
||||
return ORTE_ERR_SYS_LIMITS_PIPES;
|
||||
}
|
||||
|
||||
#endif
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -132,7 +133,9 @@ int
|
||||
orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
{
|
||||
int ret;
|
||||
#if OPAL_PMIX_V1
|
||||
char *str;
|
||||
#endif
|
||||
|
||||
if (opts->connect_stdin) {
|
||||
close(opts->p_stdin[1]);
|
||||
@ -141,7 +144,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
if( !orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
close(opts->p_stderr[0]);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
close(opts->p_internal[0]);
|
||||
#endif
|
||||
|
||||
if (opts->usepty) {
|
||||
/* disable echo */
|
||||
@ -163,19 +168,27 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if (ret < 0) {
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
if( orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if (ret < 0) {
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
}
|
||||
close(opts->p_stdout[1]);
|
||||
} else {
|
||||
if(opts->p_stdout[1] != fileno(stdout)) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if (ret < 0) {
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
if( orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if (ret < 0) {
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
}
|
||||
close(opts->p_stdout[1]);
|
||||
}
|
||||
@ -183,7 +196,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
if (opts->connect_stdin) {
|
||||
if(opts->p_stdin[0] != fileno(stdin)) {
|
||||
ret = dup2(opts->p_stdin[0], fileno(stdin));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if (ret < 0) {
|
||||
return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
close(opts->p_stdin[0]);
|
||||
}
|
||||
} else {
|
||||
@ -205,6 +220,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPAL_PMIX_V1
|
||||
if (!orte_map_stddiag_to_stderr && !orte_map_stddiag_to_stdout ) {
|
||||
/* Set an environment variable that the new child process can use
|
||||
to get the fd of the pipe connected to the INTERNAL IOF tag. */
|
||||
@ -213,10 +229,10 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
opal_setenv("OPAL_OUTPUT_STDERR_FD", str, true, env);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
else if( orte_map_stddiag_to_stdout ) {
|
||||
} else if( orte_map_stddiag_to_stdout ) {
|
||||
opal_setenv("OPAL_OUTPUT_INTERNAL_TO_STDOUT", "1", true, env);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
@ -253,11 +269,13 @@ orte_iof_base_setup_parent(const orte_process_name_t* name,
|
||||
}
|
||||
}
|
||||
|
||||
#if OPAL_PMIX_V1
|
||||
ret = orte_iof.push(name, ORTE_IOF_STDDIAG, opts->p_internal[0]);
|
||||
if(ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
@ -353,12 +371,13 @@ int orte_iof_base_setup_output_files(const orte_process_name_t* dst_name,
|
||||
orte_iof_base_write_handler);
|
||||
}
|
||||
}
|
||||
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != proct->revstddiag && NULL == proct->revstddiag->sink) {
|
||||
/* always tie the sink for stddiag to stderr */
|
||||
OBJ_RETAIN(proct->revstderr->sink);
|
||||
proct->revstddiag->sink = proct->revstderr->sink;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -35,7 +35,9 @@ struct orte_iof_base_io_conf_t {
|
||||
int p_stdin[2];
|
||||
int p_stdout[2];
|
||||
int p_stderr[2];
|
||||
#if OPAL_PMIX_V1
|
||||
int p_internal[2];
|
||||
#endif
|
||||
};
|
||||
typedef struct orte_iof_base_io_conf_t orte_iof_base_io_conf_t;
|
||||
|
||||
|
@ -186,9 +186,11 @@ static int hnp_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag,
|
||||
} else if (src_tag & ORTE_IOF_STDERR) {
|
||||
ORTE_IOF_READ_EVENT(&proct->revstderr, proct, fd, ORTE_IOF_STDERR,
|
||||
orte_iof_hnp_read_local_handler, false);
|
||||
#if OPAL_PMIX_V1
|
||||
} else if (src_tag & ORTE_IOF_STDDIAG) {
|
||||
ORTE_IOF_READ_EVENT(&proct->revstddiag, proct, fd, ORTE_IOF_STDDIAG,
|
||||
orte_iof_hnp_read_local_handler, false);
|
||||
#endif
|
||||
}
|
||||
/* setup any requested output files */
|
||||
if (ORTE_SUCCESS != (rc = orte_iof_base_setup_output_files(dst_name, jdata, proct))) {
|
||||
@ -201,7 +203,10 @@ static int hnp_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag,
|
||||
* because one of the readevents fires -prior- to all of them having
|
||||
* been defined!
|
||||
*/
|
||||
if (NULL != proct->revstdout && NULL != proct->revstddiag &&
|
||||
if (NULL != proct->revstdout &&
|
||||
#if OPAL_PMIX_V1
|
||||
NULL != proct->revstddiag &&
|
||||
#endif
|
||||
(orte_iof_base.redirect_app_stderr_to_stdout || NULL != proct->revstderr)) {
|
||||
if (proct->copy) {
|
||||
/* see if there are any wildcard subscribers out there that
|
||||
@ -220,7 +225,11 @@ static int hnp_push(const orte_process_name_t* dst_name, orte_iof_tag_t src_tag,
|
||||
if (!orte_iof_base.redirect_app_stderr_to_stdout) {
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstderr);
|
||||
}
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstddiag);
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != proct->revstddiag) {
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstddiag);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
@ -380,7 +389,6 @@ static int hnp_close(const orte_process_name_t* peer,
|
||||
{
|
||||
orte_iof_proc_t* proct;
|
||||
orte_ns_cmp_bitmask_t mask = ORTE_NS_CMP_ALL;
|
||||
int cnt = 0;
|
||||
|
||||
OPAL_LIST_FOREACH(proct, &mca_iof_hnp_component.procs, orte_iof_proc_t) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &proct->name, peer)) {
|
||||
@ -388,31 +396,39 @@ static int hnp_close(const orte_process_name_t* peer,
|
||||
if (NULL != proct->stdinev) {
|
||||
OBJ_RELEASE(proct->stdinev);
|
||||
}
|
||||
++cnt;
|
||||
proct->stdinev = NULL;
|
||||
}
|
||||
if (ORTE_IOF_STDOUT & source_tag) {
|
||||
if ((ORTE_IOF_STDOUT & source_tag) ||
|
||||
(ORTE_IOF_STDMERGE & source_tag)) {
|
||||
if (NULL != proct->revstdout) {
|
||||
orte_iof_base_static_dump_output(proct->revstdout);
|
||||
OBJ_RELEASE(proct->revstdout);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstdout = NULL;
|
||||
}
|
||||
if (ORTE_IOF_STDERR & source_tag) {
|
||||
if (NULL != proct->revstderr) {
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
OBJ_RELEASE(proct->revstderr);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstderr = NULL;
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (ORTE_IOF_STDDIAG & source_tag) {
|
||||
if (NULL != proct->revstddiag) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
OBJ_RELEASE(proct->revstddiag);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstddiag = NULL;
|
||||
}
|
||||
#endif
|
||||
/* if we closed them all, then remove this proc */
|
||||
if (4 == cnt) {
|
||||
if (NULL == proct->stdinev &&
|
||||
NULL == proct->revstdout &&
|
||||
#if OPAL_PMIX_V1
|
||||
NULL == proct->revstddiag &&
|
||||
#endif
|
||||
NULL == proct->revstderr) {
|
||||
opal_list_remove_item(&mca_iof_hnp_component.procs, &proct->super);
|
||||
OBJ_RELEASE(proct);
|
||||
}
|
||||
@ -487,9 +503,11 @@ static int finalize(void)
|
||||
if (NULL != proct->revstderr) {
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != proct->revstddiag) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
}
|
||||
#endif
|
||||
OBJ_RELEASE(proct);
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_iof_hnp_component.procs);
|
||||
@ -586,9 +604,9 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
|
||||
}
|
||||
}
|
||||
goto check;
|
||||
re_enter:
|
||||
re_enter:
|
||||
ORTE_IOF_SINK_ACTIVATE(wev);
|
||||
check:
|
||||
check:
|
||||
if (NULL != mca_iof_hnp_component.stdinev &&
|
||||
!orte_abnormal_term_ordered &&
|
||||
!mca_iof_hnp_component.stdinev->active) {
|
||||
@ -612,7 +630,7 @@ check:
|
||||
}
|
||||
}
|
||||
return;
|
||||
finish:
|
||||
finish:
|
||||
OBJ_RELEASE(wev);
|
||||
sink->wev = NULL;
|
||||
return;
|
||||
|
@ -267,14 +267,18 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
|
||||
} else if (rev->tag & ORTE_IOF_STDERR) {
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
OBJ_RELEASE(proct->revstderr);
|
||||
#if OPAL_PMIX_V1
|
||||
} else if (rev->tag & ORTE_IOF_STDDIAG) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
OBJ_RELEASE(proct->revstddiag);
|
||||
#endif
|
||||
}
|
||||
/* check to see if they are all done */
|
||||
if (NULL == proct->revstdout &&
|
||||
NULL == proct->revstderr &&
|
||||
NULL == proct->revstddiag) {
|
||||
#if OPAL_PMIX_V1
|
||||
NULL == proct->revstddiag &&
|
||||
#endif
|
||||
NULL == proct->revstderr) {
|
||||
/* this proc's iof is complete */
|
||||
ORTE_ACTIVATE_PROC_STATE(&proct->name, ORTE_PROC_STATE_IOF_COMPLETE);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ static int orted_push(const orte_process_name_t* dst_name,
|
||||
proct->name.vpid = dst_name->vpid;
|
||||
opal_list_append(&mca_iof_orted_component.procs, &proct->super);
|
||||
|
||||
SETUP:
|
||||
SETUP:
|
||||
/* get the local jobdata for this proc */
|
||||
if (NULL == (jobdat = orte_get_job_data_object(proct->name.jobid))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
|
||||
@ -177,9 +177,11 @@ SETUP:
|
||||
} else if (src_tag & ORTE_IOF_STDERR) {
|
||||
ORTE_IOF_READ_EVENT(&proct->revstderr, proct, fd, ORTE_IOF_STDERR,
|
||||
orte_iof_orted_read_handler, false);
|
||||
#if OPAL_PMIX_V1
|
||||
} else if (src_tag & ORTE_IOF_STDDIAG) {
|
||||
ORTE_IOF_READ_EVENT(&proct->revstddiag, proct, fd, ORTE_IOF_STDDIAG,
|
||||
orte_iof_orted_read_handler, false);
|
||||
#endif
|
||||
}
|
||||
/* setup any requested output files */
|
||||
if (ORTE_SUCCESS != (rc = orte_iof_base_setup_output_files(dst_name, jobdat, proct))) {
|
||||
@ -192,13 +194,20 @@ SETUP:
|
||||
* because one of the readevents fires -prior- to all of them having
|
||||
* been defined!
|
||||
*/
|
||||
if (NULL != proct->revstdout && NULL != proct->revstddiag &&
|
||||
if (NULL != proct->revstdout &&
|
||||
#if OPAL_PMIX_V1
|
||||
NULL != proct->revstddiag &&
|
||||
#endif
|
||||
(orte_iof_base.redirect_app_stderr_to_stdout || NULL != proct->revstderr)) {
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstdout);
|
||||
if (!orte_iof_base.redirect_app_stderr_to_stdout) {
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstderr);
|
||||
}
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstddiag);
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != proct->revstddiag) {
|
||||
ORTE_IOF_READ_ACTIVATE(proct->revstddiag);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
@ -273,7 +282,6 @@ static int orted_close(const orte_process_name_t* peer,
|
||||
{
|
||||
orte_iof_proc_t* proct;
|
||||
orte_ns_cmp_bitmask_t mask = ORTE_NS_CMP_ALL;
|
||||
int cnt = 0;
|
||||
|
||||
OPAL_LIST_FOREACH(proct, &mca_iof_orted_component.procs, orte_iof_proc_t) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &proct->name, peer)) {
|
||||
@ -281,31 +289,39 @@ static int orted_close(const orte_process_name_t* peer,
|
||||
if (NULL != proct->stdinev) {
|
||||
OBJ_RELEASE(proct->stdinev);
|
||||
}
|
||||
++cnt;
|
||||
proct->stdinev = NULL;
|
||||
}
|
||||
if (ORTE_IOF_STDOUT & source_tag) {
|
||||
if ((ORTE_IOF_STDOUT & source_tag) ||
|
||||
(ORTE_IOF_STDMERGE & source_tag)) {
|
||||
if (NULL != proct->revstdout) {
|
||||
orte_iof_base_static_dump_output(proct->revstdout);
|
||||
OBJ_RELEASE(proct->revstdout);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstdout = NULL;
|
||||
}
|
||||
if (ORTE_IOF_STDERR & source_tag) {
|
||||
if (NULL != proct->revstderr) {
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
OBJ_RELEASE(proct->revstderr);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstderr = NULL;
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (ORTE_IOF_STDDIAG & source_tag) {
|
||||
if (NULL != proct->revstddiag) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
OBJ_RELEASE(proct->revstddiag);
|
||||
}
|
||||
++cnt;
|
||||
proct->revstddiag = NULL;
|
||||
}
|
||||
#endif
|
||||
/* if we closed them all, then remove this proc */
|
||||
if (4 == cnt) {
|
||||
if (NULL == proct->stdinev &&
|
||||
NULL == proct->revstdout &&
|
||||
#if OPAL_PMIX_V1
|
||||
NULL == proct->revstddiag &&
|
||||
#endif
|
||||
NULL == proct->revstderr) {
|
||||
opal_list_remove_item(&mca_iof_orted_component.procs, &proct->super);
|
||||
OBJ_RELEASE(proct);
|
||||
}
|
||||
@ -342,9 +358,11 @@ static int finalize(void)
|
||||
if (NULL != proct->revstderr) {
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
if (NULL != proct->revstddiag) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
}
|
||||
#endif
|
||||
OBJ_RELEASE(proct);
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_iof_orted_component.procs);
|
||||
|
@ -164,16 +164,20 @@ void orte_iof_orted_read_handler(int fd, short event, void *cbdata)
|
||||
orte_iof_base_static_dump_output(proct->revstderr);
|
||||
OBJ_RELEASE(proct->revstderr);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
} else if (rev->tag & ORTE_IOF_STDDIAG) {
|
||||
if( NULL != proct->revstddiag ) {
|
||||
orte_iof_base_static_dump_output(proct->revstddiag);
|
||||
OBJ_RELEASE(proct->revstddiag);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* check to see if they are all done */
|
||||
if (NULL == proct->revstdout &&
|
||||
NULL == proct->revstderr &&
|
||||
NULL == proct->revstddiag) {
|
||||
#if OPAL_PMIX_V1
|
||||
NULL == proct->revstddiag &&
|
||||
#endif
|
||||
NULL == proct->revstderr) {
|
||||
/* this proc's iof is complete */
|
||||
ORTE_ACTIVATE_PROC_STATE(&proct->name, ORTE_PROC_STATE_IOF_COMPLETE);
|
||||
}
|
||||
|
@ -333,7 +333,11 @@ static int close_open_file_descriptors(int write_fd, orte_iof_base_io_conf_t opt
|
||||
(fd == alps_app_filedes[0]) ||
|
||||
(fd == alps_app_filedes[1])) continue;
|
||||
|
||||
if (fd >=3 && fd != opts.p_internal[1] && fd != write_fd) {
|
||||
if (fd >=3 &&
|
||||
#if OPAL_PMIX_V1
|
||||
fd != opts.p_internal[1] &&
|
||||
#endif
|
||||
fd != write_fd) {
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@ -386,11 +390,13 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
|
||||
}
|
||||
close(fdnull);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
fdnull = open("/dev/null", O_RDONLY, 0);
|
||||
if (fdnull > cd->opts.p_internal[1]) {
|
||||
dup2(fdnull, cd->opts.p_internal[1]);
|
||||
}
|
||||
close(fdnull);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != close_open_file_descriptors(write_fd, cd->opts)) {
|
||||
@ -475,7 +481,9 @@ static int do_parent(orte_odls_spawn_caddy_t *cd, int read_fd)
|
||||
if( !orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
close(cd->opts.p_stderr[1]);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
close(cd->opts.p_internal[1]);
|
||||
#endif
|
||||
|
||||
/* Block reading a message from the pipe */
|
||||
while (1) {
|
||||
|
@ -293,9 +293,8 @@ static void send_error_show_help(int fd, int exit_status,
|
||||
exit(exit_status);
|
||||
}
|
||||
|
||||
/* close all open file descriptors w/ exception of stdin/stdout/stderr,
|
||||
the pipe used for the IOF INTERNAL messages, and the pipe up to
|
||||
the parent. */
|
||||
/* close all open file descriptors w/ exception of stdin/stdout/stderr
|
||||
and the pipe up to the parent. */
|
||||
static int close_open_file_descriptors(int write_fd,
|
||||
orte_iof_base_io_conf_t opts) {
|
||||
DIR *dir = opendir("/proc/self/fd");
|
||||
@ -312,7 +311,11 @@ static int close_open_file_descriptors(int write_fd,
|
||||
closedir(dir);
|
||||
return ORTE_ERR_TYPE_MISMATCH;
|
||||
}
|
||||
if (fd >=3 && fd != opts.p_internal[1] && fd != write_fd) {
|
||||
if (fd >=3 &&
|
||||
#if OPAL_PMIX_V1
|
||||
fd != opts.p_internal[1] &&
|
||||
#endif
|
||||
fd != write_fd) {
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@ -374,11 +377,13 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
|
||||
}
|
||||
close(fdnull);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
fdnull = open("/dev/null", O_RDONLY, 0);
|
||||
if (fdnull > cd->opts.p_internal[1]) {
|
||||
dup2(fdnull, cd->opts.p_internal[1]);
|
||||
}
|
||||
close(fdnull);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* close all open file descriptors w/ exception of stdin/stdout/stderr,
|
||||
@ -387,7 +392,11 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
|
||||
if (ORTE_SUCCESS != close_open_file_descriptors(write_fd, cd->opts)) {
|
||||
// close *all* file descriptors -- slow
|
||||
for(fd=3; fd<fdmax; fd++) {
|
||||
if (fd != cd->opts.p_internal[1] && fd != write_fd) {
|
||||
if (
|
||||
#if OPAL_PMIX_V1
|
||||
fd != cd->opts.p_internal[1] &&
|
||||
#endif
|
||||
fd != write_fd) {
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@ -456,7 +465,9 @@ static int do_parent(orte_odls_spawn_caddy_t *cd, int read_fd)
|
||||
if( !orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
close(cd->opts.p_stderr[1]);
|
||||
}
|
||||
#if OPAL_PMIX_V1
|
||||
close(cd->opts.p_internal[1]);
|
||||
#endif
|
||||
|
||||
/* Block reading a message from the pipe */
|
||||
while (1) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user