int main(int argc, char** argv) { /* Retrieve problem size. */ int w = W; int h = H; /* Variable declaration/allocation. */ DATA_TYPE alpha; POLYBENCH_2D_ARRAY_DECL(imgIn, DATA_TYPE, W, H, w, h); POLYBENCH_2D_ARRAY_DECL(imgOut, DATA_TYPE, W, H, w, h); POLYBENCH_2D_ARRAY_DECL(y1, DATA_TYPE, W, H, w, h); POLYBENCH_2D_ARRAY_DECL(y2, DATA_TYPE, W, H, w, h); /* Initialize array(s). */ init_array (w, h, &alpha, POLYBENCH_ARRAY(imgIn), POLYBENCH_ARRAY(imgOut)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_deriche (w, h, alpha, POLYBENCH_ARRAY(imgIn), POLYBENCH_ARRAY(imgOut), POLYBENCH_ARRAY(y1), POLYBENCH_ARRAY(y2)); /* 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(w, h, POLYBENCH_ARRAY(imgOut))); /* Be clean. */ POLYBENCH_FREE_ARRAY(imgIn); POLYBENCH_FREE_ARRAY(imgOut); POLYBENCH_FREE_ARRAY(y1); POLYBENCH_FREE_ARRAY(y2); return 0; }
int main(int argc, char** argv) { int w = W; int h = H; float alpha; float(*imgIn)[W][H]; imgIn = (float(*)[W][H])polybench_alloc_data((W) * (H), sizeof(float)); float(*imgOut)[W][H]; imgOut = (float(*)[W][H])polybench_alloc_data((W) * (H), sizeof(float)); float(*y1)[W][H]; y1 = (float(*)[W][H])polybench_alloc_data((W) * (H), sizeof(float)); float(*y2)[W][H]; y2 = (float(*)[W][H])polybench_alloc_data((W) * (H), sizeof(float)); init_array(w, h, &alpha, *imgIn, *imgOut); polybench_timer_start(); kernel_deriche(w, h, alpha, *imgIn, *imgOut, *y1, *y2); polybench_timer_stop(); polybench_timer_print(); if (argc > 42 && !strcmp(argv[0], "")) print_array(w, h, *imgOut); free((void*)imgIn); free((void*)imgOut); free((void*)y1); free((void*)y2); return 0; }