9.3. Parallelism in Anableps: Master and workers¶
Some calculations in Anableps are really long. On the other hand, they are really parallelizable, and thus Anableps provides the ways to achieve it easily.
The workflow can be summarized as follows: Several computers propose themselves as workers
: they will accept any
job handled by some others computer that call themselves masters
.
A master can search for workers in its local-network, or any other network, by giving ip:port(s). A worker can accept or reject the binding to a master, depending on several conditions like workload, ip, tags, etc.
There are several procedures that are parallelized:
- movie.render
- scene.render: specially during ray-tracing that is suited to this decomposition
9.3.1. Configuring and running the master¶
To start, lets do an example:
movie m: .frames 23 .size 400x300
m.recruit .from localnetwork
m.render .parallel # this triggers the parallelization
Master can inquiry about the power and availability of workers and fire them:
if (w1.speed < 10) : fire w1
To use the parallelization, just use the .parallel
option in any of the operations that can
be parallelized. Here is a list:
render: | in some cases |
---|---|
movie rendering: | |
each worker gets a frame | |
simulations: | |
calculations: |
9.3.2. Being a worker¶
A worker is started by invoking:
anableps worker <parameters>
Where parameters is a series of tags and
A worker can choose the labels that it publishes, and can choose the labels that accept:
> anableps worker -label group1 group2 group3 "group 2a" -accept any -name computer1
9.3.2.1. Options¶
port: | select the port in which this worker listens for recruitment |
---|---|
accept: | defines accepted labels of masters in order to be able to work for them |
acceptIP: | defines from which IPs it accepts master requests. IPs can contain * to include or ranges [10..20] or sets {4,3,2} |
label: | defines labels that will be presented to the master |
name: | an unique name in the local network |
9.3.3. Technical details¶
- Workers help in several tasks, but what they receive is a workpack workpacks are defined for:
- Pixel rendering part of an scene
- Calculations of some finite elements in a simulation
- Rendering a complete scene, in the case of films
The master keeps a blackboard with resources that the worker share. How to do this?