You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
from numba import prange as parallel_range
from numba import jit
@jit(nopython=True, parallel=True)
def func():
vector = np.zeros(2)
for i in parallel_range(2):
for j in range(2):
vector[j] += 1
vector[i] += 1
return vector
ret = func()
print(ret)
This very simple example gives [4., 3.]... Where does that additional 1 go?
The text was updated successfully, but these errors were encountered:
Alright I see it's because of the race condition — multiple threads trying to write to the same slice or element in an array. Linking to an existing issue #3681
This very simple example gives [4., 3.]... Where does that additional 1 go?
The text was updated successfully, but these errors were encountered: