Module Functory.Network

module Network: sig .. end

Network implementation.

Different network implementations are provided, depending on whether


type worker 
val create_worker : ?port:int -> string -> worker

create_worker s creates a new worker located on machine s. Raises Invalid_argument if s is not a valid machine.

val declare_workers : ?port:int -> ?n:int -> string -> unit

declare_workers s declares n workers on machine s (when n is not given, it defaults to 1). Number n does not necessarily coincide with the number of available cores of machine s. s could be a machine hostname or an IP number. If port is not given, it is set to the default port number (see below).

val set_default_port_number : int -> unit

Sets the default port number. If not called, the default port number is 51000.

val set_pong_timeout : float -> unit

set_pong_timeout t sets the upper time limit t for receiving a pong message from a worker (since last ping message), before we declare the worker unreachable. If not specified, it defaults to 5 seconds.

val set_ping_interval : float -> unit

set_ping_interval t sets the interval between consecutive ping messages. If not specified, it defaults to 10 seconds.

Worker type

type worker_type = ?port:int -> unit -> unit 

The type of forthcoming worker implementations. Port number is given by port; default value is 51000 and can be changed using function set_default_port_number above.

type computation_status = 
| Running
| Done
| Dead

Same binary executed as master and workers

A worker is distinguished from the master in two possible ways:

module Same: sig .. end

Polymorphic API (same version of Ocaml)

Contrary to module Same above, master and workers are no more executing the same code. Submodule Master (resp. Worker) provides functions to implement the master (resp. the workers). Arguments for functions master, map, etc. are thus split between these two submodules.

module Poly: sig .. end

Monomorphic API (possibly different versions of ocaml)

When master and workers are not compiled with the same version of Ocaml, only strings can be passed, hence the monomorphic API below. It is the responsability of user to encode/decode values.

As of now, there is no derived API in this module.

module Mono: sig .. end