33 # ifndef POLYBENCH_PADDING_FACTOR 35 # define POLYBENCH_PADDING_FACTOR 0 39 # ifndef POLYBENCH_INTER_ARRAY_PADDING_FACTOR 41 # define POLYBENCH_INTER_ARRAY_PADDING_FACTOR 0 42 # undef POLYBENCH_ENABLE_INTARRAY_PAD 44 # define POLYBENCH_ENABLE_INTARRAY_PAD 49 # ifdef POLYBENCH_USE_C99_PROTO 50 # define POLYBENCH_C99_SELECT(x,y) y 53 # define POLYBENCH_C99_SELECT(x,y) x 58 # ifdef POLYBENCH_USE_SCALAR_LB 59 # define POLYBENCH_LOOP_BOUND(x,y) x 62 # define POLYBENCH_LOOP_BOUND(x,y) y 69 # ifdef POLYBENCH_USE_RESTRICT 70 # define POLYBENCH_RESTRICT restrict 73 # define POLYBENCH_RESTRICT 83 # ifndef POLYBENCH_STACK_ARRAYS 84 # define POLYBENCH_ARRAY(x) *x 85 # ifdef POLYBENCH_ENABLE_INTARRAY_PAD 86 # define POLYBENCH_FREE_ARRAY(x) polybench_free_data((void*)x); 88 # define POLYBENCH_FREE_ARRAY(x) free((void*)x); 90 # define POLYBENCH_DECL_VAR(x) (*x) 92 # define POLYBENCH_ARRAY(x) x 93 # define POLYBENCH_FREE_ARRAY(x) 94 # define POLYBENCH_DECL_VAR(x) x 97 # define POLYBENCH_1D(var, dim1,ddim1) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR] 98 # define POLYBENCH_2D(var, dim1, dim2, ddim1, ddim2) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR] 99 # define POLYBENCH_3D(var, dim1, dim2, dim3, ddim1, ddim2, ddim3) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR] 100 # define POLYBENCH_4D(var, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR] 101 # define POLYBENCH_5D(var, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) var[POLYBENCH_RESTRICT POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim5,ddim5) + POLYBENCH_PADDING_FACTOR] 103 # define POLYBENCH_1D_F(var, dim1,ddim1) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR] 104 # define POLYBENCH_2D_F(var, dim1, dim2, ddim1, ddim2) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR] 105 # define POLYBENCH_3D_F(var, dim1, dim2, dim3, ddim1, ddim2, ddim3) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR] 106 # define POLYBENCH_4D_F(var, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR] 107 # define POLYBENCH_5D_F(var, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) var[POLYBENCH_C99_SELECT(dim1,ddim1) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim2,ddim2) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim3,ddim3) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim4,ddim4) + POLYBENCH_PADDING_FACTOR][POLYBENCH_C99_SELECT(dim5,ddim5) + POLYBENCH_PADDING_FACTOR] 115 # define POLYBENCH_ALLOC_1D_ARRAY(n1, type) \ 116 (type(*)[n1 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data (n1 + POLYBENCH_PADDING_FACTOR, sizeof(type)) 117 # define POLYBENCH_ALLOC_2D_ARRAY(n1, n2, type) \ 118 (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR), sizeof(type)) 119 # define POLYBENCH_ALLOC_3D_ARRAY(n1, n2, n3, type) \ 120 (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR), sizeof(type)) 121 # define POLYBENCH_ALLOC_4D_ARRAY(n1, n2, n3, n4, type) \ 122 (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR), sizeof(type)) 123 # define POLYBENCH_ALLOC_5D_ARRAY(n1, n2, n3, n4, n5, type) \ 124 (type(*)[n1 + POLYBENCH_PADDING_FACTOR][n2 + POLYBENCH_PADDING_FACTOR][n3 + POLYBENCH_PADDING_FACTOR][n4 + POLYBENCH_PADDING_FACTOR][n5 + POLYBENCH_PADDING_FACTOR])polybench_alloc_data ((n1 + POLYBENCH_PADDING_FACTOR) * (n2 + POLYBENCH_PADDING_FACTOR) * (n3 + POLYBENCH_PADDING_FACTOR) * (n4 + POLYBENCH_PADDING_FACTOR) * (n5 + POLYBENCH_PADDING_FACTOR), sizeof(type)) 127 # ifndef POLYBENCH_STACK_ARRAYS 128 # define POLYBENCH_1D_ARRAY_DECL(var, type, dim1, ddim1) \ 129 type POLYBENCH_1D_F(POLYBENCH_DECL_VAR(var), dim1, ddim1); \ 130 var = POLYBENCH_ALLOC_1D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), type); 131 # define POLYBENCH_2D_ARRAY_DECL(var, type, dim1, dim2, ddim1, ddim2) \ 132 type POLYBENCH_2D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, ddim1, ddim2); \ 133 var = POLYBENCH_ALLOC_2D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), type); 134 # define POLYBENCH_3D_ARRAY_DECL(var, type, dim1, dim2, dim3, ddim1, ddim2, ddim3) \ 135 type POLYBENCH_3D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, ddim1, ddim2, ddim3); \ 136 var = POLYBENCH_ALLOC_3D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), type); 137 # define POLYBENCH_4D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) \ 138 type POLYBENCH_4D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4); \ 139 var = POLYBENCH_ALLOC_4D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), POLYBENCH_C99_SELECT(dim4, ddim4), type); 140 # define POLYBENCH_5D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) \ 141 type POLYBENCH_5D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5); \ 142 var = POLYBENCH_ALLOC_5D_ARRAY(POLYBENCH_C99_SELECT(dim1, ddim1), POLYBENCH_C99_SELECT(dim2, ddim2), POLYBENCH_C99_SELECT(dim3, ddim3), POLYBENCH_C99_SELECT(dim4, ddim4), POLYBENCH_C99_SELECT(dim5, ddim5), type); 144 # define POLYBENCH_1D_ARRAY_DECL(var, type, dim1, ddim1) \ 145 type POLYBENCH_1D_F(POLYBENCH_DECL_VAR(var), dim1, ddim1); 146 # define POLYBENCH_2D_ARRAY_DECL(var, type, dim1, dim2, ddim1, ddim2) \ 147 type POLYBENCH_2D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, ddim1, ddim2); 148 # define POLYBENCH_3D_ARRAY_DECL(var, type, dim1, dim2, dim3, ddim1, ddim2, ddim3) \ 149 type POLYBENCH_3D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, ddim1, ddim2, ddim3); 150 # define POLYBENCH_4D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4) \ 151 type POLYBENCH_4D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, ddim1, ddim2, ddim3, ddim4); 152 # define POLYBENCH_5D_ARRAY_DECL(var, type, dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5) \ 153 type POLYBENCH_5D_F(POLYBENCH_DECL_VAR(var), dim1, dim2, dim3, dim4, dim5, ddim1, ddim2, ddim3, ddim4, ddim5); 158 # ifndef POLYBENCH_DUMP_ARRAYS 159 # define POLYBENCH_DCE_ONLY_CODE if (argc > 42 && ! strcmp(argv[0], "")) 161 # define POLYBENCH_DCE_ONLY_CODE 164 #define POLYBENCH_DUMP_TARGET stderr 165 #define POLYBENCH_DUMP_START fprintf(POLYBENCH_DUMP_TARGET, "==BEGIN DUMP_ARRAYS==\n") 166 #define POLYBENCH_DUMP_FINISH fprintf(POLYBENCH_DUMP_TARGET, "==END DUMP_ARRAYS==\n") 167 #define POLYBENCH_DUMP_BEGIN(s) fprintf(POLYBENCH_DUMP_TARGET, "begin dump: %s", s) 168 #define POLYBENCH_DUMP_END(s) fprintf(POLYBENCH_DUMP_TARGET, "\nend dump: %s\n", s) 170 # define polybench_prevent_dce(func) \ 171 POLYBENCH_DCE_ONLY_CODE \ 176 # define polybench_start_instruments 177 # define polybench_stop_instruments 178 # define polybench_print_instruments 182 # ifdef POLYBENCH_PAPI 183 extern const unsigned int polybench_papi_eventlist[];
184 # undef polybench_start_instruments 185 # undef polybench_stop_instruments 186 # undef polybench_print_instruments 187 # define polybench_set_papi_thread_report(x) \ 188 polybench_papi_counters_threadid = x; 189 # define polybench_start_instruments \ 190 polybench_prepare_instruments(); \ 191 polybench_papi_init(); \ 193 for (evid = 0; polybench_papi_eventlist[evid] != 0; evid++) \ 195 if (polybench_papi_start_counter(evid)) \ 198 # define polybench_stop_instruments \ 199 polybench_papi_stop_counter(evid); \ 201 polybench_papi_close(); \ 203 # define polybench_print_instruments polybench_papi_print(); 208 # if defined(POLYBENCH_TIME) || defined(POLYBENCH_GFLOPS) 209 # undef polybench_start_instruments 210 # undef polybench_stop_instruments 211 # undef polybench_print_instruments 212 # define polybench_start_instruments polybench_timer_start(); 213 # define polybench_stop_instruments polybench_timer_stop(); 214 # define polybench_print_instruments polybench_timer_print(); 222 # ifdef POLYBENCH_PAPI 223 extern int polybench_papi_start_counter(
int evid);
224 extern void polybench_papi_stop_counter(
int evid);
225 extern void polybench_papi_init();
226 extern void polybench_papi_close();
227 extern void polybench_papi_print();
void polybench_timer_print()
void polybench_prepare_instruments()
void * polybench_alloc_data(unsigned long long int n, int elt_size)
void polybench_free_data(void *ptr)
void polybench_flush_cache()
void polybench_timer_start()
double polybench_program_total_flops
void polybench_timer_stop()