Dask Solution
dask.array, , map_blocks,
ar = ...
x = da.from_array(ar, chunks=(1, arr.shape[1]))
x.map_blocks(function, *args)
states = x.compute()
,
from dask.multiprocessing import get
states = x.compute(get=get)
dask, , , , threadpool
from multiprocessing.pool import ThreadPool
pool = ThreadPool()
ar = ...
states = np.empty_like(array)
def f(i):
states[i] = function(ar[i], *args)
pool.map(f, range(len(ar)))
from multiprocessing import Pool
pool = Pool()