Numba 0.56 does not support `atomic.add` on arrays of complexs anymore
See original GitHub issueReporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
The following code snippet uses an atomic.add
on an array of complex numbers.
It runs without any issues with numba 0.55.2
, but fails with numba 0.56
from numba import cuda
import numpy as np
@cuda.jit
def atomic_add_one(values):
"""
Adds 1 to each element values, with an atomic add
Parameters:
-----------
values: 1darray of `complex128`
"""
tid = cuda.threadIdx.x
bid = cuda.blockIdx.x
bdim = cuda.blockDim.x
i = (bid * bdim) + tid
cuda.atomic.add(values.real, i, 1)
arr = np.random.rand(16384) + 1.j*np.random.rand(16384)
print(arr.dtype)
atomic_add_one[256,64](arr)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Release Notes — Numba 0.56.4+0.g288a38bbd.dirty-py3.7 ...
PR #8310: CUDA: Fix Issue #8309 - atomics don't work on complex components (Graham ... Support for atomic xor , increment, decrement, exchange,...
Read more >Supported Atomic Operations — Numba 0.50.1 documentation
Numba provides access to some of the atomic operations supported in CUDA. ... Multiple dimension arrays are supported by using a tuple of...
Read more >Numba atomic.add issues - python - Stack Overflow
I am trying to make my first steps with numba. I have written a simple script that calculates the sum of all elements...
Read more >Support Atomic Add on complex128 arrays in CUDA ... - GitHub
Currently NUMBA supports int32, float32, and float64 operands only for atomic add. It would be nice to have it for complex128 too, ...
Read more >CUDA by Numba Examples: Atomics and Mutexes
The atomic add in Numba takes three parameters: the array which will be ... Some of these are not currently supported by Numba...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One potential fix is now ready for consideration in #8310. Whether this is the right fix and the general path forward is a complex decision, so I’ve added it to the agenda for next week’s dev meeting along with the considerations I can see as of now: https://hackmd.io/P1y0q3BcStKfIZky7CLHHg?view
Thanks for the reproducer - I can reproduce this issue, and I’m looking into it.