Is it the case that the variable axes_hits
defined inside the prange
will be independent for each loop even though they are running in parallel? I.e. is axes_hits
branched into many independent variables such that changing axes_hits
in a loop will not change its value in another loop that is running in parallel? I think I am not finding any clear reference to this in the docs.
I suppose this related to the “privatization” technique of shared-memory programming. (Thanks for the concept’s name, @gmarkall )
@njit(parallel = True)
def get_axis_filter(line_indexes, column_indexes):
n_solutions = line_indexes.shape[0]
filter_ = np.full(solutions.shape[0], True)
for i in prange(line_indexes.shape[0]):
axes_hits = [0]*10 #HARDCODED
for j in range(line_indexes.shape[1]):
l_i = line_indexes[i,j]
c_i = line_indexes[i,j]
if l_i==c_i:
axes_hits[l_i] += 1
else:
axes_hits[l_i] += 1
axes_hits[c_i] += 1
if max(axes_hits) > 5:
filter_[i] = False
return filter_