module type BSML = sig
.. end
Types
type 'a
par
Abstract type for parallel vector of size p. In the following we
will note <v0, ..., vp-1> the parallel vector with value vi
at processor i
Machine parameters accessors
val argv : string array
Returns the arguments from command line with implementation-specific
arguments removed.
val bsp_p : int
Number p of processes in the parallel machine.
val within_bounds : int -> bool
within_bounds n
is true
is n is between 0 and p-1,
false
otherwise.
val bsp_g : float
BSP parameter g of the parallel machine.
val bsp_l : float
BSP parameter l of the parallel machine.
val bsp_r : float
BSP parameter r of the parallel machine.
Exceptions
exception Invalid_processor of int
Raised when asked for a processor id that is not between 0
and
bsp_p
- 1. In particular, this exception can be raised by the
functions that proj
and put
return.
exception Timer_failure of string
Parallel operators
val mkpar : (int -> 'a) -> 'a par
Parallel vector creation.
Parameters :
f
function to evaluate in parallel
Returns the parallel vector with
f
applied to each pid:
<
f 0
, ...,
f (p-1)
>
val apply : ('a -> 'b) par -> 'a par -> 'b par
Pointwise parallel application.
Parameters :
vf
a parallel vector of functions <f0, ..., fp-1>
vv
a parallel vector of values <v0, ..., vp-1>
Returns the parallel vector <f
0 v
0, ..., f
p-1 v
p-1>
val put : (int -> 'a) par -> (int -> 'a) par
Global communication.
Parameters :
f
= <f0, ..., fp-1>, fi j is the value that processor
i
should send to processor j
.
Returns a parallel vector
g
= <g
0, ..., g
p-1> where g
j i = f
i
j is the value received by processor
j
from processor
i
.
val proj : 'a par -> int -> 'a
projection (dual of
mkpar
). Makes all the elements of a parallel vector
global.
Parameters :
v
a parallel vector <v0, ..., vp-1>
Returns a function f such that f i = v
i
val abort : int -> string -> 'a
Aborts computation and quits.
Parameters :
err
error code to return
msg
message to print on standard error
val start_timing : unit -> unit
val stop_timing : unit -> unit
val get_cost : unit -> float par
returns a parallel vector which contains, at each processor, the time
elapsed between the calls to start_timing
and stop_timing
.
Raises Timer_failure
if the call to one of those functions was meaningless
(e.g. stop_timing
called before start_timing
).