 			//index
 			SMem[indexBase+j] = j+num;
 			__syncthreads();
-/*
-			if(tid < count)
-			{
-				if(out[i*k+tid]-num>0 && out[i*k+tid]-num < indexBase)
-				{
-					SMem[ out[i*k+tid]-num ] = INIT_MAX;
-				}
-			}
-			__syncthreads();
-*/
-		}
-//		__syncthreads();
-/*
-//		for(int j=0; j<count; j++)
-		//coalesce
-		for(int j=tid; j<count; j+=blockDim.x)
-		{
-			if(out[i*k+j]-num>=0 && out[i*k+j]-num<indexBase)
-			{
-				SMem[ out[i*k+j]-num ] = INIT_MAX;
-			}
-			__syncthreads();
-		}
-		__syncthreads();
-*/
+		}
 		if(tid < count)
 		{
 			if(out[i*k+tid]-num>=0 && out[i*k+tid]-num<indexBase)

	{
		for(px=tx; px<TILE_WIDTH; px+=blockDim.x)
		{
		
			row = by*TILE_WIDTH+py;
			col = bx*TILE_WIDTH+px;
			dist[py][px] = 0;


extern __shared__ int SMem[];

//find the min value and index in the count^th loop
__device__ int findMin(int m, int k, int count, int *D, int *out)
{
	int i = blockIdx.x;
