int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(C,DATA_TYPE,N,N,n,n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(C)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_template (n, POLYBENCH_ARRAY(C)); /* 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(C))); /* Be clean. */ POLYBENCH_FREE_ARRAY(C); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ #ifdef POLYBENCH_HEAP_ARRAYS /* Heap arrays use variable 'n' for the size. */ DATA_TYPE POLYBENCH_2D_ARRAY_DECL(C, n, n); C = POLYBENCH_ALLOC_2D_ARRAY(n, n, DATA_TYPE); #else /* Stack arrays use the numerical value 'N' for the size. */ DATA_TYPE POLYBENCH_2D_ARRAY_DECL(C,N,N); #endif /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(C)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_template (n, POLYBENCH_ARRAY(C)); /* 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(C))); /* Be clean. */ POLYBENCH_FREE_ARRAY(C); return 0; }