Skip to content

Commit 0fdc8d6

Browse files
authored
Merge pull request pmodels#7295 from hzhou/2502_hydra_configfile
hydra: fix line-continuation in --configfile option Approved-by: Ken Raffenetti
2 parents 28e9057 + 478c487 commit 0fdc8d6

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

src/pm/hydra/lib/utils/args.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ HYD_status HYDU_parse_hostfile(const char *hostfile, void *data,
328328

329329
linep = line;
330330

331-
strtok(linep, "#");
332331
while (isspace(*linep))
333332
linep++;
334333

src/pm/hydra/mansrc/mpiexec.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ The MPI standard suggests the following arguments and their meanings\:
1919
+ \-n <np> - Specify the number of processes to use
2020
. \-host <hostname> - Name of host on which to run processes
2121
. \-wdir <working directory> - cd to this one `before` running executable
22-
- \-configfile <name> - file containing specifications of host/program,
23-
one per line, with # as a comment indicator, e.g., the usual
24-
mpiexec input. The lines excluding comments are concatenated with newlines
25-
replaced with spaces, and are then parsed as command line options.
22+
- \-configfile <name> - file containing command-line options.
23+
The lines are of the form separated by the colons in the commandline form:
24+
mpiexec {<option arguments>} : {...} : {...} : ... : {...}
25+
Lines beginning with '#' are comments, and lines may be continued by
26+
terminating the partial line with '\'.
2627

2728
The following options are reserved by the MPI standard, but they are not
2829
supported by MPICH (hydra)\:

src/pm/hydra/mpiexec/get_parameters.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,18 @@ static HYD_status check_environment(void)
281281

282282
static HYD_status process_config_token(char *token, int newline, void *data)
283283
{
284-
static int idx = 0;
285284
UT_array *args = data;
286285

287286
char **last_arg = (char **) utarray_back(args);
288-
if (idx && newline && strcmp(*last_arg, ":")) {
289-
/* If this is a newline, but not the first one, and the
290-
* previous token was not a ":", add an executable delimiter
291-
* ':' */
292-
static const char *colon = ":";
293-
utarray_push_back(args, &colon, MPL_MEM_OTHER);
287+
if (last_arg && newline) {
288+
if (strcmp(*last_arg, "\\") == 0) {
289+
/* remove the trailing line-continuation mark */
290+
utarray_pop_back(args);
291+
} else if (strcmp(*last_arg, ":") != 0) {
292+
/* add ":" delimiter unless it is already there */
293+
static const char *colon = ":";
294+
utarray_push_back(args, &colon, MPL_MEM_OTHER);
295+
}
294296
}
295297

296298
utarray_push_back(args, &token, MPL_MEM_OTHER);

src/pm/hydra/mpiexec/options.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ static void config_help_fn(void)
646646
printf("-configfile: Configuration file for MPMD launch argument information\n\n");
647647
printf("Notes:\n");
648648
printf(" * The config file contains information very similar to a command-line\n");
649-
printf(" launch, except ':' is replaced with a new line character\n");
649+
printf(" launch, except ':' is replaced with a new line character. Use '\'\n");
650+
printf(" partial lines.\n");
650651
}
651652

652653
static HYD_status config_fn(char *arg, char ***argv)

0 commit comments

Comments
 (0)