use of edu.iu.dsc.tws.comms.stream.SDirect in project twister2 by DSC-SPIDAL.
the class SDirectExample method compute.
@Override
protected void compute(WorkerEnvironment workerEnv) {
LogicalPlanBuilder logicalPlanBuilder = LogicalPlanBuilder.plan(jobParameters.getSources(), jobParameters.getTargets(), workerEnv).withFairDistribution();
// create the communication
direct = new SDirect(workerEnv.getCommunicator(), logicalPlanBuilder, MessageTypes.INTEGER_ARRAY, new PartitionReceiver());
Set<Integer> targetTasksOfExecutor = logicalPlanBuilder.getTargetsOnThisWorker();
for (int taskId : targetTasksOfExecutor) {
if (logicalPlanBuilder.getTargets().contains(taskId)) {
directDone = false;
}
}
if (workerId == 0) {
receiverInWorker0 = targetTasksOfExecutor.iterator().next();
}
Set<Integer> sourceTasksOfExecutor = logicalPlanBuilder.getSourcesOnThisWorker();
this.resultsVerifier = new ResultsVerifier<>(inputDataArray, (ints, args) -> ints, IntArrayComparator.getInstance());
// now initialize the workers
for (int t : sourceTasksOfExecutor) {
// the map thread where data is produced
Thread mapThread = new Thread(new BenchWorker.MapWorker(t));
mapThread.start();
}
}
Aggregations