Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local message optimization breaks correctness #215

Open
adityapb opened this issue Oct 26, 2021 · 0 comments
Open

Local message optimization breaks correctness #215

adityapb opened this issue Oct 26, 2021 · 0 comments
Assignees

Comments

@adityapb
Copy link
Contributor

The local message optimization stores a reference to entry method arguments in the destination chare's local msg buffer if the source and destination chares lie on the same PE to avoid copying and serialization. This is an issue because if the sender chare then modifies the data being sent, the receiving chare will now be holding a reference to the modified data.

from time import time
import numpy as np
mainProxy = None

class TestCopy(Chare):
    def __init__(self):
        x = np.array([0, 0])
        mainProxy.send(x)
        x[1] = 10

class Main(Chare):
    def __init__(self, args):
        charm.thisProxy.updateGlobals({'mainProxy': self.thisProxy},
                                      '__main__', awaitable=True).get()
        Chare(TestCopy)

    def send(self, x):
        print(x)
        charm.exit()

charm.start(Main)

For example, the above code prints out [0, 10]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant