= DAC 0.9.1 (comparison of the grid/cloud computing frameworks - part I) =
== Test environment ==
DAC 0.9.1 has only single threaded workers. Because of that, we had to launch 40 workers in order to fully utilize available processing units. DAC is a centralized framework (with a single master node named broker), so we also had to run broker on one of the processors. You can see the architecture of the test environment on the following figure:
{{{
#!html
}}}
== Code ==
DAC operates on the computational units named '''agents'''. The main work was done in the '''AgentCMBF''' class:
{{{
#!java
public class AgentCMBF extends Agent {
private static final long serialVersionUID = 1L;
private String recipientIdentString;
private String[] imageDesc;
public AgentCMBF(String id) {
super(id);
}
public AgentCMBF(String recipientIdentString, String[] imageDesc) {
super(null);
this.recipientIdentString = recipientIdentString;
this.imageDesc = imageDesc;
}
public void execute() throws DACException {
Worker cmbfWorker = new Worker();
FastBigInt128 result = cmbfWorker.countInImage(imageDesc);
getAgentManager().putResult(recipientIdentString, new SingleResult(imageDesc, result));
}
}
}}}
In order to perform computations, we had to divide problem into small agents and send them into broker:
{{{
#!java
Worker cmbfWorker = new Worker();
log.info("Generating tasks (n=" + n + ", level=" + level + "). Generating tasks for id " +
receivingAgent.getIdentString());
for (int i = 1; i <= n; i++) {
for (String[] imageDesc : cmbfWorker.generateImages(i, level)) {
broker.sendAgent(new AgentCMBF(receivingAgent.getIdentString(), imageDesc));
sentTasks++;
}
}
}}}
After that we had to gather results:
{{{
#!java
while (receivedResults < sentTasks) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
log.debug(e);
}
List