-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathworker_test.ml
37 lines (31 loc) · 1.61 KB
/
worker_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
(**************************************************************************)
(* *)
(* 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 port = ref 51000
let () =
Arg.parse
["-port", Arg.Set_int port, "<n> sets the port number";
"-d", Arg.Unit (fun () -> Control.set_debug true), "sets the debug flag";]
(fun _ -> ())
"worker_test: usage:"
let port = !port
let compute s =
let rec fib n = if n <= 1 then 1 else fib (n-1) + fib (n-2) in
string_of_int (fib (int_of_string s))
let _ = Network.Poly.Worker.compute compute ~port ()
let () = printf "it works!@."