if len(args) < 2: raise AssertionError("Actor forwarder requires 2 parameters, but got only {:d}".format(len(args)))
mb_in = simgrid.Mailbox.by_name(args[0])
mb_out = simgrid.Mailbox.by_name(args[1])
-
+
msg = mb_in.get()
simgrid.info("Forward '{:s}'.".format(msg))
mb_out.put(msg, len(msg))
# For that, you first need to register your function or your actor as follows.
e.register_actor("sender", Sender)
e.register_actor("forwarder", forwarder)
- # Once actors and functions are registered, just load the deployment file
+ # Once actors and functions are registered, just load the deployment file
e.load_deployment("actor-create_d.xml")
# Once every actors are started in the engine, the simulation can start
e.run();
- # Once the simulation is done, the program is ended
+ # Once the simulation is done, the program is ended
-# Copyright (c) 2017-2018. The SimGrid Team. All rights reserved.
+# Copyright (c) 2017-2018. 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.
#
# It can also be used to benchmark our context-switching mechanism.
-# Main function of the Yielder process
+# Main function of the Yielder process
class Yielder:
number_of_yields = 0
def __init__(self, *args):
if __name__ == '__main__':
e = simgrid.Engine(sys.argv)
-
- e.load_platform(sys.argv[1]) # Load the platform description
+
+ e.load_platform(sys.argv[1]) # Load the platform description
e.register_actor("yielder", Yielder) # Register the class representing the actors
e.load_deployment(sys.argv[2])
- e.run() # - Run the simulation
+ e.run() # - Run the simulation
import simgrid as sg
def executor():
- # execute() tells SimGrid to pause the calling actor until
+ # execute() tells SimGrid to pause the calling actor until
# its host has computed the amount of flops passed as a parameter
sg.execute(98095)
sg.info("Done.")
# Since the priority is 2, it computes twice as fast as a regular one.
#
# So instead of a half/half sharing between the two executions,
- # we get a 1/3 vs 2/3 sharing.
+ # we get a 1/3 vs 2/3 sharing.
sg.execute(98095, 2);
sg.info("Done.");