run(3) run(3)

NAME

run - start distributed program

SYNOPSIS

<program> [<cfl options>...] -- [<main options>...]

DESCRIPTION

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;

OPTIONS

SECURITY CONSIDERATIONS

Socket communication is not secured (with SSL).

NOTES

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).