parallelized knn with arbitrary T (less than shared_mem_max)