charm4py icon indicating copy to clipboard operation
charm4py copied to clipboard

WIP: Add 'expedited' decorator for urgent messages

Open ZwFink opened this issue 3 years ago • 2 comments

This patch adds the @expedited decorator to enable urgent inter-PE messages to skip the message queue. This patch also lays the groundwork for adding additional entry method options such as priorities.

Example of usage:

from charm4py import charm, Chare, Array, expedited


class Test(Chare):
    """
    A chare array to test the element proxy.
    """

    def __init__(self):
        self.count = 0

    @expedited
    def say(self, msg):
        """
        Helper method which is called by invoking the element proxy.
        This method is expected to be called on only the chare for
        which the proxy is created.
        """

        self.count += 1
        print("Say", msg, "called on", self.thisIndex, "on PE", charm.myPe())
        if self.count == 2:
            assert self.thisIndex == (3,)
            exit()

    def start(self):
        proxy = self.thisProxy[3]
        proxy.say("bye")
        proxy.say("bye")


def main(args):
    arr_proxy = Array(Test, 6)
    arr_proxy[0].start()


charm.start(main)

ZwFink avatar Aug 07 '21 22:08 ZwFink

This pull request introduces 1 alert when merging d813e1d70ca9572aa0a6b1d8662b20ce09a9fc6c into 0b9a2bed73fa55f15af3511fe5e3fc2cffed29dc - view on LGTM.com

new alerts:

  • 1 for Unused local variable

lgtm-com[bot] avatar Sep 30 '21 18:09 lgtm-com[bot]

This pull request introduces 1 alert when merging eae84977d56c8a6edf6a43c35491f2596b14a430 into 0b9a2bed73fa55f15af3511fe5e3fc2cffed29dc - view on LGTM.com

new alerts:

  • 1 for Unused local variable

lgtm-com[bot] avatar Sep 30 '21 18:09 lgtm-com[bot]