1
1

Add sanity check to ensure that specified stdin target is within range of job. Print error message and exit if not.

Modify read_write test to allow specification of rank to read stdin.

IOF now validated to work for arbitrary rank as stdin target. Not validate to work for multiple simultaneous ranks reading stdin (untested).

This commit was SVN r19804.
Этот коммит содержится в:
Ralph Castain 2008-10-25 14:38:06 +00:00
родитель b5123cb79f
Коммит 71dcf61f9b
3 изменённых файлов: 42 добавлений и 6 удалений

Просмотреть файл

@ -73,3 +73,15 @@ communications. This could result in an incomplete cleanup on the affected
nodes. Additional information may be available below.
We are truly sorry for the inconvenience.
#
[stdin-target-out-of-range]
The requested stdin target is out of range for this job - it points
to a process rank that is greater than the number of process in the
job.
Specified target: %s
Number of procs: %s
This could be caused by specifying a negative number for the stdin
target, or by mistyping the desired rank. Please correct the cmd line
and try again.

Просмотреть файл

@ -117,6 +117,19 @@ int orte_plm_base_setup_job(orte_job_t *jdata)
exit(0);
}
/* quick sanity check - is the stdin target within range
* of the job?
*/
if (ORTE_VPID_WILDCARD != jdata->stdin_target &&
jdata->num_procs <= jdata->stdin_target) {
/* this request cannot be met */
orte_show_help("help-plm-base.txt", "stdin-target-out-of-range", true,
ORTE_VPID_PRINT(jdata->stdin_target),
ORTE_VPID_PRINT(jdata->num_procs));
ORTE_UPDATE_EXIT_STATUS(ORTE_ERROR_DEFAULT_EXIT_CODE);
orte_trigger_event(&orte_exit);
}
/*** RHC: USER REQUEST TO TIE-OFF STDXXX TO /DEV/NULL
*** WILL BE SENT IN LAUNCH MESSAGE AS PART OF CONTROLS FIELD.
*** SO IF USER WANTS NO IO BEING SENT AROUND, THE ORTEDS

Просмотреть файл

@ -17,17 +17,27 @@ int main(int argc, char *argv[])
char line[1024];
FILE *file;
unsigned int bytes = 0;
int reader = 0;
char *junk;
if (2 == argc) {
/* a reader was specified */
reader = strtol(argv[1], NULL, 10);
fprintf(stderr, "reading from %d\n", reader);
}
MPI_Init(NULL, NULL);
MPI_Comm_rank(MPI_COMM_WORLD, &self);
MPI_Comm_size(MPI_COMM_WORLD, &size);
printf("Hello from process %d of %d\n", self, size);
MPI_Barrier(MPI_COMM_WORLD);
if (0 == self) {
unlink("./junk");
file = fopen("./junk", "w+");
if (-1 == reader || reader == self) {
asprintf(&junk, "./junk%d", self);
unlink(junk);
file = fopen(junk, "w+");
if (NULL == file) {
fprintf(stderr, "Couldn't open ./junk!");
fprintf(stderr, "Couldn't open %s!", junk);
free(junk);
MPI_Abort(MPI_COMM_WORLD, 1);
}
while (NULL != fgets(line, sizeof(line), stdin)) {
@ -36,7 +46,8 @@ int main(int argc, char *argv[])
bytes += strlen(line) + 1;
}
fclose(file);
fprintf(stderr, "\nWrote %d bytes to ./junk\n", bytes);
fprintf(stderr, "\nWrote %d bytes to %s\n", bytes, junk);
free(junk);
}
MPI_Finalize();