run(3) | run(3) |
run - start distributed program
<program> [<cfl options>...] -- [<main options>...]
Starts a program on multiple nodes and initializes communication. Requires POSIX systems with password-less ssh access to slave nodes and an open port on each node.
Options up to delimiter --
are specific to CFL and parsed before main starts.
Options after the delimiter are passed to the main program. This relies on the
non-standard constructor
function attribute. If not available, manually
initialize at the beginning of main with cfl::init (argc, argv)
.
To build a distributed program define the CFL_DISTRIBUTED
macro before any
inclusion of CFL headers. If set to a value, use as option -n
below.
Example source code, executing a function f
on slave node 1, synchronizing the
remote result r
when printing to console on master node.
#define CFL_DISTRIBUTED
#include <cfl/cfl.hpp>
using namespace cfl;
int main ()
{
auto f = 1_node ([] (int u) { return u + 1; });
auto r = f (0);
cout << "r = " << r << endl;
}
Compile and launch on two nodes, the master and a slave 10.0.0.2:
$ c++ -std=c++11 source.cpp
$ ./a.out -s 10.0.0.2
r = 1;
-h
:
Writes help message to console.
-f
:
Configuration file. Command line options have preceedence. Defaults to .cfl
in current or home directory. NOT IMPLEMENTED YET
-d
:
Run as daemon.
-m
:
Master ip address. Defaults to first non-loopback interface.
-p
:
Master port number. Defaults to 29170.
-s
:
IP address to slave, one -s
option per node. Requires password-less ssh
access to slave. RANGES NOT IMPLEMENTED YET.
-n
:
Number of processes. Defaults to one process per available node. Processes
are allocated block-wise to nodes.
-t
:
Number of threads in pool. Defaults to one thread. Zero means one thread per
available core. A negative value means a lower bound for the number of threads,
otherwise one thread per available core. NOT IMPLEMENTED YET
Socket communication is not secured (with SSL).
Multiple instances of distributed programs may run simultaneously. However, programs are currently limited to have the same user id, because of connection arbitration during startup (when multiple servers are listening on the same port).