Coder Social home page Coder Social logo

backtracking / functory Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 4.0 2.27 MB

a distributed computing library for OCaml

License: Other

Makefile 4.00% OCaml 74.62% Standard ML 0.59% Shell 0.26% C 2.90% C++ 1.30% HTML 10.30% CSS 5.47% JavaScript 0.55%

functory's Introduction

Functory: a distributed computing library for OCaml

Copyright (C) 2010- Jean-Christophe Filliatre and Kalyan Krishnamani

Installation

./configure

make

sudo make install

If you are using ocamlfind, you can also want to run

sudo make ocamlfind-install

Mini tutorial

Assume you want to apply a function "map" such as

let map x = x+1

to some list elements such as

[1;2;3;4;5]

and sum the results with a function "fold" such as

let fold = (+)

You can do that using function "map_local_fold" from the library, as follows:

let () = Printf.printf "%d@." (map_local_fold ~map ~fold 0 [1;2;3;4;5])

The Functory library allows you to perform this computation in three different ways: either sequentially, or using several cores on the same machine, or using a network of different machines.

To use the sequential implementation, you simply use the following line of code

open Functory.Sequential

To use several cores (say 4) on a single machine, you should add instead

open Functory.Cores
let () = set_number_of_cores 4

Finally, to use a network of, say 2 cores on machine "mach1" and 4 cores on machine "mach2", you should add instead

open Functory.Network
let () = declare_workers ~n:2 "mach1"
let () = declare_workers ~n:4 "mach2"

Your program is compiled in the following way (in any case):

ocamlopt -I +functory unix.cmxa functory.cmxa <your files...>

and then run as usual. In the network case, the same program should be run on the three machines, that are the two workers and the master. (It is also possible to run different programs for master and workers; see the documentation).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.