I have code which looks something like this
import numpy as np
A = np.zeros((10000, 10))
for i in range(10000):
# Some time-consuming calculations which result in a 10 element 1D array 'a'
A[i, :] = a
How can I parallelize the for loop, so that the array A is filled out in parallel? My understanding is that multiple processes normally shouldn't be writing to the same variable, so it's not clear to me what the proper way of doing this is.
A = np.array([some_calculation(i) for i in range(len(A))]).numba, they have good tools for parallelized writing to a single array.