Structure of the program
An ocamlp3l program is syntactycally built out of the following items:
- the open directives needed to compile and run the
program. These are the following:
- open Seqp3l;;
in case you want sequential execution
- open Parp3l;;
open Nodecode;;
open Template;;
in case you want parallel execution plus all the open
directives needed by your own sequential ocaml code embedded in the
skeletons.
Note that this include directives are the only thing you need to
change in order to run the skeleton code sequentially or in
parallel.
- the sequential ocaml code defining the functions/data used within
the skeleton code
- the pardo expression evaluating the program. The pardo
function takes a skeleton expression and evaluated it (in parallel or
sequentially, according to the modules opened).
Skeleton syntax
Skeletons are denoted as functions:
- farm is denoted by a binary function farm whose first
argument is the function computed by the farm workers and whose second
argument is the number of workers that have to be included in the
farm.
- pipe is denoted by the binary infix operator |||
- loop is denoted by the binary function loop whose first
argument is the function computing the terminal condition (returns
false if no more iterations are needed) and whose second argument is
the body function, i.e. the function to apply in order to get the
value that have to be passed to the next loop iteration.
- map is denoted by a binary function mapvector whose first
argument is the function computed by the map workers and whose second
argument is the number of workers that have to be included in the
map.
- reduce is denoted by the binary function reducevector
whose first
argument is the associative and commutative binary
function computed by the reduce workers and whose second
argument is the number of workers that have to be included in the
reduce logical tree.
have a look here at some ocamlp3l source code.