-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmaster_test.ml
61 lines (51 loc) · 2.04 KB
/
master_test.ml
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
56
57
58
59
60
(**************************************************************************)
(* *)
(* Functory: a distributed computing library for OCaml *)
(* Copyright (C) 2010- Jean-Christophe Filliatre and Kalyan Krishnamani *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Library General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *)
(* *)
(**************************************************************************)
open Format
open Unix
open Functory
let server = ref "localhost"
let port = ref 51000
let () =
Arg.parse
["-server", Arg.Set_string server, "<machine> sets the server name";
"-port", Arg.Set_int port, "<n> sets the port number";
"-d", Arg.Unit (fun () -> Control.set_debug true), "sets the debug flag";
]
(fun _ -> ())
"usage"
let (++) = Int64.add
let () = Network.declare_workers ~n:4 !server
let () =
let l =
Network.Poly.Master.map ["10"; "20"; "15"]
in
let v = List.fold_left (fun acc s -> acc ++ Int64.of_string s) 0L l in
printf "total = %Ld@." v
let () =
let s =
Network.Poly.Master.map_local_fold ~fold:(^) "" ["10"; "20"; "15"]
in
printf "s = %s@." s
let () =
let s =
Network.Poly.Master.map_remote_fold "" ["10"; "20"; "15"]
in
printf "s = %s@." s
let () =
let s =
Network.Poly.Master.map_fold_a "" ["10"; "20"; "15"]
in
printf "s = %s@." s