-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiparty.mli
More file actions
55 lines (41 loc) · 2.02 KB
/
Copy pathMultiparty.mli
File metadata and controls
55 lines (41 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(** Multi-party computation with message passing between participants *)
(* Copyright Xavier Leroy.
License: LGPL 2.1 or later with OCaml LGPL Linking Exception *)
type participant = int
(** Participant identifier.
Ranges between 0 inclusive and [num_participants()] exclusive.
Participant 0 is the root participant and sometimes has special role. *)
val num_participants : unit -> int
(** Total number of participants. *)
val self : unit -> participant
(** Return the identifier of the calling participant. *)
val send_int : participant -> int -> unit
(** [send_int p n] sends integer [n] to participant [p]. *)
val receive_int : participant -> int
(** [receive_int p] waits for participant [p] to send an integer
and returns it. *)
val send : participant -> 'a -> unit
(** [send p n] sends value [v] to participant [p]. *)
val receive : participant -> 'a
(** [receive p] waits for participant [p] to send a value and returns it.
This is not type-safe. The return type is not ['a] for any ['a];
it must be constrained to the actual type of the value sent. *)
val allgather_int : int -> int array
(** Gather the integers sent by all participants (except participant 0)
in an array, and share this array between all participants (except
participant 0).
Let N be [num_participants() - 1].
Each participant i in 1, ..., N calls [allgather_int xi]
and receives the array [ [|x1; ...; xN|] ]. *)
val alltoall_int : int array -> int array
(** Distribute arrays of integers between all participants
(except participant 0).
Let N be [num_participants() - 1].
The arguments are arrays of length N.
Each participant i in 1, ..., N calls [alltoall_int [|xi1...xiN|] ]
and receives the array [ [|x1i...xNi|] ]. *)
val barrier : unit -> unit
(** Block all participants until they reach the barrier. *)
val log : ('a, out_channel, unit) format -> 'a
(** Print the given format and argument to stderr, preceded with
the participant number. *)