pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
346 stars 94 forks source link

Nearest Neighbor in OpenCL #174

Open djhoese opened 5 years ago

djhoese commented 5 years ago

I'd like to start this discussion because I might research this topic when I get bored. I am not an OpenCL or CUDA expert (or even novice) so I'm putting my findings here as I go.

quasiben commented 2 years ago

Hi @djhoese -- I came here via your recent thread on dask improvements for pyresample and started poking around. cuML has a GPU enabled KNeighborsClassifier . Happy to help run some experiments if you're still interested in this topic. Sadly, CUDA only

djhoese commented 2 years ago

That'd be great @quasiben! As an optional performance improvement, CUDA-only would still be fine. What would the code look like if we had dask arrays for X, Y, Z euclidean coordinates and a single 2D image array to be resampled? Are there optimizations available if we wanted to run the nearest neighbor again but with different image data (same coordinates)? Right now pyresample uses the pykdtree package. Also note that the X, Y, Z coordinates are converted from lon/lat arrays so if those could be given to the classifier directly that would save even more time.

quasiben commented 2 years ago

Looking deeper here I think cuML is lacking some functionality . While there are NearestNeighbor Classifiers, there is no KDTree implementation at the moment (though, there is an issue https://github.com/rapidsai/cuml/issues/1690 ) . cuSpatial does had a quad-tree -- I'll ask around and see if there are any plans here. Apologies for the noise.

djhoese commented 2 years ago

No problem. Glad you could at least link to some other efforts in similar areas.

grlee77 commented 2 years ago

Here is another CUDA kd-tree implementation I came across (BSD 3-clause license) https://github.com/johnarobinson77/KdTreeGPU