1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
# Copyright (c) 2018-2025. The SimGrid Team. All rights reserved.
#
# This program is free software you can redistribute it and/or modify it
# under the terms of the license (GNU LGPL) which comes with this package.
import sys
from simgrid import Actor, Engine, Host, this_actor
class Wizard:
def __call__(self):
fafard = Host.by_name("Fafard")
ginette = Host.by_name("Ginette")
boivin = Host.by_name("Boivin")
this_actor.info("I'm a wizard! I can run a task on the Ginette host from the Fafard one! Look!")
activity = this_actor.exec_init(48.492e6)
activity.host = ginette
activity.start()
this_actor.info("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).")
this_actor.sleep_for(0.1)
this_actor.info("Loads in flops/s: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(boivin.load,
fafard.load,
ginette.load))
activity.wait()
this_actor.info("Done!")
this_actor.info("And now, harder. Start a remote task on Ginette and move it to Boivin after 0.5 sec")
activity = this_actor.exec_init(73293500)
activity.host = ginette
activity.start()
this_actor.sleep_for(0.5)
this_actor.info(
"Loads before the move: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(
boivin.load,
fafard.load,
ginette.load))
activity.host = boivin
this_actor.sleep_for(0.1)
this_actor.info(
"Loads after the move: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(
boivin.load,
fafard.load,
ginette.load))
activity.wait()
this_actor.info("Done!")
if __name__ == '__main__':
e = Engine(sys.argv)
e.load_platform(sys.argv[1])
e.host_by_name("Fafard").add_actor("test", Wizard())
e.run()
|