Module Mspml


module Mspml: sig  end
The core of the MSPML library

type 'a par 
Abstract type for parallel vector of size p. In the following comments we will note <v_0,...,v_(p-1)> the parallel vector whose value at processor 0 is v_O, value at processor 1 is v_1, etc.
val p : unit -> int
p() returns the number p of processes of the parallel machine.
val g : unit -> float
g() returns the BSP parameter g of the parallel machine.
val l : unit -> float
l() returns the BSP parameter l of the parallel machine.
val mkpar : (int -> 'a) -> 'a par
mkpar f evaluates to the parallel vector <v0,...,vp-1> where vi=(f i).
val apply : ('a -> 'b) par -> 'a par -> 'b par
apply vf vv where vf is a parallel vector of functions <f0,...,fp-1> and vv a parallel vector of values <v0,...,vp-1>. evaluates to <w0,...,wp-1> where wi is the result of the evaluation of (fi vi). This operation is called pointwise parallel application.
val get : 'a par -> int par -> 'a par
get <v0,...,vp-1> <i0,...,ip-1> evaluates to <vi_0,...,vi_p-1>. The process numbers are considered modulo p.
val get_array_bool : 'a par -> bool array par -> 'a option array par
get_array_bool <v0,...,vp-1> <a0,...,ap-1> evaluates to <w0,...,wp-1> where wi = Array.init (p()) (fun j->if ai.(j) then Some vj else None). The process numbers are considered modulo p.
val get_list : 'a par -> int list par -> 'a list par
get_list <v0,...,vp-1> <[i0,0;..;in_0,0], ... , [i0,p-1;..;in(p-1),p-1]> evaluates to <[vi_0,0;..;vi_n_0,0], ... , [vi_0,p-1;..;vi_n(p-1),p-1]>. The process numbers are considered modulo p.
val get_array : 'a par -> int array par -> 'a array par
Same thing but with arrays.
val mget_array_bool : (int -> 'a) par -> bool array par -> 'a option array par
Similar to get_array_bool. The first argument is a parallel vector of functions. At process i, the function fi applied to j gives the message which would be sent to process j, if this process requests a value from process i.
val mget_array : (int -> 'a) par -> int array par -> 'a array par
Similar to get_array with messages give by functions as in the previous function.
val mget_list : (int -> 'a) par -> int list par -> 'a list par
Similar to mget_array but with lists instead of arrays in the previous function.
val mget : (int -> 'a) par ->
(int -> bool) par -> (int -> 'a option) par
val unsafe_proj : 'a par -> 'a
unsafe_proj <v,...,v> = v. The result is unspecified otherwise.
exception At_failure of string
val at : 'a par -> int -> 'a
at must be only used in a if then else expression. The expressions if at <b0,...,bp-1> then E1 else E2 will be evaluated to E_1 if bpid is true, to E_2 if bpid is false. E1 and E2 must be expressions of global type. At_failure is raised if one tries to access a pid not in the interval 0,...,p-1 where p is the number of processors of the machine.
val argv : string array
In the parallel version of MSPML, Sys.argv should not be used because mspmlrun adds arguments to the command line. argv() is the command line without these arguments.
val initialize : unit -> unit
val finalize : unit -> unit
initialize() initiates a parallel computation. When used with the sequential version of the module Bsmllib, it reads the first line of $HOME/.bsmllibrc in order to obtain the values for p(), g() and l(). When used with the parallel version of the module Bsmllib, it automatically determines the number of processors p (), then reads the appropriated line of $HOME/.bsmllibrc in order to obtain the values for g and l. A program must have one and only one call to initialize().
val abort : int -> string -> unit
(abort error msg) prints the message msg and aborts the computation with exit code error.
exception Timer_failure of string
val start_timing : unit -> unit
val stop_timing : unit -> unit
val get_cost : unit -> float par
start_timing() starts the timing. stop_timing() stops it. get_cost() returns a parallel vector which contains for each processor the time elapsed between the call of start_timing and stop_timing. The exception Timer_failure is raised if the call to one of those functions is meaningless (for eg a call to stop_timing if start_timing have not been called before.
val set_verbose : int -> unit