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

Calculation result becomes strange at the time of asynchronous execution with memcpyPeerAsync() #14

Open
5enxia opened this issue Mar 2, 2022 · 0 comments

Comments

@5enxia
Copy link
Owner

5enxia commented Mar 2, 2022

def dot(cls, local_A, x, out):
        # Copy vector data to All devices
        for i in range(cls.begin, cls.end+1):
            index = i-cls.begin
            cp.cuda.runtime.memcpyPeerAsync(cls.x[index].data.ptr, i, x.data.ptr, cls.end, cls.nbytes, cls.streams[index].ptr)
        # dot
        for i in range(cls.begin, cls.end+1):
            index = i-cls.begin
            Device(i).use()
            cls.streams[index].synchronize()
            cls.y[index] = cls.A[index].dot(cls.x[index])
        # Gather caculated element from All devices
        for i in range(cls.begin, cls.end+1):
            Device(i).synchronize()
            index = i-cls.begin
            cp.cuda.runtime.memcpyPeerAsync(cls.out[index*cls.local_local_N].data.ptr, cls.end, cls.y[index].data.ptr, i, cls.local_local_nbytes, cls.streams[index].ptr)
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