 		// launch knn() kernel on GPU
 		computeDist<<<grid, n, n*sizeof(int)>>>(m, n, d_V, D);
 		cudaDeviceSynchronize();
-		knn<<<m, m, m*sizeof(int)>>>(m, n, k, d_V, D, d_out);
+		knn<<<m, m, m*sizeof(int)>>>(m, n, k, d_V, D, d_out, R);
 		// record event and synchronize
 		cudaEventRecord(stop);
 		cudaEventSynchronize(stop);

#include<cuda.h>
#include<stdlib.h>

#define INIT_MAX 100
void showResult(int m, int k, int *out);

extern __shared__ int SM[];

	int *V, *out;				//host copies
	int *d_V, *d_out;			//device copies
	int *D;						
	int *R;						
//	int *dim_D;					//be replaced with shared memory
	FILE *fp;
	if(argc != 2)
