mpi/{send_recv_urd/design/send_recv_urd.pseudo → stdin_sendrecv/design/stdin_sendrecv.pseudo} RENAMED
@@ -1,16 +1,25 @@
1
  procedure main:
2
- declare constant message_capacity = 512
3
- declare message as an array of message_capacity of char initialized with \
4
- "Hello from main thread of process " + process_number \
5
- + " of " + process_count + " on " + process_hostname
6
 
7
- if process_number != 0 then
8
- send(message, length(message), 0)
9
- else
10
- print(message)
11
- for current := 1 to process_count do
12
- receive(&message, message_capacity, any_process)
13
- print(message)
 
 
 
14
  end
 
 
 
 
15
  end if
 
 
 
 
16
  end procedure
1
  procedure main:
2
+ declare values as a dynamic array of float
3
+ declare value_count := 0
 
 
4
 
5
+ if process_number = 0 then
6
+ declare value := 0
7
+ while can_read(stdin) do
8
+ append(values, value)
9
+ end while
10
+
11
+ value_count := count(values)
12
+ for target := 1 to process_count do
13
+ send(&value_count, 1, target)
14
+ send(&values, count(values), target)
15
  end
16
+ else
17
+ receive(&value_count, 1, 0)
18
+ resize(values, value_count)
19
+ receive(&values, value_count, 0)
20
  end if
21
+
22
+ for index := 0 to count(values) do
23
+ print(process_number, ": ", index, ": ", values[index])
24
+ end for
25
  end procedure