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

Add section on Grid Groups and Grid sync #1

Open
gmarkall opened this issue Apr 21, 2021 · 0 comments
Open

Add section on Grid Groups and Grid sync #1

gmarkall opened this issue Apr 21, 2021 · 0 comments

Comments

@gmarkall
Copy link
Member

Grid groups and grid sync were added in Numba 0.53.1. A short section on using these to implement a global barrier would be good, perhaps based around the example kernel from the documentation:

@cuda.jit(void(int32[:,::1]))
def sequential_rows(M):
    col = cuda.grid(1)
    g = cuda.cg.this_grid()

    rows = M.shape[0]
    cols = M.shape[1]

    for row in range(1, rows):
        opposite = cols - col - 1
        # Each row's elements are one greater than the previous row
        M[row, col] = M[row - 1, opposite] + 1
        # Wait until all threads have written their column element,
        # and that the write is visible to all other threads
        g.sync()
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