Example #1
0
int main(int argc, char** argv)
{
  /* Retrieve problem size. */
  int n = N;
  int tsteps = TSTEPS;

  /* Variable declaration/allocation. */
  POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n);
  POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, N, N, n, n);


  /* Initialize array(s). */
  init_array (n, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B));

  /* Start timer. */
  polybench_start_instruments;

  /* Run kernel. */
  kernel_jacobi_2d(tsteps, n, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B));

  /* Stop and print timer. */
  polybench_stop_instruments;
  polybench_print_instruments;

  /* Prevent dead-code elimination. All live-out data must be printed
     by the function call in argument. */
  polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(A)));

  /* Be clean. */
  POLYBENCH_FREE_ARRAY(A);
  POLYBENCH_FREE_ARRAY(B);

  return 0;
}
int main(int argc, char** argv) {
  int n = N;
  int tsteps = TSTEPS;
  double(*A)[N][N];
  A = (double(*)[N][N])polybench_alloc_data((N) * (N), sizeof(double));
  double(*B)[N][N];
  B = (double(*)[N][N])polybench_alloc_data((N) * (N), sizeof(double));
  init_array(n, *A, *B);
  polybench_timer_start();
  kernel_jacobi_2d(tsteps, n, *A, *B);
  polybench_timer_stop();
  polybench_timer_print();
  if (argc > 42 && !strcmp(argv[0], "")) print_array(n, *A);
  free((void*)A);
  free((void*)B);
  return 0;
}
Example #3
0
int main(int argc, char** argv)
{
	/* Retrieve problem size. */
	int n = N;
	int tsteps = TSTEPS;

	/* Variable declaration/allocation. */
	PENCILBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n);
	PENCILBENCH_2D_ARRAY_DECL(B, DATA_TYPE, N, N, n, n);

	printf("\n Problem Size : \n N = %d, TSTEPS = %d"
			,n,tsteps);
	fflush(stdout);

	/* Initialize array(s). */
	init_array (n, A, B);

	printf("\n Kernel Start");
	fflush(stdout);

	/* Start timer. */
	pencilbench_timer_start();

	/* Run kernel. */
	kernel_jacobi_2d(tsteps, n, A, B);

	/* Stop and print timer. */
	pencilbench_timer_stop();
	printf("\n kernel end");
	printf("\n Execution time :");
	fflush(stdout);
	pencilbench_timer_print();
	printf("\n\n");

	/* Prevent dead-code elimination. All live-out data must be printed
	   by the function call in argument. */
	pencilbench_prevent_dce(print_array(n, A));

	/* Be clean. */
	PENCILBENCH_FREE_ARRAY(A);
	PENCILBENCH_FREE_ARRAY(B);

	return 0;
}