sub_sizes[num_threads - 1] += size % num_threads
pos[1:] = np.cumsum(sub_sizes)[:num_threads - 1]
for thread in prange(num_threads, nogil=True, chunksize=1, num_threads=
    num_threads, schedule='static'):
    pass
Python, use multiprocessing to further speed up a cython function