Content deleted Content added
Realbadwolf (talk | contribs) No edit summary |
|||
Line 221:
==Parallel execution==
Cuneiform is a purely functional language, i.e., it does not support mutable references. In the consequence, it can use subterm-independence to divide a program into parallelizable partitions. The Cuneiform scheduler distributes these partitions to worker nodes. In addition, Cuneiform uses a Call-by-Name evaluation strategy to compute values only if they contribute to the computation result. Finally, foreign function applications are memoized to avoid speed up queries that contain previously derived results.
For example, the following Cuneiform program allows the applications of <code>f</code> and <code>g</code> to run in parallel while <code>h</code> is dependent and can be started only when both <code>f</code> and <code>g</code> are finished.
<pre>
let output-of-f : File = f();
let output-of-g : File = g();
h( f = output-of-f, g = output-of-g );
</pre>
The following Cuneiform program creates three parallel applications of the function <code>f</code> by mapping <code>f</code> over a three-element list:
<pre>
let xs : [File] =
['a.txt', 'b.txt', 'c.txt' : File];
for x <- xs do
f( x = x )
: File
end;
</pre>
Similarly, the applications of <code>f</code> and <code>g</code> are independent in the construction of the record <code>r</code> and can, thus, be run in parallel:
<pre>
let r : <a : File, b : File> =
<a = f(), b = g()>;
</pre>
==Examples==
|