Search in sources :

Example 1 with ExecutionPlan

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

the class TaskUtils method execute.

public static void execute(Config config, int workerID, ComputeGraph graph, IWorkerController workerController) {
    RoundRobinTaskScheduler roundRobinTaskScheduler = new RoundRobinTaskScheduler();
    roundRobinTaskScheduler.initialize(config);
    List<JobMasterAPI.WorkerInfo> workerList = null;
    try {
        workerList = workerController.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
        return;
    }
    WorkerPlan workerPlan = createWorkerPlan(workerList);
    TaskSchedulePlan taskSchedulePlan = roundRobinTaskScheduler.schedule(graph, workerPlan);
    TWSChannel network = Network.initializeChannel(config, workerController);
    ExecutionPlanBuilder executionPlanBuilder = new ExecutionPlanBuilder(workerID, workerList, new Communicator(config, network), workerController.getCheckpointingClient());
    ExecutionPlan plan = executionPlanBuilder.build(config, graph, taskSchedulePlan);
    ExecutorFactory executor = new ExecutorFactory(config, workerID, network);
    executor.getExecutor(config, plan, graph.getOperationMode()).execute();
}
Also used : TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) Communicator(edu.iu.dsc.tws.api.comms.Communicator) TWSChannel(edu.iu.dsc.tws.api.comms.channel.TWSChannel) ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) ExecutionPlanBuilder(edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder) ExecutorFactory(edu.iu.dsc.tws.executor.threading.ExecutorFactory) RoundRobinTaskScheduler(edu.iu.dsc.tws.tsched.streaming.roundrobin.RoundRobinTaskScheduler) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)

Example 2 with ExecutionPlan

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

the class TaskUtils method executeBatch.

public static void executeBatch(Config config, int workerID, ComputeGraph graph, IWorkerController workerController) {
    RoundRobinTaskScheduler roundRobinTaskScheduler = new RoundRobinTaskScheduler();
    roundRobinTaskScheduler.initialize(config);
    WorkerPlan workerPlan = null;
    List<JobMasterAPI.WorkerInfo> workerList = null;
    try {
        workerList = workerController.getAllWorkers();
    } catch (TimeoutException timeoutException) {
        LOG.log(Level.SEVERE, timeoutException.getMessage(), timeoutException);
        return;
    }
    workerPlan = createWorkerPlan(workerList);
    TaskSchedulePlan taskSchedulePlan = roundRobinTaskScheduler.schedule(graph, workerPlan);
    TWSChannel network = Network.initializeChannel(config, workerController);
    ExecutionPlanBuilder executionPlanBuilder = new ExecutionPlanBuilder(workerID, workerList, new Communicator(config, network), workerController.getCheckpointingClient());
    ExecutionPlan plan = executionPlanBuilder.build(config, graph, taskSchedulePlan);
    ExecutorFactory executor = new ExecutorFactory(config, workerID, network);
    executor.getExecutor(config, plan, graph.getOperationMode()).execute();
}
Also used : TaskSchedulePlan(edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan) Communicator(edu.iu.dsc.tws.api.comms.Communicator) TWSChannel(edu.iu.dsc.tws.api.comms.channel.TWSChannel) ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) ExecutionPlanBuilder(edu.iu.dsc.tws.executor.core.ExecutionPlanBuilder) ExecutorFactory(edu.iu.dsc.tws.executor.threading.ExecutorFactory) RoundRobinTaskScheduler(edu.iu.dsc.tws.tsched.streaming.roundrobin.RoundRobinTaskScheduler) WorkerPlan(edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan) TimeoutException(edu.iu.dsc.tws.api.exceptions.TimeoutException)

Example 3 with ExecutionPlan

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

the class SvmSgdOnlineRunner method streamData.

private void streamData() {
    ComputeGraph streamingTrainingTG = buildStreamingTrainingTG();
    ExecutionPlan executionPlan = taskExecutor.plan(streamingTrainingTG);
    taskExecutor.addInput(streamingTrainingTG, executionPlan, Constants.SimpleGraphConfig.ITERATIVE_STREAMING_DATASTREAMER_SOURCE, Constants.SimpleGraphConfig.INPUT_DATA, trainingDoubleDataPointObject);
    taskExecutor.addInput(streamingTrainingTG, executionPlan, Constants.SimpleGraphConfig.ITERATIVE_STREAMING_DATASTREAMER_SOURCE, Constants.SimpleGraphConfig.INPUT_WEIGHT_VECTOR, inputDoubleWeightvectorObject);
    taskExecutor.addInput(streamingTrainingTG, executionPlan, "window-sink", Constants.SimpleGraphConfig.TEST_DATA, testingDoubleDataPointObject);
    taskExecutor.execute(streamingTrainingTG, executionPlan);
// currentDataPoint = taskExecutor.getOutput(streamingTrainingTG,
// executionPlan,
// Constants.SimpleGraphConfig.ITERATIVE_STREAMING_SVM_COMPUTE);
// double[] dp = currentDataPoint.getPartitions(0).getConsumer().next();
// LOG.info(String.format("DataPoint[%d] : %s", count++, Arrays.toString(dp)));
}
Also used : ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) ComputeGraph(edu.iu.dsc.tws.api.compute.graph.ComputeGraph)

Example 4 with ExecutionPlan

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

the class SvmSgdOnlineRunner method loadTrainingData.

private void loadTrainingData() {
    ComputeGraph trainingDFTG = TGUtils.buildTrainingDataPointsTG(this.dataStreamerParallelism, this.svmJobParameters, this.config, this.operationMode);
    ExecutionPlan trainingEP = taskExecutor.plan(trainingDFTG);
    taskExecutor.execute(trainingDFTG, trainingEP);
    trainingDoubleDataPointObject = taskExecutor.getOutput(trainingDFTG, trainingEP, Constants.SimpleGraphConfig.DATA_OBJECT_SINK);
    for (int i = 0; i < trainingDoubleDataPointObject.getPartitions().length; i++) {
        double[][] datapoints = trainingDoubleDataPointObject.getPartitions()[i].getConsumer().next();
        LOG.info(String.format("Training Datapoints : %d,%d", datapoints.length, datapoints[0].length));
        int randomIndex = new Random().nextInt(this.svmJobParameters.getSamples() / dataStreamerParallelism - 1);
        LOG.info(String.format("Random DataPoint[%d] : %s", randomIndex, Arrays.toString(datapoints[randomIndex])));
    }
}
Also used : ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) Random(java.util.Random) ComputeGraph(edu.iu.dsc.tws.api.compute.graph.ComputeGraph)

Example 5 with ExecutionPlan

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

the class SvmSgdOnlineRunner method loadTestingData.

private void loadTestingData() {
    ComputeGraph testingDFTG = TGUtils.buildTestingDataPointsTG(this.dataStreamerParallelism, this.svmJobParameters, this.config, this.operationMode);
    ExecutionPlan testingEP = taskExecutor.plan(testingDFTG);
    taskExecutor.execute(testingDFTG, testingEP);
    testingDoubleDataPointObject = taskExecutor.getOutput(testingDFTG, testingEP, Constants.SimpleGraphConfig.DATA_OBJECT_SINK_TESTING);
    for (int i = 0; i < testingDoubleDataPointObject.getPartitions().length; i++) {
        double[][] datapoints = testingDoubleDataPointObject.getPartitions()[i].getConsumer().next();
        LOG.info(String.format("Partition[%d] Testing Datapoints : %d,%d", i, datapoints.length, datapoints[0].length));
        int randomIndex = new Random().nextInt(this.svmJobParameters.getTestingSamples() / dataStreamerParallelism - 1);
        LOG.info(String.format("Random DataPoint[%d] : %s", randomIndex, Arrays.toString(datapoints[randomIndex])));
    }
}
Also used : ExecutionPlan(edu.iu.dsc.tws.api.compute.executor.ExecutionPlan) Random(java.util.Random) ComputeGraph(edu.iu.dsc.tws.api.compute.graph.ComputeGraph)

Aggregations

ExecutionPlan (edu.iu.dsc.tws.api.compute.executor.ExecutionPlan)37 ComputeGraph (edu.iu.dsc.tws.api.compute.graph.ComputeGraph)33 ComputeConnection (edu.iu.dsc.tws.task.impl.ComputeConnection)13 DataObject (edu.iu.dsc.tws.api.dataset.DataObject)10 ComputeGraphBuilder (edu.iu.dsc.tws.task.impl.ComputeGraphBuilder)10 IExecutor (edu.iu.dsc.tws.api.compute.executor.IExecutor)9 Config (edu.iu.dsc.tws.api.config.Config)8 ComputeEnvironment (edu.iu.dsc.tws.task.ComputeEnvironment)7 JobConfig (edu.iu.dsc.tws.api.JobConfig)5 Communicator (edu.iu.dsc.tws.api.comms.Communicator)4 TaskSchedulePlan (edu.iu.dsc.tws.api.compute.schedule.elements.TaskSchedulePlan)4 DataObjectSink (edu.iu.dsc.tws.task.dataobjects.DataObjectSink)4 DataObjectSource (edu.iu.dsc.tws.task.dataobjects.DataObjectSource)4 TaskExecutor (edu.iu.dsc.tws.task.impl.TaskExecutor)4 HashMap (java.util.HashMap)4 WorkerPlan (edu.iu.dsc.tws.api.compute.schedule.elements.WorkerPlan)3 ReduceAggregator (edu.iu.dsc.tws.examples.ml.svm.aggregate.ReduceAggregator)3 SVMReduce (edu.iu.dsc.tws.examples.ml.svm.aggregate.SVMReduce)3 CheckpointingClient (edu.iu.dsc.tws.api.checkpointing.CheckpointingClient)2 TWSChannel (edu.iu.dsc.tws.api.comms.channel.TWSChannel)2