use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class PageRankWorker method buildGraphInitialValueTG.
public static ComputeGraph buildGraphInitialValueTG(String dataDirectory, int dsize, int parallelismValue, Config conf) {
GraphDataSource pageRankValueHolder = new GraphDataSource(Context.TWISTER2_DIRECT_EDGE, dataDirectory, dsize);
PageRankValueHolderCompute pageRankValueHolderCompute = new PageRankValueHolderCompute(Context.TWISTER2_DIRECT_EDGE, dsize, parallelismValue);
PageRankValueHolderSink pageRankValueHolderSink = new PageRankValueHolderSink("InitialValue");
ComputeGraphBuilder pagerankInitialationTaskGraphBuilder = ComputeGraphBuilder.newBuilder(conf);
// Add source, compute, and sink tasks to the task graph builder for the first task graph
pagerankInitialationTaskGraphBuilder.addSource("pageRankValueHolder", pageRankValueHolder, parallelismValue);
ComputeConnection datapointComputeConnection = pagerankInitialationTaskGraphBuilder.addCompute("pageRankValueHolderCompute", pageRankValueHolderCompute, parallelismValue);
ComputeConnection firstGraphComputeConnection = pagerankInitialationTaskGraphBuilder.addCompute("pageRankValueHolderSink", pageRankValueHolderSink, parallelismValue);
// Creating the communication edges between the tasks for the second task graph
datapointComputeConnection.direct("pageRankValueHolder").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
firstGraphComputeConnection.direct("pageRankValueHolderCompute").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
pagerankInitialationTaskGraphBuilder.setMode(OperationMode.BATCH);
pagerankInitialationTaskGraphBuilder.setTaskGraphName("GraphInitialValueTG");
// Build the first taskgraph
return pagerankInitialationTaskGraphBuilder.build();
}
use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class PageRankWorker method buildDataPointsTG.
public static ComputeGraph buildDataPointsTG(String dataDirectory, int dsize, int parallelismValue, Config conf) {
GraphDataSource dataObjectSource = new GraphDataSource(Context.TWISTER2_DIRECT_EDGE, dataDirectory, dsize);
DataObjectCompute dataObjectCompute = new DataObjectCompute(Context.TWISTER2_DIRECT_EDGE, dsize, parallelismValue);
DataObjectSink dataObjectSink = new DataObjectSink("Partitionsink");
ComputeGraphBuilder datapointsTaskGraphBuilder = ComputeGraphBuilder.newBuilder(conf);
// Add source, compute, and sink tasks to the task graph builder for the first task graph
datapointsTaskGraphBuilder.addSource("Graphdatasource", dataObjectSource, parallelismValue);
ComputeConnection datapointComputeConnection = datapointsTaskGraphBuilder.addCompute("Graphdatacompute", dataObjectCompute, parallelismValue);
ComputeConnection firstGraphComputeConnection = datapointsTaskGraphBuilder.addCompute("Graphdatasink", dataObjectSink, parallelismValue);
// Creating the communication edges between the tasks for the second task graph
datapointComputeConnection.direct("Graphdatasource").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
firstGraphComputeConnection.direct("Graphdatacompute").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
datapointsTaskGraphBuilder.setMode(OperationMode.BATCH);
datapointsTaskGraphBuilder.setTaskGraphName("datapointsTG");
// Build the first taskgraph
return datapointsTaskGraphBuilder.build();
}
use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class SingleSourceShortestPathWorker method buildComputationSsspTG.
public static ComputeGraph buildComputationSsspTG(int parallelismValue, Config conf) {
SsspSource ssspSource = new SsspSource();
SsspKeyedReduce ssspKeyedReduce = new SsspKeyedReduce();
SsspSink ssspSink = new SsspSink();
ComputeGraphBuilder ssspTaskGraphBuilder = ComputeGraphBuilder.newBuilder(conf);
ssspTaskGraphBuilder.addSource("ssspSource", ssspSource, parallelismValue);
ComputeConnection computeConnectionKeyedReduce = ssspTaskGraphBuilder.addCompute("ssspKeyedReduce", ssspKeyedReduce, parallelismValue);
ComputeConnection computeConnectionAllReduce = ssspTaskGraphBuilder.addCompute("ssspSink", ssspSink, parallelismValue);
computeConnectionKeyedReduce.keyedReduce("ssspSource").viaEdge("keyedreduce").withReductionFunction(new Keyedreducefun()).withKeyType(MessageTypes.OBJECT).withDataType(MessageTypes.INTEGER_ARRAY);
computeConnectionAllReduce.allreduce("ssspKeyedReduce").viaEdge("all-reduce").withReductionFunction(new AggregateFn()).withDataType(MessageTypes.OBJECT);
ssspTaskGraphBuilder.setMode(OperationMode.BATCH);
ssspTaskGraphBuilder.setTaskGraphName("ComputationSsspTG");
return ssspTaskGraphBuilder.build();
}
use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class SingleSourceShortestPathWorker method buildSsspInitialTG.
public static ComputeGraph buildSsspInitialTG(String dataDirectory, int dsize, int parallelismValue, String soruceVertex, Config conf) {
// the second task graph for assign initial pagerank values for vertex.
GraphDataSource ssspInitialDatasource = new GraphDataSource(Context.TWISTER2_DIRECT_EDGE, dataDirectory, dsize);
SsspInitialCompute ssspInitialCompute = new SsspInitialCompute(Context.TWISTER2_DIRECT_EDGE, dsize, parallelismValue, soruceVertex);
SsspInitialSink ssspInitialSink = new SsspInitialSink("InitialValue");
ComputeGraphBuilder datapointsTaskGraphBuilder = ComputeGraphBuilder.newBuilder(conf);
// Add source, compute, and sink tasks to the task graph builder for the first task graph
datapointsTaskGraphBuilder.addSource("ssspInitialDatasource", ssspInitialDatasource, parallelismValue);
ComputeConnection datapointComputeConnection = datapointsTaskGraphBuilder.addCompute("ssspInitialCompute", ssspInitialCompute, parallelismValue);
ComputeConnection firstGraphComputeConnection = datapointsTaskGraphBuilder.addCompute("ssspInitialSink", ssspInitialSink, parallelismValue);
// Creating the communication edges between the tasks for the second task graph
datapointComputeConnection.direct("ssspInitialDatasource").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
firstGraphComputeConnection.direct("ssspInitialCompute").viaEdge(Context.TWISTER2_DIRECT_EDGE).withDataType(MessageTypes.OBJECT);
datapointsTaskGraphBuilder.setMode(OperationMode.BATCH);
datapointsTaskGraphBuilder.setTaskGraphName("SsspInitialTG");
// Build the first taskgraph
return datapointsTaskGraphBuilder.build();
}
use of edu.iu.dsc.tws.task.impl.ComputeGraphBuilder in project twister2 by DSC-SPIDAL.
the class RoundRobinTaskSchedulerTest method createGraph.
private ComputeGraph createGraph(int parallel) {
TaskSchedulerClassTest.TestSource testSource = new TaskSchedulerClassTest.TestSource();
TaskSchedulerClassTest.TestSink testSink = new TaskSchedulerClassTest.TestSink();
ComputeGraphBuilder builder = ComputeGraphBuilder.newBuilder(Config.newBuilder().build());
builder.addSource("source", testSource, parallel);
ComputeConnection c = builder.addCompute("sink", testSink, parallel);
c.reduce("source").viaEdge("edge").withOperation(Op.SUM, MessageTypes.INTEGER_ARRAY);
builder.setMode(OperationMode.STREAMING);
return builder.build();
}
Aggregations