- Consider a simple program relating elements of two lists:
vproc([],[]).
vproc([H|T],[HR|TR]) :-
process_element(H,HR),
vproc(T,TR).
- Will assume called in the ``forwards'' way, with ground input.
- Parallelization using ``control parallelism'':
vproc([],[]).
vproc([H|T],[HR|TR]) :-
process_element(H,HR) &
vproc(T,TR).
- ``Fine grained'' operation:
process_element(H,HR) :-
HR is ((((H*2)/5)^2) + (((H*6)/2)^3)) / 2.
- Based on the fact that the iterations are independent (proved
e.g. by the &-Prolog / CIAO compilers).
- Also determinacy information assumed.
- Similarly parallelized using ``data-parallelism'' (given the
same information).