Overview

BRAHMS is a cross-platform execution framework; that is, it is available on multiple platforms (Windows, Linux, OSX) and you can develop components on any of these. However, it is also straightforward to run a cross-platform execution; that is, to have different sorts of machine involved in the same run-time execution. Nothing needs to be done differently from launching any multi-machine Concerto execution, though the versions of BRAHMS on the machines must, naturally, match. For example, below, we illustrate running brahms_test comms across a Windows and a Linux machine.

Example

Preparation

To generate the Execution and System files, run brahms_test comms.s 1000 100. This places two files in the WorkingDirectory (and executes using two local voices talking to each other on the loopback interface). To run this execution across two machines, we would usually set exe.addresses and exe.launch in our Matlab script, but here we'll set the execution up manually to illustrate what's going on, and that we don't need Matlab to do it.

In the Execution File you'll find the loopback interface (127.0.0.1) specified twice, as the addresses on which we can reach each Voice. Change these to the IP addresses of your Voice 1 and Voice 2 machines, respectively.

Both the Execution and System File need to be visible on both machines. If we were launching automatically, we'd either have the files written to a shared drive by the bindings by setting exe.workingDirectory or we'd copy them by some other means after preparing the execution. For this example, just copy them manually so that they are visible on both machines (it doesn't matter where, or that they be in the same place on both machines).

Launch

We can now launch the execution on each machine in turn; if we're too slow, the first machine will generate E_COMMS_TIMEOUT before the second comes up, but the default settings allow plenty of time. On the machine designated to run Voice 1, execute brahms <ExecutionFile> --voice-1; do similar for Voice 2 on the other machine, passing --voice-2. If all is well, the execution will begin.

Expected Output

Here, we show what the execution looks like running across the two machines (click to enlarge).

Example

Here is an actual working script that sets up a cross-platform execution (it's modified from brahms_test comms.s). Note that there is no indication as to what machine type is on the remote voice other than the syntax of the paths used in the launch line. That is, a cross-platform execution looks just like a within-platform execution.

M Source Code (against 995)
% empty system sys = sml_system; % process state state = []; state.complex = false; state.dims = 1000; state.type = 'DOUBLE'; % processes sys = sys.addprocess('sum0', 'std/2009/math/esum', 1, state); sys = sys.addprocess('sum1', 'std/2009/math/esum', 1, state); % form closed loop sys = sys.link('sum0>out', 'sum1'); sys = sys.link('sum1>out', 'sum0'); % construct exe exe = brahms_execution; exe.name = 'xcomms'; exe.stop = 10000; % step 1: put files somewhere visible on both machines exe.executionFile = 'z:\xcomms-exe.xml'; % step 2: use sockets layer for comms, and set IPs correctly exe.addresses = { '143.167.x.x' '143.167.x.x' }; % step 3: choose launch lines that invoke BRAHMS on each % machine (TIP: base these on the default launch lines % returned by "exe.launch") launch_local = [ 'brahms ((EXECFILE)) --logfmt-xml --voice-((VOICE)) ' ... '--logfile-((LOGFILE)) --exitfile-((EXITFILE)) ((ARGS))' ]; launch_remote = [ 'ssh ace brahms /share/xcomms-exe.xml --logfmt-xml --voice-((VOICE)) ' ... '--logfile-/share/xcomms-log-((VOICE)).xml ' ... '--exitfile-/share/xcomms-rep-((VOICE)).xml.exit ((ARGS))' ]; exe.launch = { launch_local launch_remote }; % execute [out, rep] = brahms(sys, exe);