rapidsai / cucim

cuCIM - RAPIDS GPU-accelerated image processing library
https://docs.rapids.ai/api/cucim/stable/
Apache License 2.0
359 stars 61 forks source link

investigate switching KDTree usage from SciPy to CuPy #732

Open grlee77 opened 7 months ago

grlee77 commented 7 months ago

CuPy's main branch now has a KDTree implementation (cupyx.scipy.spatial.KDTree). It is not released for CuPy 13.x, but we should investigate whether it provides benefit over falling back to the host side implementation from SciPy.

Functions currently replying on SciPy for use of KDTree are:

Other functions that use it in scikit-image, but for which CuPy has an alternative CUDA kernel is the _prune_blobs helper function used by

we can check if that kernel or the CuPy KDTree implementation is preferable.

If CuPy KDTree performance is good we can add implementation for the following scikit-image functions that primarily rely on it

cb11711211 commented 6 months ago

Hi, I am current investigate to replace scipy cKDTree with cupy KDTree, and could I provide which version of cupy provide the function?

monzelr commented 4 months ago

in my first implementation for the blob algorithms I have used scipy's cKDTree - because it was a CPU solution it was a bottleneck. I will give cupy's KDtree a try to see the performance

@cb11711211 it is not in the official release, but you find it already in the repository you have to build cupy by yourself to test it