Skip to content

Commit 9210230

Browse files
author
Ralph Castain
committed
Minor typo - init the job_data stdin_target field to 0 for default behavior. Add test.
1 parent 93e7384 commit 9210230

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ orte/test/mpi/thread_init
403403
orte/test/mpi/memcached-dummy
404404
orte/test/mpi/coll_test
405405
orte/test/mpi/badcoll
406+
orte/test/mpi/iof
406407

407408
orte/test/system/radix
408409
orte/test/system/sigusr_trap

orte/runtime/orte_globals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ static void orte_job_construct(orte_job_t* job)
624624
ORTE_GLOBAL_ARRAY_MAX_SIZE,
625625
2);
626626
job->num_apps = 0;
627-
job->stdin_target = ORTE_VPID_INVALID;
627+
job->stdin_target = 0;
628628
job->total_slots_alloc = 0;
629629
job->num_procs = 0;
630630
job->procs = OBJ_NEW(opal_pointer_array_t);

orte/test/mpi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PROGS = mpi_no_op mpi_barrier hello hello_nodename abort multi_abort simple_spawn concurrent_spawn spawn_multiple mpi_spin delayed_abort loop_spawn loop_child bad_exit pubsub hello_barrier segv accept connect hello_output hello_show_help crisscross read_write ziatest slave reduce-hang ziaprobe ziatest bcast_loop parallel_w8 parallel_w64 parallel_r8 parallel_r64 sio sendrecv_blaster early_abort debugger singleton_client_server intercomm_create spawn_tree init-exit77 mpi_info info_spawn server client paccept pconnect ring hello.sapp binding badcoll
1+
PROGS = mpi_no_op mpi_barrier hello hello_nodename abort multi_abort simple_spawn concurrent_spawn spawn_multiple mpi_spin delayed_abort loop_spawn loop_child bad_exit pubsub hello_barrier segv accept connect hello_output hello_show_help crisscross read_write ziatest slave reduce-hang ziaprobe ziatest bcast_loop parallel_w8 parallel_w64 parallel_r8 parallel_r64 sio sendrecv_blaster early_abort debugger singleton_client_server intercomm_create spawn_tree init-exit77 mpi_info info_spawn server client paccept pconnect ring hello.sapp binding badcoll iof
22

33
all: $(PROGS)
44

orte/test/mpi/iof.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <stdlib.h>
2+
#include <stdio.h>
3+
#include <string.h>
4+
#include <stdbool.h>
5+
#include <unistd.h>
6+
#include <mpi.h>
7+
8+
#define ORTE_IOF_BASE_MSG_MAX 2048
9+
10+
int main(int argc, char *argv[])
11+
{
12+
int i, rank, size, next, prev, tag = 201;
13+
int pos, msgsize, nbytes;
14+
bool done;
15+
char *msg;
16+
17+
MPI_Init(&argc, &argv);
18+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
19+
MPI_Comm_size(MPI_COMM_WORLD, &size);
20+
21+
fprintf(stderr, "Rank %d has cleared MPI_Init\n", rank);
22+
23+
next = (rank + 1) % size;
24+
prev = (rank + size - 1) % size;
25+
msg = malloc(ORTE_IOF_BASE_MSG_MAX);
26+
pos = 0;
27+
nbytes = 0;
28+
29+
if (0 == rank) {
30+
while (0 != (msgsize = read(0, msg, ORTE_IOF_BASE_MSG_MAX))) {
31+
fprintf(stderr, "Rank %d: sending blob %d\n", rank, pos);
32+
if (msgsize > 0) {
33+
MPI_Bcast(msg, ORTE_IOF_BASE_MSG_MAX, MPI_BYTE, 0, MPI_COMM_WORLD);
34+
}
35+
++pos;
36+
nbytes += msgsize;
37+
}
38+
fprintf(stderr, "Rank %d: sending termination blob %d\n", rank, pos);
39+
memset(msg, 0, ORTE_IOF_BASE_MSG_MAX);
40+
MPI_Bcast(msg, ORTE_IOF_BASE_MSG_MAX, MPI_BYTE, 0, MPI_COMM_WORLD);
41+
MPI_Barrier(MPI_COMM_WORLD);
42+
} else {
43+
while (1) {
44+
MPI_Bcast(msg, ORTE_IOF_BASE_MSG_MAX, MPI_BYTE, 0, MPI_COMM_WORLD);
45+
fprintf(stderr, "Rank %d: recvd blob %d\n", rank, pos);
46+
++pos;
47+
done = true;
48+
for (i=0; i < ORTE_IOF_BASE_MSG_MAX; i++) {
49+
if (0 != msg[i]) {
50+
done = false;
51+
break;
52+
}
53+
}
54+
if (done) {
55+
break;
56+
}
57+
}
58+
fprintf(stderr, "Rank %d: recv done\n", rank);
59+
MPI_Barrier(MPI_COMM_WORLD);
60+
}
61+
62+
fprintf(stderr, "Rank %d has completed bcast\n", rank);
63+
MPI_Finalize();
64+
return 0;
65+
}

0 commit comments

Comments
 (0)