9.2.1 Parallelization

Because of the need for parallelizing several evaluations of the goal function and thus the simulation tools, we chose to extend the language with a macro called parallel. It takes an arbitrary number of expressions as input and returns a list of results after the evaluation of all the input forms (which is done in several processes) has finished.

Example.

? (parallel (sleep 1) (sleep 1) (sleep 1))
> (NIL NIL NIL)
;; This took one second, not three.
? (parallel (sleep 1)
            (parallel (sleep 1)
                      (parallel (sleep 1) (sleep 1))))
> (NIL (NIL (NIL NIL)))
;; This took one second as well.
The parallel macro and its sister function p-apply are an important building block of SIESTA and may of course be called by the user.

Clemens Heitzinger 2003-05-08