예제 #1
0
    def __call__(self):
        computation_amount = this_actor.get_host().speed
        this_actor.info("Execute {:.0f} flops, should take 1 second.".format(computation_amount))
        activity = this_actor.exec_init(computation_amount)
        activity.start()
        activity.wait()

        this_actor.info("Goodbye now!")
예제 #2
0
    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!")
예제 #3
0
    def __call__(self):
        computation_amount = this_actor.get_host().speed
        this_actor.info("Execute {:.0f} flops, should take 1 second.".format(computation_amount))
        activity = this_actor.exec_init(computation_amount).start()

        this_actor.sleep_for(0.5)
        this_actor.info("I changed my mind, cancel!")
        activity.cancel()

        this_actor.info("Goodbye now!")
예제 #4
0
    def __call__(self):
        computation_amount = this_actor.get_host().speed
        this_actor.info("Execute {:.0f} flops, should take 1 second.".format(computation_amount))
        activity = this_actor.exec_init(computation_amount).start()

        while not activity.test():
            this_actor.info("Remaining amount of flops: {:.0f} ({:.0f}%)".format(
                activity.remaining, 100 * activity.remaining_ratio))
            this_actor.sleep_for(0.3)
        activity.wait()

        this_actor.info("Goodbye now!")
예제 #5
0
def runner():
    computation_amount = this_actor.get_host().speed
    n_task = 10

    this_actor.info(
        "Execute %d tasks of %g flops, should take %d second in a CPU without degradation. It will take the double here."
        % (n_task, computation_amount, n_task))
    tasks = [
        this_actor.exec_init(computation_amount).start() for _ in range(n_task)
    ]

    this_actor.info("Waiting for all tasks to be done!")
    for task in tasks:
        task.wait()

    this_actor.info("Finished executing. Goodbye now!")