use of edu.iu.dsc.tws.comms.core.TaskPlan in project twister2 by DSC-SPIDAL.
the class BasicGatherTestCommunication method init.
@Override
public void init(Config cfg, int containerId, ResourcePlan plan) {
LOG.log(Level.INFO, "Starting the example with container id: " + plan.getThisId());
this.config = cfg;
this.resourcePlan = plan;
this.id = containerId;
this.noOfTasksPerExecutor = NO_OF_TASKS / plan.noOfContainers();
this.randomString = new RandomString(128000, new Random(), RandomString.ALPHANUM);
// lets create the task plan
TaskPlan taskPlan = Utils.createReduceTaskPlan(cfg, plan, NO_OF_TASKS);
// first get the communication config file
TWSNetwork network = new TWSNetwork(cfg, taskPlan);
TWSCommunication channel = network.getDataFlowTWSCommunication();
Set<Integer> sources = new HashSet<>();
for (int i = 0; i < NO_OF_TASKS; i++) {
sources.add(i);
}
int dest = NO_OF_TASKS;
Map<String, Object> newCfg = new HashMap<>();
LOG.info("Setting up reduce dataflow operation");
try {
// this method calls the init method
// I think this is wrong
aggregate = channel.gather(newCfg, MessageType.INTEGER, 0, sources, dest, new FinalGatherReceive());
for (int i = 0; i < noOfTasksPerExecutor; i++) {
// the map thread where data is produced
LOG.info(String.format("%d Starting %d", id, i + id * noOfTasksPerExecutor));
Thread mapThread = new Thread(new MapWorker(i + id * noOfTasksPerExecutor));
mapThread.start();
}
// we need to progress the communication
while (true) {
try {
// progress the channel
channel.progress();
// we should progress the communication directive
aggregate.progress();
Thread.yield();
} catch (Throwable t) {
t.printStackTrace();
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}
use of edu.iu.dsc.tws.comms.core.TaskPlan in project twister2 by DSC-SPIDAL.
the class BasicMemoryManagerByteKeyedGatherCommunication method init.
@Override
public void init(Config cfg, int containerId, ResourcePlan plan) {
LOG.log(Level.INFO, "Starting the example with container id: " + plan.getThisId());
this.config = cfg;
this.resourcePlan = plan;
this.id = containerId;
this.noOfTasksPerExecutor = NO_OF_TASKS / plan.noOfContainers();
this.randomString = new RandomString(128000, new Random(), RandomString.ALPHANUM);
// lets create the task plan
TaskPlan taskPlan = Utils.createReduceTaskPlan(cfg, plan, NO_OF_TASKS);
// first get the communication config file
TWSNetwork network = new TWSNetwork(cfg, taskPlan);
TWSCommunication channel = network.getDataFlowTWSCommunication();
Set<Integer> sources = new HashSet<>();
for (int i = 0; i < NO_OF_TASKS; i++) {
sources.add(i);
}
int dest = NO_OF_TASKS;
Map<String, Object> newCfg = new HashMap<>();
LOG.info("Setting up keyed gather MM dataflow operation");
try {
// this method calls the init method
// I think this is wrong
aggregate = channel.gather(newCfg, MessageType.BYTE, MessageType.BYTE, 0, sources, dest, new GatherBatchFinalReceiver(new FinalGatherReceive()), new GatherBatchPartialReceiver(dest));
aggregate.setMemoryMapped(true);
for (int i = 0; i < noOfTasksPerExecutor; i++) {
// the map thread where data is produced
LOG.info(String.format("%d Starting %d", id, i + id * noOfTasksPerExecutor));
Thread mapThread = new Thread(new MapWorker(i + id * noOfTasksPerExecutor));
mapThread.start();
}
// we need to progress the communication
while (true) {
try {
// progress the channel
channel.progress();
// we should progress the communication directive
aggregate.progress();
Thread.yield();
} catch (Throwable t) {
t.printStackTrace();
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}
use of edu.iu.dsc.tws.comms.core.TaskPlan in project twister2 by DSC-SPIDAL.
the class BasicMemoryManagerContainer method init.
@Override
public void init(Config cfg, int containerId, ResourcePlan plan) {
LOG.log(Level.INFO, "Starting the example with container id: " + plan.getThisId());
this.config = cfg;
this.resourcePlan = plan;
this.id = containerId;
this.noOfTasksPerExecutor = NO_OF_TASKS / plan.noOfContainers();
this.randomString = new RandomString(128000, new Random(), RandomString.ALPHANUM);
// lets create the task plan
TaskPlan taskPlan = Utils.createReduceTaskPlan(cfg, plan, NO_OF_TASKS);
// first get the communication config file
TWSNetwork network = new TWSNetwork(cfg, taskPlan);
TWSCommunication channel = network.getDataFlowTWSCommunication();
Set<Integer> sources = new HashSet<>();
for (int i = 0; i < NO_OF_TASKS; i++) {
sources.add(i);
}
int dest = NO_OF_TASKS;
Map<String, Object> newCfg = new HashMap<>();
LOG.info("###################### Running LMDB unit tests ######################");
testPrimitivesLMDB();
LOG.info("################# Running BufferedMemoryManager unit tests ##################");
testPrimitivesBuffered();
}
use of edu.iu.dsc.tws.comms.core.TaskPlan in project twister2 by DSC-SPIDAL.
the class BasicMemoryManagerGatherCommunication method init.
@Override
public void init(Config cfg, int containerId, ResourcePlan plan) {
LOG.log(Level.INFO, "Starting the example with container id: " + plan.getThisId());
this.config = cfg;
this.resourcePlan = plan;
this.id = containerId;
this.noOfTasksPerExecutor = NO_OF_TASKS / plan.noOfContainers();
this.randomString = new RandomString(128000, new Random(), RandomString.ALPHANUM);
// lets create the task plan
TaskPlan taskPlan = Utils.createReduceTaskPlan(cfg, plan, NO_OF_TASKS);
// first get the communication config file
TWSNetwork network = new TWSNetwork(cfg, taskPlan);
TWSCommunication channel = network.getDataFlowTWSCommunication();
Set<Integer> sources = new HashSet<>();
for (int i = 0; i < NO_OF_TASKS; i++) {
sources.add(i);
}
int dest = NO_OF_TASKS;
Map<String, Object> newCfg = new HashMap<>();
LOG.info("Setting up gather MM dataflow operation");
try {
// this method calls the init method
// I think this is wrong
aggregate = channel.gather(newCfg, MessageType.INTEGER, 0, sources, dest, new GatherBatchFinalReceiver(new FinalGatherReceive()), new GatherBatchPartialReceiver(dest));
aggregate.setMemoryMapped(true);
for (int i = 0; i < noOfTasksPerExecutor; i++) {
// the map thread where data is produced
LOG.info(String.format("%d Starting %d", id, i + id * noOfTasksPerExecutor));
Thread mapThread = new Thread(new MapWorker(i + id * noOfTasksPerExecutor));
mapThread.start();
}
// we need to progress the communication
while (true) {
try {
// progress the channel
channel.progress();
// we should progress the communication directive
aggregate.progress();
Thread.yield();
} catch (Throwable t) {
t.printStackTrace();
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}
use of edu.iu.dsc.tws.comms.core.TaskPlan in project twister2 by DSC-SPIDAL.
the class BasicMemoryManagerKeyedGatherCommunication method init.
@Override
public void init(Config cfg, int containerId, ResourcePlan plan) {
LOG.log(Level.INFO, "Starting the example with container id: " + plan.getThisId());
this.config = cfg;
this.resourcePlan = plan;
this.id = containerId;
this.noOfTasksPerExecutor = NO_OF_TASKS / plan.noOfContainers();
this.randomString = new RandomString(128000, new Random(), RandomString.ALPHANUM);
// lets create the task plan
TaskPlan taskPlan = Utils.createReduceTaskPlan(cfg, plan, NO_OF_TASKS);
// first get the communication config file
TWSNetwork network = new TWSNetwork(cfg, taskPlan);
TWSCommunication channel = network.getDataFlowTWSCommunication();
Set<Integer> sources = new HashSet<>();
for (int i = 0; i < NO_OF_TASKS; i++) {
sources.add(i);
}
int dest = NO_OF_TASKS;
Map<String, Object> newCfg = new HashMap<>();
LOG.info("Setting up keyed gather MM dataflow operation");
try {
// this method calls the init method
// I think this is wrong
aggregate = channel.gather(newCfg, MessageType.INTEGER, MessageType.INTEGER, 0, sources, dest, new GatherBatchFinalReceiver(new FinalGatherReceive()), new GatherBatchPartialReceiver(dest));
aggregate.setMemoryMapped(true);
for (int i = 0; i < noOfTasksPerExecutor; i++) {
// the map thread where data is produced
LOG.info(String.format("%d Starting %d", id, i + id * noOfTasksPerExecutor));
Thread mapThread = new Thread(new MapWorker(i + id * noOfTasksPerExecutor));
mapThread.start();
}
// we need to progress the communication
while (true) {
try {
// progress the channel
channel.progress();
// we should progress the communication directive
aggregate.progress();
Thread.yield();
} catch (Throwable t) {
t.printStackTrace();
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}
Aggregations