Search in sources :

Example 1 with SPartition

use of edu.iu.dsc.tws.comms.stream.SPartition in project twister2 by DSC-SPIDAL.

the class WordCountWorker method execute.

@Override
public void execute(Config cfg, JobAPI.Job job, IWorkerController workerController, IPersistentVolume persistentVolume, IVolatileVolume volatileVolume) {
    this.config = cfg;
    this.id = workerController.getWorkerInfo().getWorkerID();
    this.noOfTasksPerExecutor = NO_OF_TASKS / workerController.getNumberOfWorkers();
    setupTasks(workerController);
    setupNetwork(workerController);
    // create the communication
    keyedPartition = new SPartition(channel, logicalPlan, sources, destinations, MessageTypes.OBJECT, new WordAggregate(), new HashingSelector());
    scheduleTasks();
    progress();
}
Also used : HashingSelector(edu.iu.dsc.tws.comms.selectors.HashingSelector) SPartition(edu.iu.dsc.tws.comms.stream.SPartition)

Example 2 with SPartition

use of edu.iu.dsc.tws.comms.stream.SPartition in project twister2 by DSC-SPIDAL.

the class SPartitionExample method compute.

@Override
protected void compute(WorkerEnvironment workerEnv) {
    LogicalPlanBuilder logicalPlanBuilder = LogicalPlanBuilder.plan(jobParameters.getSources(), jobParameters.getTargets(), workerEnv).withFairDistribution();
    // create the communication
    partition = new SPartition(workerEnv.getCommunicator(), logicalPlanBuilder, MessageTypes.INTEGER_ARRAY, new PartitionReceiver(), new LoadBalanceSelector());
    this.resultsVerifier = new ResultsVerifier<>(inputDataArray, (ints, args) -> ints, IntArrayComparator.getInstance());
    logicalPlanBuilder.getTargetsOnThisWorker().forEach(t -> {
        if (workerId == 0) {
            recvrInWorker0 = t;
        }
    });
    Set<Integer> tasksOfExecutor = logicalPlanBuilder.getSourcesOnThisWorker();
    // now initialize the workers
    for (int t : tasksOfExecutor) {
        // the map thread where data is produced
        Thread mapThread = new Thread(new MapWorker(t));
        mapThread.start();
    }
}
Also used : IntArrayComparator(edu.iu.dsc.tws.examples.verification.comparators.IntArrayComparator) TIMING_MESSAGE_RECV(edu.iu.dsc.tws.examples.utils.bench.BenchmarkConstants.TIMING_MESSAGE_RECV) LoadBalanceSelector(edu.iu.dsc.tws.comms.selectors.LoadBalanceSelector) SingularReceiver(edu.iu.dsc.tws.api.comms.SingularReceiver) Set(java.util.Set) LogicalPlanBuilder(edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder) Config(edu.iu.dsc.tws.api.config.Config) Timing(edu.iu.dsc.tws.examples.utils.bench.Timing) MessageTypes(edu.iu.dsc.tws.api.comms.messaging.types.MessageTypes) Logger(java.util.logging.Logger) BenchWorker(edu.iu.dsc.tws.examples.comms.BenchWorker) TIMING_ALL_RECV(edu.iu.dsc.tws.examples.utils.bench.BenchmarkConstants.TIMING_ALL_RECV) WorkerEnvironment(edu.iu.dsc.tws.api.resource.WorkerEnvironment) SPartition(edu.iu.dsc.tws.comms.stream.SPartition) BenchmarkUtils(edu.iu.dsc.tws.examples.utils.bench.BenchmarkUtils) ResultsVerifier(edu.iu.dsc.tws.examples.verification.ResultsVerifier) LogicalPlanBuilder(edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder) SPartition(edu.iu.dsc.tws.comms.stream.SPartition) LoadBalanceSelector(edu.iu.dsc.tws.comms.selectors.LoadBalanceSelector)

Aggregations

SPartition (edu.iu.dsc.tws.comms.stream.SPartition)2 SingularReceiver (edu.iu.dsc.tws.api.comms.SingularReceiver)1 MessageTypes (edu.iu.dsc.tws.api.comms.messaging.types.MessageTypes)1 Config (edu.iu.dsc.tws.api.config.Config)1 WorkerEnvironment (edu.iu.dsc.tws.api.resource.WorkerEnvironment)1 HashingSelector (edu.iu.dsc.tws.comms.selectors.HashingSelector)1 LoadBalanceSelector (edu.iu.dsc.tws.comms.selectors.LoadBalanceSelector)1 LogicalPlanBuilder (edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder)1 BenchWorker (edu.iu.dsc.tws.examples.comms.BenchWorker)1 TIMING_ALL_RECV (edu.iu.dsc.tws.examples.utils.bench.BenchmarkConstants.TIMING_ALL_RECV)1 TIMING_MESSAGE_RECV (edu.iu.dsc.tws.examples.utils.bench.BenchmarkConstants.TIMING_MESSAGE_RECV)1 BenchmarkUtils (edu.iu.dsc.tws.examples.utils.bench.BenchmarkUtils)1 Timing (edu.iu.dsc.tws.examples.utils.bench.Timing)1 ResultsVerifier (edu.iu.dsc.tws.examples.verification.ResultsVerifier)1 IntArrayComparator (edu.iu.dsc.tws.examples.verification.comparators.IntArrayComparator)1 Set (java.util.Set)1 Logger (java.util.logging.Logger)1