Search in sources :

Example 6 with ICompute

use of edu.iu.dsc.tws.api.compute.nodes.ICompute in project twister2 by DSC-SPIDAL.

the class STPartitionExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    MessageType dataType = MessageTypes.INTEGER_ARRAY;
    String edge = "edge";
    BaseSource g = new SourceTask(edge);
    ((SourceTask) g).setMarkTimingOnlyForLowestTarget(true);
    ICompute r = new PartitionSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.partition(SOURCE).viaEdge(edge).withDataType(dataType);
    return computeGraphBuilder;
}
Also used : BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute) MessageType(edu.iu.dsc.tws.api.comms.messaging.types.MessageType)

Example 7 with ICompute

use of edu.iu.dsc.tws.api.compute.nodes.ICompute in project twister2 by DSC-SPIDAL.

the class BTPartitionKeyedExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    MessageType keyType = MessageTypes.INTEGER;
    MessageType dataType = MessageTypes.INTEGER_ARRAY;
    String edge = "edge";
    BaseSource g = new SourceTask(edge, true);
    ICompute r = new BKeyedPartitionSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.keyedPartition(SOURCE).viaEdge(edge).withKeyType(keyType).withTaskPartitioner(new DeterministicTaskPartitioner()).withDataType(dataType);
    return computeGraphBuilder;
}
Also used : BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) DeterministicTaskPartitioner(edu.iu.dsc.tws.examples.utils.partitioners.DeterministicTaskPartitioner) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute) MessageType(edu.iu.dsc.tws.api.comms.messaging.types.MessageType)

Example 8 with ICompute

use of edu.iu.dsc.tws.api.compute.nodes.ICompute in project twister2 by DSC-SPIDAL.

the class STAllReduceExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    String edge = "edge";
    BaseSource g = new SourceTask(edge);
    ICompute r = new AllReduceSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.allreduce(SOURCE).viaEdge(edge).withOperation(Op.SUM, MessageTypes.INTEGER_ARRAY);
    return computeGraphBuilder;
}
Also used : BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute)

Example 9 with ICompute

use of edu.iu.dsc.tws.api.compute.nodes.ICompute in project twister2 by DSC-SPIDAL.

the class STGatherExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    MessageType dataType = MessageTypes.INTEGER_ARRAY;
    String edge = "edge";
    BaseSource g = new SourceTask(edge);
    ICompute r = new GatherSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.gather(SOURCE).viaEdge(edge).withDataType(dataType);
    return computeGraphBuilder;
}
Also used : BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute) MessageType(edu.iu.dsc.tws.api.comms.messaging.types.MessageType)

Example 10 with ICompute

use of edu.iu.dsc.tws.api.compute.nodes.ICompute in project twister2 by DSC-SPIDAL.

the class STKeyedReduceExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelism = taskStages.get(0);
    int sinkParallelism = taskStages.get(1);
    Op operation = Op.SUM;
    MessageType keyType = MessageTypes.INTEGER;
    MessageType dataType = MessageTypes.INTEGER_ARRAY;
    String edge = "edge";
    BaseSource g = new SourceTask(edge, true);
    ICompute r = new KeyedReduceSinkTask();
    computeGraphBuilder.addSource(SOURCE, g, sourceParallelism);
    computeConnection = computeGraphBuilder.addCompute(SINK, r, sinkParallelism);
    computeConnection.keyedReduce(SOURCE).viaEdge(edge).withOperation(operation, dataType).withKeyType(keyType);
    return computeGraphBuilder;
}
Also used : Op(edu.iu.dsc.tws.api.comms.Op) BaseSource(edu.iu.dsc.tws.api.compute.nodes.BaseSource) ICompute(edu.iu.dsc.tws.api.compute.nodes.ICompute) MessageType(edu.iu.dsc.tws.api.comms.messaging.types.MessageType)

Aggregations

ICompute (edu.iu.dsc.tws.api.compute.nodes.ICompute)22 BaseSource (edu.iu.dsc.tws.api.compute.nodes.BaseSource)19 MessageType (edu.iu.dsc.tws.api.comms.messaging.types.MessageType)14 ISource (edu.iu.dsc.tws.api.compute.nodes.ISource)3 Op (edu.iu.dsc.tws.api.comms.Op)2 INode (edu.iu.dsc.tws.api.compute.nodes.INode)2 SourceBatchInstance (edu.iu.dsc.tws.executor.core.batch.SourceBatchInstance)2 TaskBatchInstance (edu.iu.dsc.tws.executor.core.batch.TaskBatchInstance)2 SourceStreamingInstance (edu.iu.dsc.tws.executor.core.streaming.SourceStreamingInstance)2 TaskStreamingInstance (edu.iu.dsc.tws.executor.core.streaming.TaskStreamingInstance)2 Checkpoint (edu.iu.dsc.tws.proto.checkpoint.Checkpoint)2 ArrayList (java.util.ArrayList)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 HashBasedTable (com.google.common.collect.HashBasedTable)1 Table (com.google.common.collect.Table)1 CheckpointingClient (edu.iu.dsc.tws.api.checkpointing.CheckpointingClient)1 Communicator (edu.iu.dsc.tws.api.comms.Communicator)1 LogicalPlan (edu.iu.dsc.tws.api.comms.LogicalPlan)1 TaskPartitioner (edu.iu.dsc.tws.api.compute.TaskPartitioner)1