示例#1
0
void compareResults(DATA_TYPE a[NR][NQ][NP], DATA_TYPE b[NR][NQ][NP], DATA_TYPE c[NR][NQ][NP], DATA_TYPE d[NR][NQ][NP])
{
	int i, j, k, fail;
	fail = 0;
	
	// Compare a and b
	for (i=0; i<NR; i++) 
	{
		for (j=0; j<NQ; j++) 
		{
			for(k=0; k<NP; k++)
			{
				if (percentDiff(a[i][j][k], b[i][j][k]) > PERCENT_DIFF_ERROR_THRESHOLD)
				{
					fail++;
				}
				if (percentDiff(c[i][j][k], d[i][j][k]) > PERCENT_DIFF_ERROR_THRESHOLD)
				{
					fail++;
				}
			}
		}
	}
	
	// Print results
	printf("Number of misses: %d\n", fail);
}
示例#2
0
void compareResults(DATA_TYPE* s, DATA_TYPE* s_outputFromGpu, DATA_TYPE* q, DATA_TYPE* q_outputFromGpu)
{
	int i,fail;
	fail = 0;

	// Compare s with s_cuda
	for (i=0; i<NX; i++)
	{
		if (percentDiff(q[i], q_outputFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
		{
			fail++;
		}
	}

	for (i=0; i<NY; i++)
	{
		if (percentDiff(s[i], s_outputFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
		{
			fail++;
		}		
	}
	
	// print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#3
0
void compareResults(DATA_TYPE* x1, DATA_TYPE* x1_outputFromGpu, DATA_TYPE* x2, DATA_TYPE* x2_outputFromGpu)
{
    int i, fail;
    fail = 0;

#ifndef ALOCACAO_NORMAL
    cl_float* x1_output = (cl_float*)clEnqueueMapBuffer(clCommandQue, x1_mem_obj, CL_TRUE, CL_MAP_READ, 0, sizeof(DATA_TYPE) * N, 0, NULL, NULL, &errcode);
    cl_float* x2_output = (cl_float*)clEnqueueMapBuffer(clCommandQue, x2_mem_obj, CL_TRUE, CL_MAP_READ, 0, sizeof(DATA_TYPE) * N, 0, NULL, NULL, &errcode);
#else
    DATA_TYPE *x1_output = x1_outputFromGpu;
    DATA_TYPE *x2_output = x2_outputFromGpu;
#endif

    for (i=0; i<N; i++) 
    {
        if (percentDiff(x1[i], x1_output[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
        {
            fail++;
        }

        if (percentDiff(x2[i], x2_output[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
        {
            fail++;
        }
    }

    // Print results
    printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#4
0
void compareResults(DATA_TYPE a[N][N], DATA_TYPE b[N][N], DATA_TYPE c[N][N], DATA_TYPE d[N][N])
{
	int i, j, fail;
	fail = 0;   

       // Compare a and c
       for (i=0; i<N; i++) 
	{
		for (j=0; j<N; j++)
		{
			if (percentDiff(a[i][j], c[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD)
			{
                    		fail++;
			}
              }
       }

	// Compare b and d
	for (i=0; i<N; i++) 
	{
		for (j=0; j<N; j++)
		{
			if (percentDiff(d[i][j], b[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD)
                     {
				fail++;
			}
		}
	}

	// Print results
	printf("Number of misses: %d\n", fail);
}
void compareResults(int n, DATA_TYPE POLYBENCH_1D(a,N,n), DATA_TYPE POLYBENCH_1D(a_outFromGpu,N,n), DATA_TYPE POLYBENCH_1D(b,N,n), 
	DATA_TYPE POLYBENCH_1D(b_outFromGpu,N,n))
{
	int i, j, fail_a, fail_b;
	fail_a = 0;   
        fail_b = 0;

	for (i=1; i<(n-1); i++) 
        //for (i=1; i<3; i++) 
	{
		if (percentDiff(a[i], a_outFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD) 
		{
			fail_a++;
                        //printf("i = %d\n", i);
		}
	}

	for (i=1; i<(n-1); i++) 
	{
		if (percentDiff(b[i], b_outFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD) 
		{
			fail_b++;
		}
	}

	// Print results
	printf("Non-Matching CPU-GPU Outputs of A Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail_a);
	//printf("Non-Matching CPU-GPU Outputs of B Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail_b);
}
示例#6
0
void compareResults()
{
    int i,j,fail;
    fail = 0;

#ifndef ALOCACAO_NORMAL
    cl_float* E_output = (cl_float*)clEnqueueMapBuffer(clCommandQue, e_mem_obj, CL_TRUE, CL_MAP_READ, 0, sizeof(DATA_TYPE) * NI * NL, 0, NULL, NULL, &errcode);

#else
    DATA_TYPE *E_output = E_outputFromGpu;
#endif

    for (i=0; i < NL; i++)
    {
        for (j=0; j < NI; j++)
        {
            if (percentDiff(E[i*NI + j], E_output[i*NI + j]) > PERCENT_DIFF_ERROR_THRESHOLD)
            {
                fail++;
            }
        }
    }

    // print results
    printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#7
0
void compareResults(DATA_TYPE x1[N], DATA_TYPE x1_outputFromGpu[N], DATA_TYPE x2[N], DATA_TYPE x2_outputFromGpu[N])
{
	int i, fail;
	fail = 0;
	
	for (i=0; i<N; i++) 
	{
		if (percentDiff(x1[i], x1_outputFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
		{
			fail++;
		}

		if (percentDiff(x2[i], x2_outputFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
		{
			fail++;
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#8
0
void compareResults(int ny, DATA_TYPE POLYBENCH_1D(z,NY,ny), DATA_TYPE POLYBENCH_1D(z_outputFromGpu,NY,ny))
{
	int i, fail;
	fail = 0;

	for (i=0; i<ny; i++)
	{
		if (percentDiff(z[i], z_outputFromGpu[i]) > PERCENT_DIFF_ERROR_THRESHOLD)
		{
			fail++;
		}		
	}
	
	// print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);
}
示例#9
0
void compareResults(DATA_TYPE w1[N], DATA_TYPE w2[N])
{
	int i, fail;
	fail = 0;
	
	for (i=0; i < N; i++) 
	{
		if (percentDiff(w1[i], w2[i]) > PERCENT_DIFF_ERROR_THRESHOLD) 
		{
			fail++;
		}
	}
		
	// Print results
	printf("Number of misses: %d\n", fail);
}
示例#10
0
void compareResults() {
  int i,j,fail;
  fail = 0;

  // Compare C with D
  for (i=0; i<N; i++) {
    for (j=0; j<M; j++)	{
      if (percentDiff(C[i][j], D[i][j]) > ERROR_THRESHOLD) {
	fail++;
      }
    }
  }
	
  // print results
  printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", ERROR_THRESHOLD, fail);
}
示例#11
0
void compareResults(DATA_TYPE symmat[M+1][N+1], DATA_TYPE symmat_outputFromGpu[M+1][N+1])
{
	int i,j,fail;
	fail = 0;

	for (i=1; i < (M+1); i++)
	{
		for (j=1; j < (N+1); j++)
		{
			if (percentDiff(symmat[i][j], symmat_outputFromGpu[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD)
			{
				fail++;
			}			
		}
	}
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#12
0
void compareResults(DATA_TYPE* C, DATA_TYPE* C_GPU)
{
  int i, fail;
  fail = 0;
	
  // Compare C and C_GPU
  for (i=0; i < N; i++) 
    {
      if(C[i] != C_GPU[i]) printf("DIFF @ %d![%f, %f]\n", i, C[i], C_GPU[i]);
      if (percentDiff(C[i], C_GPU[i]) > ERROR_THRESHOLD) 
	{
	  fail++;
	}
    }
	
  // Print results
  printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", ERROR_THRESHOLD, fail);
	
}
示例#13
0
void compareResults(int ni, int nl, DATA_TYPE POLYBENCH_2D(D, NI, NL, ni, nl), DATA_TYPE POLYBENCH_2D(D_outputFromGpu, NI, NL, ni, nl))
{
	int i,j,fail;
	fail = 0;

	for (i=0; i < ni; i++)
	{
		for (j=0; j < nl; j++)
		{
			if (percentDiff(D[i][j], D_outputFromGpu[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD)
			{
				fail++;
			}
		}
	}
	
	// print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);
}
示例#14
0
void compareResults(DATA_TYPE *G, DATA_TYPE *G_outputFromGpu)
{
  int i,j,fail;
  fail = 0;

  for (i=0; i < NI; i++)
    {
      for (j=0; j < NL; j++)
	{
	  if (percentDiff(G[i*NL + j], G_outputFromGpu[i*NL + j]) > PERCENT_DIFF_ERROR_THRESHOLD)
	    {
	      fail++;				
	    }
	}
    }
	
  // print results
  printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);
}
示例#15
0
void compareResults(DATA_TYPE* A, DATA_TYPE* A_outputFromGpu)
{
	int i, j, fail;
	fail = 0;

	for (i=0; i < M; i++) 
	{
		for (j=0; j < N; j++) 
		{
			if (percentDiff(A[i*N + j], A_outputFromGpu[i*N + j]) > PERCENT_DIFF_ERROR_THRESHOLD) 
			{				
				fail++;
				printf("i: %d j: %d \n1: %f\n 2: %f\n", i, j, A[i*N + j], A_outputFromGpu[i*N + j]);
			}
		}
	}

  assert(fail == 0 && "CPU - GPU Computation does not match!");
}
示例#16
0
void compareResults(int nx, int ny, DATA_TYPE POLYBENCH_2D(hz1,NX,NY,nx,ny), DATA_TYPE POLYBENCH_2D(hz2,NX,NY,nx,ny))
{
	int i, j, fail;
	fail = 0;
	
	for (i=0; i < nx; i++) 
	{
		for (j=0; j < ny; j++) 
		{
			if (percentDiff(hz1[i][j], hz2[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD) 
			{
				fail++;
			}
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);
}
示例#17
0
void compareResults(DATA_TYPE* hz1, DATA_TYPE* hz2)
{
	int i, j, fail;
	fail = 0;
	
	for (i=0; i < NX; i++) 
	{
		for (j=0; j < NY; j++) 
		{
			if (percentDiff(hz1[i*NY + j], hz2[i*NY + j]) > PERCENT_DIFF_ERROR_THRESHOLD) 
			{
				fail++;
			}
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#18
0
void compareResults(DATA_TYPE A[M][N], DATA_TYPE A_outputFromGpu[M][N])
{
	int i, j, fail;
	fail = 0;

	for (i=0; i < M; i++) 
	{
		for (j=0; j < N; j++) 
		{
			if (percentDiff(A[i][j], A_outputFromGpu[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD) 
			{				
				fail++;
			}
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#19
0
void compareResults(DATA_TYPE C[NI][NJ], DATA_TYPE C_outputFromGpu[NI][NJ])
{
	int i, j, fail;
	fail = 0;
	
	// Compare C1 and C2
	for (i=0; i < NI; i++) 
	{
		for (j=0; j < NJ; j++) 
		{
			if (percentDiff(C[i][j], C_outputFromGpu[i][j]) > PERCENT_DIFF_ERROR_THRESHOLD) 
			{
				fail++;
			}
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#20
0
void compareResults(DATA_TYPE* symmat, DATA_TYPE* symmat_outputFromGpu)
{
	int i,j,fail;
	fail = 0;

	for (i=0; i<=M; i++)
	{
		for (j=0; j<=N; j++)
		{
			if (percentDiff(symmat[i*(N+1) + j], symmat_outputFromGpu[i*(N+1) + j]) > PERCENT_DIFF_ERROR_THRESHOLD)
			{
				fail++;
				printf("I: %d J: %d \n 1: %f\n 2: %f\n", i, j, symmat[i*(N+1) + j], symmat_outputFromGpu[i*(N+1) + j]);		
			}
		}
	}
	
	// print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#21
0
void compareResults(DATA_TYPE* sum1, DATA_TYPE* sum2){

	int fail = 0;

	int r, q, p;
	
	for (r = 0; r < NR; r++)
	{
    		for (q = 0; q < NQ; q++)  
		{
      			for (p = 0; p < NP; p++)  
			{
				if (percentDiff(sum1[r * (NQ * NP) + q * NP + p], sum2[r * (NQ * NP) + q * NP + p]) > PERCENT_DIFF_ERROR_THRESHOLD)
				{
					fail++;
				}
			}
		}
	}
	
	// Print results
	printf("Number of misses: %d\n", fail);
}
示例#22
0
void compareResults(int ni, int nj, int nk, DATA_TYPE POLYBENCH_3D(B, NI, NJ, NK, ni, nj, nk), DATA_TYPE POLYBENCH_3D(B_outputFromGpu, NI, NJ, NK, ni, nj, nk))
{
	int i, j, k, fail;
	fail = 0;
	
	// Compare result from cpu and gpu
	for (i = 1; i < ni - 1; ++i) // 0
	{
		for (j = 1; j < nj - 1; ++j) // 1
		{
			for (k = 1; k < nk - 1; ++k) // 2
			{
				if (percentDiff(B[i][j][k], B_outputFromGpu[i][j][k]) > PERCENT_DIFF_ERROR_THRESHOLD)
				{
					fail++;
				}
			}	
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);
}
示例#23
0
void compareResults(DATA_TYPE B[NI][NJ][NK], DATA_TYPE B_outputFromGpu[NI][NJ][NK])
{
	int i, j, k, fail;
	fail = 0;
	
	// Compare result from cpu and gpu...
	for (i = 1; i < NI - 1; ++i) // 0
	{
		for (j = 1; j < NJ - 1; ++j) // 1
		{
			for (k = 1; k < NK - 1; ++k) // 2
			{
				if (percentDiff(B[i][j][k], B_outputFromGpu[i][j][k]) > PERCENT_DIFF_ERROR_THRESHOLD)
				{
					fail++;
				}
			}	
		}
	}
	
	// Print results
	printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}
示例#24
0
void compareResults(DATA_TYPE* symmat, DATA_TYPE* symmat_outputFromGpu)
{
    int i,j,fail;
    fail = 0;

#ifndef ALOCACAO_NORMAL
    cl_float* symmat_output = (cl_float*)clEnqueueMapBuffer(clCommandQue, symmat_mem_obj, CL_TRUE, CL_MAP_READ, 0, sizeof(DATA_TYPE) * (M+1) * (N+1), 0, NULL, NULL, &errcode);
#else
    DATA_TYPE *symmat_output = symmat_outputFromGpu;
#endif

    for (i=0; i<=M; i++)
    {
        for (j=0; j<=N; j++)
        {
            if (percentDiff(symmat[i*(N+1) + j], symmat_output[i*(N+1) + j]) > PERCENT_DIFF_ERROR_THRESHOLD)
            {
                fail++;
            }			
        }
    }
    printf("Non-Matching CPU-GPU Outputs Beyond Error Threshold of %4.2f Percent: %d\n", PERCENT_DIFF_ERROR_THRESHOLD, fail);

}