Search in sources :

Example 1 with ArrowAllToAll

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
    }
}
Also used : Table(edu.iu.dsc.tws.common.table.Table) ArrowTable(edu.iu.dsc.tws.common.table.arrow.ArrowTable) IntVector(org.apache.arrow.vector.IntVector) ArrowAllToAll(edu.iu.dsc.tws.comms.table.ArrowAllToAll) Float8Vector(org.apache.arrow.vector.Float8Vector) Schema(org.apache.arrow.vector.types.pojo.Schema) LogicalPlanBuilder(edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder) FieldVector(org.apache.arrow.vector.FieldVector) Field(org.apache.arrow.vector.types.pojo.Field) RootAllocator(org.apache.arrow.memory.RootAllocator) ArrowTable(edu.iu.dsc.tws.common.table.arrow.ArrowTable)

Aggregations

Table (edu.iu.dsc.tws.common.table.Table)1 ArrowTable (edu.iu.dsc.tws.common.table.arrow.ArrowTable)1 ArrowAllToAll (edu.iu.dsc.tws.comms.table.ArrowAllToAll)1 LogicalPlanBuilder (edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder)1 RootAllocator (org.apache.arrow.memory.RootAllocator)1 FieldVector (org.apache.arrow.vector.FieldVector)1 Float8Vector (org.apache.arrow.vector.Float8Vector)1 IntVector (org.apache.arrow.vector.IntVector)1 Field (org.apache.arrow.vector.types.pojo.Field)1 Schema (org.apache.arrow.vector.types.pojo.Schema)1