use of edu.iu.dsc.tws.comms.table.ArrowAllToAll in project twister2 by DSC-SPIDAL.
the class BTAllToAll method execute.
@Override
public void execute(Config config, JobAPI.Job job, IWorkerController workerController, IPersistentVolume persistentVolume, IVolatileVolume volatileVolume) {
this.jobParameters = JobParameters.build(config);
// create a worker environment
this.wEnv = WorkerEnvironment.init(config, job, workerController, persistentVolume, volatileVolume);
LogicalPlanBuilder logicalPlanBuilder = LogicalPlanBuilder.plan(jobParameters.getSources(), jobParameters.getTargets(), wEnv).withFairDistribution();
RootAllocator rootAllocator = new RootAllocator();
IntVector intVector = new IntVector("fist", rootAllocator);
Float8Vector float8Vector = new Float8Vector("second", rootAllocator);
for (int i = 0; i < 1000; i++) {
intVector.setSafe(i, i);
float8Vector.setSafe(i, i);
}
intVector.setValueCount(1000);
float8Vector.setValueCount(1000);
List<Field> fieldList = Arrays.asList(intVector.getField(), float8Vector.getField());
Schema schema = new Schema(fieldList);
Table t = new ArrowTable(schema, Arrays.asList(new FieldVector[] { intVector, float8Vector }));
allToAll = new ArrowAllToAll(wEnv.getConfig(), wEnv.getWorkerController(), logicalPlanBuilder.getSources(), logicalPlanBuilder.getTargets(), logicalPlanBuilder.build(), wEnv.getCommunicator().nextEdge(), new ArrowReceiver(), schema, rootAllocator);
for (int i : logicalPlanBuilder.getTargets()) {
allToAll.insert(t, i);
}
for (int s : logicalPlanBuilder.getSourcesOnThisWorker()) {
allToAll.finish(s);
}
while (!allToAll.isComplete()) {
// wait
}
}
Aggregations