Search in sources :

Example 1 with Op

use of edu.iu.dsc.tws.api.comms.Op 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)

Example 2 with Op

use of edu.iu.dsc.tws.api.comms.Op in project twister2 by DSC-SPIDAL.

the class BTKeyedReduceExample method buildTaskGraph.

@Override
public ComputeGraphBuilder buildTaskGraph() {
    List<Integer> taskStages = jobParameters.getTaskStages();
    int sourceParallelsim = 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, sourceParallelsim);
    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

Op (edu.iu.dsc.tws.api.comms.Op)2 MessageType (edu.iu.dsc.tws.api.comms.messaging.types.MessageType)2 BaseSource (edu.iu.dsc.tws.api.compute.nodes.BaseSource)2 ICompute (edu.iu.dsc.tws.api.compute.nodes.ICompute)2