Skip to content

Commit 28c6902

Browse files
authored
Merge pull request #4814 from rhc54/cmr31/outputfile
Ensure output filename is passed as absolute path
2 parents a891a76 + 8358cf0 commit 28c6902

File tree

8 files changed

+38
-61
lines changed

8 files changed

+38
-61
lines changed

orte/mca/iof/base/iof_base_frame.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
1515
* Copyright (c) 2015-2018 Research Organization for Information Science
16-
* and Technology (RIST). All rights reserved.
16+
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1818
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
1919
* $COPYRIGHT$
@@ -111,29 +111,6 @@ static int orte_iof_base_open(mca_base_open_flag_t flags)
111111
{
112112
int rc, xmlfd;
113113

114-
/* did the user request we print output to files? */
115-
if (NULL != orte_output_filename) {
116-
/* we will setup the files themselves as needed in the iof
117-
* module. For now, let's see if the filename contains a
118-
* path, or just a name
119-
*/
120-
char *path;
121-
path = opal_dirname(orte_output_filename);
122-
if (NULL == path) {
123-
return ORTE_ERR_OUT_OF_RESOURCE;
124-
}
125-
if (0 != strcmp(path, orte_output_filename)) {
126-
/* there is a path in this name - ensure that the directory
127-
* exists, and create it if not
128-
*/
129-
if (ORTE_SUCCESS != (rc = opal_os_dirpath_create(path, S_IRWXU))) {
130-
free(path);
131-
return rc;
132-
}
133-
}
134-
free(path);
135-
}
136-
137114
/* daemons do not need to do this as they do not write out stdout/err */
138115
if (!ORTE_PROC_IS_DAEMON) {
139116
if (orte_xml_output) {

orte/mca/plm/base/plm_base_launch_support.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* et Automatique. All rights reserved.
1515
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
1616
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2014-2017 Research Organization for Information Science
18-
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2014-2018 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016 IBM Corporation. All rights reserved.
2020
* $COPYRIGHT$
2121
*
@@ -1603,13 +1603,6 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
16031603
free(param);
16041604
}
16051605

1606-
/* if output-filename was specified, pass that along */
1607-
if (NULL != orte_output_filename) {
1608-
opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID);
1609-
opal_argv_append(argc, argv, "orte_output_filename");
1610-
opal_argv_append(argc, argv, orte_output_filename);
1611-
}
1612-
16131606
/* if --xterm was specified, pass that along */
16141607
if (NULL != orte_xterm) {
16151608
opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID);

orte/mca/schizo/ompi/schizo_ompi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2011-2017 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
17-
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2015 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* $COPYRIGHT$
@@ -139,7 +139,7 @@ static opal_cmd_line_init_t cmd_line_init[] = {
139139
"Timestamp all application process output", OPAL_CMD_LINE_OTYPE_OUTPUT },
140140
{ "orte_output_filename", '\0', "output-filename", "output-filename", 1,
141141
&orte_cmd_options.output_filename, OPAL_CMD_LINE_TYPE_STRING,
142-
"Redirect output from application processes into filename/job/rank/std[out,err,diag]",
142+
"Redirect output from application processes into filename/job/rank/std[out,err,diag]. A relative path value will be converted to an absolute path",
143143
OPAL_CMD_LINE_OTYPE_OUTPUT },
144144
{ NULL, '\0', "merge-stderr-to-stdout", "merge-stderr-to-stdout", 0,
145145
&orte_cmd_options.merge, OPAL_CMD_LINE_TYPE_BOOL,

orte/orted/orted_submit.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2007-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
17-
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2015-2017 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2017 IBM Corporation. All rights reserved.
@@ -813,7 +813,19 @@ int orte_submit_job(char *argv[], int *index,
813813
}
814814
/* if we were asked to output to files, pass it along */
815815
if (NULL != orte_cmd_options.output_filename) {
816-
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, orte_cmd_options.output_filename, OPAL_STRING);
816+
/* if the given filename isn't an absolute path, then
817+
* convert it to one so the name will be relative to
818+
* the directory where prun was given as that is what
819+
* the user will have seen */
820+
if (!opal_path_is_absolute(orte_cmd_options.output_filename)) {
821+
char cwd[OPAL_PATH_MAX], *path;
822+
getcwd(cwd, sizeof(cwd));
823+
path = opal_os_path(false, cwd, orte_cmd_options.output_filename, NULL);
824+
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, path, OPAL_STRING);
825+
free(path);
826+
} else {
827+
orte_set_attribute(&jdata->attributes, ORTE_JOB_OUTPUT_TO_FILE, ORTE_ATTR_GLOBAL, orte_cmd_options.output_filename, OPAL_STRING);
828+
}
817829
}
818830
/* if we were asked to merge stderr to stdout, mark it so */
819831
if (orte_cmd_options.merge) {

orte/runtime/orte_globals.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
1515
* All rights reserved.
1616
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2014-2015 Research Organization for Information Science
18-
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2014-2018 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2020
* $COPYRIGHT$
2121
*
@@ -150,7 +150,6 @@ orte_vpid_t orte_total_procs = 0;
150150
/* IOF controls */
151151
bool orte_tag_output = false;
152152
bool orte_timestamp_output = false;
153-
char *orte_output_filename = NULL;
154153
/* generate new xterm windows to display output from specified ranks */
155154
char *orte_xterm = NULL;
156155

orte/runtime/orte_globals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* All rights reserved.
1616
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2017 IBM Corporation. All rights reserved.
18+
* Copyright (c) 2017-2018 Research Organization for Information Science
19+
* and Technology (RIST). All rights reserved.
1820
* $COPYRIGHT$
1921
*
2022
* Additional copyrights may follow
@@ -529,7 +531,6 @@ ORTE_DECLSPEC extern orte_vpid_t orte_total_procs;
529531
/* IOF controls */
530532
ORTE_DECLSPEC extern bool orte_tag_output;
531533
ORTE_DECLSPEC extern bool orte_timestamp_output;
532-
ORTE_DECLSPEC extern char *orte_output_filename;
533534
/* generate new xterm windows to display output from specified ranks */
534535
ORTE_DECLSPEC extern char *orte_xterm;
535536

orte/runtime/orte_mca_params.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
1515
* All rights reserved
1616
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2014 Research Organization for Information Science
18-
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2014-2018 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2020
* $COPYRIGHT$
2121
*
@@ -496,14 +496,6 @@ int orte_register_params(void)
496496
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
497497
&orte_timestamp_output);
498498

499-
/* redirect output into files */
500-
orte_output_filename = NULL;
501-
(void) mca_base_var_register ("orte", "orte", NULL, "output_filename",
502-
"Redirect output from application processes into filename.rank [default: NULL]",
503-
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
504-
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
505-
&orte_output_filename);
506-
507499
orte_show_resolved_nodenames = false;
508500
(void) mca_base_var_register ("orte", "orte", NULL, "show_resolved_nodenames",
509501
"Display any node names that are resolved to a different name (default: false)",

orte/tools/orterun/orterun.1in

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" -*- nroff -*-
22
.\" Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
33
.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
4-
.\" Copyright (c) 2017 Intel, Inc. All rights reserved.
4+
.\" Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
55
.\" Copyright (c) 2017 Los Alamos National Security, LLC. All rights
66
.\" reserved.
77
.\" $COPYRIGHT$
@@ -192,14 +192,14 @@ Number of processes to run.
192192
.
193193
.TP
194194
.B -novm\fR,\fP --novm
195-
Execute without creating an allocation-spanning virtual machine (only start
195+
Execute without creating an allocation-spanning virtual machine (only start
196196
daemons on nodes hosting application procs).
197197
.
198198
.
199199
.
200200
.TP
201201
.B -hnp\fR,\fP --hnp \fR<arg0>\fP
202-
Specify the URI of the Head Node Process (HNP), or the name of the file (specified as
202+
Specify the URI of the Head Node Process (HNP), or the name of the file (specified as
203203
file:filename) that contains that info.
204204
.
205205
.
@@ -330,7 +330,7 @@ each node. (Enabled by default).
330330
.
331331
.TP
332332
.B -oversubscribe\fR,\fP --oversubscribe
333-
Nodes are allowed to be oversubscribed, even on a managed system, and
333+
Nodes are allowed to be oversubscribed, even on a managed system, and
334334
overloading of processing elements.
335335
.
336336
.TP
@@ -414,7 +414,10 @@ Redirect the stdout, stderr, and stddiag of all processes to a process-unique ve
414414
the specified filename. Any directories in the filename will automatically be created.
415415
Each output file will consist of filename.id, where the id will be the
416416
processes' rank in MPI_COMM_WORLD, left-filled with
417-
zero's for correct ordering in listings.
417+
zero's for correct ordering in listings. A relative path value will be converted to an
418+
absolute path based on the cwd where mpirun is executed. Note that this \fIwill not\fP work
419+
on environments where the file system on compute nodes differs from that where mpirun
420+
is executed.
418421
.
419422
.
420423
.TP
@@ -724,15 +727,15 @@ Report events to a tool listening at the specified URI.
724727
.
725728
.TP
726729
.B -report-pid\fR,\fP --report-pid \fR<channel>\fP
727-
Print out mpirun's PID during startup. The channel must be either a '-' to indicate
728-
that the pid is to be output to stdout, a '+' to indicate that the pid is to be
730+
Print out mpirun's PID during startup. The channel must be either a '-' to indicate
731+
that the pid is to be output to stdout, a '+' to indicate that the pid is to be
729732
output to stderr, or a filename to which the pid is to be written.
730733
.
731734
.
732735
.TP
733736
.B -report-uri\fR,\fP --report-uri \fR<channel>\fP
734-
Print out mpirun's URI during startup. The channel must be either a '-' to indicate
735-
that the URI is to be output to stdout, a '+' to indicate that the URI is to be
737+
Print out mpirun's URI during startup. The channel must be either a '-' to indicate
738+
that the URI is to be output to stdout, a '+' to indicate that the URI is to be
736739
output to stderr, or a filename to which the URI is to be written.
737740
.
738741
.
@@ -1629,7 +1632,7 @@ we return the exit status of the process with the lowest MPI_COMM_WORLD rank to
16291632
.IP \[bu]
16301633
if all processes in the primary job normally terminate with exit status 0, and one or more
16311634
processes in a secondary job normally terminate with non-zero exit status, we (a) return
1632-
the exit status of the process with the lowest MPI_COMM_WORLD rank in the lowest jobid to have a non-zero
1635+
the exit status of the process with the lowest MPI_COMM_WORLD rank in the lowest jobid to have a non-zero
16331636
status, and (b) output a message summarizing the exit status of the primary and all secondary jobs.
16341637
.IP \[bu]
16351638
if the cmd line option --report-child-jobs-separately is set, we will return -only- the

0 commit comments

Comments
 (0)