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

CUDA mutexes for complicated reductions #1177

Closed
ianthomas23 opened this issue Feb 7, 2023 · 0 comments · Fixed by #1196
Closed

CUDA mutexes for complicated reductions #1177

ianthomas23 opened this issue Feb 7, 2023 · 0 comments · Fixed by #1196

Comments

@ianthomas23
Copy link
Member

Currently datashader only has CUDA support for relatively simple Reduction classes. This is primarily due to the parallel nature of CUDA hardware which means we have to support multiple GPU threads writing to the same element (pixel) of an aggregation, so we only support reductions which have a corresponding CUDA atomic operation such as numba.cuda.atomic.max. For more complicated reductions such as the planned max_n reduction we will need to implement some form of mutex ourselves, to limit one thread at a time accessing the relevant shared data. The CUDA name for this is "atomicCAS" or "atomic compare and swap".

This will need some experimentation. The initial implementation could try to limit access to a single element (pixel) of one aggregation to a single thread at a time. Benchmarking will be important here to identify a workable and efficient solution.

Useful reference: https://towardsdatascience.com/cuda-by-numba-examples-c583474124b0

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

Successfully merging a pull request may close this issue.

1 participant