 			}
 		}
 	}
+//	showResult(m, k, out);
 }
 
-int main(int argc, char *argv[])
+//__host__ __device__ void showResult(int m, int k, int *out)
+void showResult(int m, int k, int *out)
 {
+	int i,j;
+	for(i=0; i<m; i++)
+	{
+		for(j=0; j<k; j++)
+		{
+				printf("%d", out[i*k+j]);
+				if(j == k-1)
+				{
+						printf("\n");
+				}
+				else
+				{
+						printf(" ");
+				}
+		}
+	} 
+} 
+int main(int argc, char *argv[]) 
+{ 
 	int m,n,k;
+//	int *d_m, *d_n, *d_k;
 	int i,j;
-	int *V;
-	int *out;
+	int *V, *out;					//host copies
+	int *d_V, *d_out;			//device copies
 	FILE *fp;
 	if(argc != 2)
 	{

	{
		printf("m:%d, n:%d, k:%d\n", m, n, k);

		V = (int *) malloc(m*n*sizeof(int));
		out = (int *) malloc(m*k*sizeof(int));
		for(i=0; i<m*n; i++)
		{
			fscanf(fp, "%d", &V[i]);
		}
		knn(m, n, k, V, out);
		for(i=0; i<m; i++)
		{
				for(j=0; j<k; j++)

* out: k nearest neighbors
*/

__global__ void knn(int m, int n, int k, int *V, int *out)
{
	int i,j;
	int dim;
