def main(): # single run in current process mode, used for profiling if True: #with simdag.Simulation("test/data/pl_4hosts.xml", "test/data/basic_graph.dot") as simulation: with simdag.Simulation( "dag/plat_exp1/cluster_5_1-4_100_100_0.xml", "dag/tasks_exp1/Inspiral_100.xml") as simulation: #with simdag.Simulation("dag/plat_exp1/cluster_20_1-4_100_100_0.xml", "dag/tasks_exp2/testg0.6.dot") as simulation: #graph = simulation.get_task_graph() #scheduler = algorithms.HEFT(simulation) #scheduler = algorithms.DLS(simulation) #scheduler = algorithms.HCPT(simulation) scheduler = algorithms.Lookahead(simulation) #scheduler = algorithms.OLB(simulation) #scheduler = algorithms.BatchMin(simulation) #scheduler = algorithms.PEFT(simulation) #scheduler = algorithms.SimHEFT(simulation) scheduler.run() for t in simulation.tasks.sorted(lambda t: t.start_time): print(t.name, t.start_time, t.finish_time, t.hosts[0].name) print(scheduler.scheduler_time, scheduler.total_time) print( "EXEC", sum([(t.finish_time - t.start_time) for t in simulation.tasks])) print( "COMM", sum([(t.finish_time - t.start_time) for t in simulation.connections])) return # example: how to run multiple simulations in a single script (circumventing SimGrid limitation of 'non-restartable' simulator state) for scheduler in _SCHEDULERS.keys(): p = multiprocessing.Process(target=run_simulation, args=(scheduler, )) p.start() p.join()
def run_plain_simulation(args): scheduler_name, env, task = args scheduler_class = _SCHEDULERS[scheduler_name] with simdag.Simulation(env, task) as simulation: scheduler = scheduler_class(simulation) scheduler.run() return simulation.clock, scheduler_name
def run_simulation(scheduler): scheduler_class = _SCHEDULERS[scheduler] with simdag.Simulation("test/data/pl_4hosts_master.xml", "dag/tasks_exp2/testg0.6.dot") as simulation: print("Scheduler:", scheduler, scheduler_class) scheduler = scheduler_class(simulation) scheduler.run() print("Scheduler time:", scheduler.scheduler_time)
def slave_scheduling(context: Context, connection: Connection): with ProximalSimulationSlave(connection) as proxy_slave, simdag.Simulation( context.env_file, context.task_file) as simulation: with proxy_slave.scheduling_scope(): scheduler = SlaveScheduler(simulation, proxy_slave, context.feature) scheduler.run() if context.slave_callback: proxy_slave.send(context.slave_callback(simulation)) connection.close()
def run_simulation(args): scheduler_name, env, task = args scheduler_class = _SCHEDULERS[scheduler_name] with simdag.Simulation(env, task) as simulation: print(f'Start {scheduler_name} simulation') scheduler = scheduler_class(simulation) scheduler.run() print(f"""{scheduler_name} makespan: {simulation.clock} scheduling time: {scheduler.scheduler_time} """) return simulation.clock, scheduler_name
def run_simulation(system, workload, scheduler): with simdag.Simulation(system, workload) as simulation: logging.info("Scheduler: %s" % (scheduler)) # schedule root and end tasks on master host master_host = simulation.hosts.by_prop('name', 'master')[0] root_task = simulation.tasks.by_prop('name', 'root')[0] logging.debug("%s -> %s" % (root_task.name, master_host.name)) root_task.schedule(master_host) end_task = simulation.tasks.by_prop('name', 'end')[0] logging.debug("%s -> %s" % (end_task.name, master_host.name)) end_task.schedule(master_host) sched_class = globals()[scheduler] sched_class(simulation).run() return simulation.clock
def main(): # single run in current process mode, used for profiling if False: #with simdag.Simulation("test/data/pl_4hosts.xml", "test/data/basic_graph.dot") as simulation: with simdag.Simulation("test/data/pl_4hosts_master.xml", "test/data/basic_graph.dot") as simulation: #with simdag.Simulation("test/data/pl_4hosts.xml", "dag/tasks_exp2/testg0.6.dot") as simulation: #with simdag.Simulation("dag/plat_exp1/cluster_20_1-4_100_100_0.xml", "dag/tasks_exp2/testg0.6.dot") as simulation: #graph = simulation.get_task_graph() #scheduler = heft.HEFTScheduler(simulation) scheduler = algorithms.BatchSufferage(simulation) #scheduler = peft.PEFTScheduler(simulation) scheduler.run() print(scheduler.scheduler_time, scheduler.total_time) return # example: how to run multiple simulations in a single script (circumventing SimGrid limitation of 'non-restartable' simulator state) for scheduler in _SCHEDULERS.keys(): p = multiprocessing.Process(target=run_simulation, args=(scheduler, )) p.start() p.join()
from pysimgrid import simdag import pysimgrid.simdag.algorithms as algorithms import logging import pysimgrid.tools as tools _LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" _LOG_FORMAT = "[%(name)s] [%(levelname)5s] [%(asctime)s] %(message)s" logging.basicConfig(level=logging.DEBUG, format=_LOG_FORMAT, datefmt=_LOG_DATE_FORMAT) with simdag.Simulation("test/data/pl_4hosts.xml", "test/data/basic_graph.dot") as simulation: scheduler = algorithms.CLDD(simulation) scheduler.run() graph = simulation.get_task_graph() #print(simulation.clock, scheduler.scheduler_time, scheduler.total_time) for t in simulation.tasks.sorted(lambda t: t.start_time): print(t.name, t.start_time, t.finish_time, t.hosts[0].name) print "TOTAL EXECUTION TIME :", sum([(t.finish_time - t.start_time) for t in simulation.tasks]) print"TOTAL COMMUNICATION TIME :", sum([(t.finish_time - t.start_time) for t in simulation.connections])