Parallel in-place sort for numpy arrays

后端 未结 2 1172
感动是毒
感动是毒 2021-02-14 08:19

I often need to sort large numpy arrays (few billion elements), which became a bottleneck of my code. I am looking for a way to parallelize it.

Are there any parallel i

2条回答
  •  一整个雨季
    2021-02-14 09:00

    Mergesort parallelizes quite naturally. Just have each worker pre-sort an arbitrary chunk, and then run a single merge pass on it. The final merging should require only O(N) operations, and its trivial to write a function for doing so in numba or somesuch.

    Wikipedia agrees

提交回复
热议问题