Add unit tests for rpc-apply-bcast
[guile-orca] / TODO
1 ### Subject: General idea on the workflow, Date: May 17, 2020
2
3 ## rpc-make design
4
5 Function: rpc-make datum
6
7 Example:
8 ```
9 (rpc-start)
10
11 (let lp ((x 10))
12   (rpc-make `(foo ,x))
13
14   (if (positive? message)
15     (lp (- x 1))
16     message))
17
18 (rpc-finalize)
19 ```
20
21 1. if not master, run task in background accepting messages, blocking execution
22 for workers
23 2. when master calls, rpc-make, master sends message to workers that
24 calls the function make-rpc-gather with nil parameter
25 3. when master calls finalize, master sends message to workers to call finalize
26 there and then exit
27 4. definitions made before rpc-start are accessible.
28
29 ## rpc-apply design
30
31 Function: rpc-apply-bcast proc arg1 ...
32
33 Apply proc over the given arguments on each processes and return the list containing
34 the results of each computation to the parent process. Arguments are to be broadcasted
35 to processes.
36
37 Function: rpc-apply-scatter proc lst1 ...
38
39 Apply proc over the given arguments on each processes and return the list containing
40 the results of each computation to the parent process. Arguments are to be list of
41 values whose length must be equal to the number of processes. Each individual
42 element is to be scattered across the processes.
43
44 ## Stream design
45
46 Function: rpc-stream-for-each proc stream1 stream2 …
47 Fetches the elements from streams coming from all processes including the master
48 process and calls the proc on the master process. Execution stops when it reaches
49 the end of the shortest stream. Nothing is returned from the method.
50
51
52 Function: rpc-stream-map proc stream1 stream2 …
53 Similar to the rpc-stream-for-each function, except this function returns a list
54 of values computed in the proc at each iteration.
55
56
57 Function: rpc-stream-fold proc init stream1 stream2 …
58 "Apply proc successively over the elements of the given `remote` streams, from
59 first to last until the end of the shortest stream is reached. Return the
60 result from the last proc call.
61
62 Each call is (proc elem1 elem2 … prev), where each elem is from the corresponding
63 stream. prev is the return from the previous proc call, or the given init for
64 the first call."
65
66 Design question: how to support early abort?