int main(int argc, char** argv) { /* Retrieve problem size. */ N = atoi(argv[1]); int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(p, DATA_TYPE, N, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(p), POLYBENCH_ARRAY(A)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_cholesky (n, POLYBENCH_ARRAY(p), POLYBENCH_ARRAY(A)); /* 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(p); return 0; }
int main(int argc, char** argv) { /* Prepare ctuning vars */ long ct_repeat=0; long ct_repeat_max=1; int ct_return=0; /* Retrieve problem size. */ int n = N; #ifdef OPENME openme_init(NULL,NULL,NULL,0); openme_callback("PROGRAM_START", NULL); #endif /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(p, DATA_TYPE, N, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(p), POLYBENCH_ARRAY(A)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ if (getenv("CT_REPEAT_MAIN")!=NULL) ct_repeat_max=atol(getenv("CT_REPEAT_MAIN")); #ifdef OPENME openme_callback("KERNEL_START", NULL); #endif for (ct_repeat=0; ct_repeat<ct_repeat_max; ct_repeat++) kernel_cholesky (n, POLYBENCH_ARRAY(p), POLYBENCH_ARRAY(A)); #ifdef OPENME openme_callback("KERNEL_END", NULL); #endif /* 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(p); #ifdef OPENME openme_callback("PROGRAM_END", NULL); #endif return 0; }
int main(int argc, char **argv) { int n = N; double(*A)[N][N]; A = (double(*)[N][N])polybench_alloc_data((N) * (N), sizeof(double)); init_array(n, *A); polybench_timer_start(); kernel_cholesky(n, *A); polybench_timer_stop(); polybench_timer_print(); if (argc > 42 && !strcmp(argv[0], "")) print_array(n, *A); free((void *)A); return 0; }