CUDA implementation of the k-NN algorithm