int main(int argc, char** argv) { /* Retrieve problem size. */ int ni = NI; int nj = NJ; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, NI, NJ, ni, nj); POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, NI, NJ, ni, nj); /* Initialize array(s). */ init_array (ni, nj, POLYBENCH_ARRAY(A)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_conv2d (ni, nj, 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(ni, nj, POLYBENCH_ARRAY(B))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); return 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_imper (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) { #pragma hmpp gemm acquire /* Retrieve problem size. */ int ni = NI; int nj = NJ; int nk = NK; /* Variable declaration/allocation. */ DATA_TYPE alpha; DATA_TYPE beta; POLYBENCH_2D_ARRAY_DECL(C,DATA_TYPE,NI,NJ,ni,nj); POLYBENCH_2D_ARRAY_DECL(A,DATA_TYPE,NI,NK,ni,nk); POLYBENCH_2D_ARRAY_DECL(B,DATA_TYPE,NK,NJ,nk,nj); #pragma hmpp gemm allocate, & #pragma hmpp & args[C].size={ni,nj}, args[C].hostdata="C", & #pragma hmpp & args[A].size={ni,nk}, args[A].hostdata="A", & #pragma hmpp & args[B].size={nk,nj}, args[B].hostdata="B" /* Initialize array(s). */ init_array (ni, nj, nk, &alpha, &beta, POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B)); #pragma hmpp gemm advancedload, args[C;A;B] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp gemm callsite kernel_gemm (ni, nj, nk, alpha, beta, POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp gemm delegatedstore, args[C] /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(ni, nj, POLYBENCH_ARRAY(C))); /* Be clean. */ POLYBENCH_FREE_ARRAY(C); POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); #pragma hmpp gemm release return 0; }
int main(int argc, char *argv[]) { /* Retrieve problem size. */ int ni = NI; int nj = NJ; /* Variable declaration/allocation. */ DATA_TYPE alpha; DATA_TYPE beta; POLYBENCH_2D_ARRAY_DECL(A,DATA_TYPE,NI,NJ,ni,nj); POLYBENCH_2D_ARRAY_DECL(B,DATA_TYPE,NI,NJ,ni,nj); POLYBENCH_2D_ARRAY_DECL(C,DATA_TYPE,NI,NI,ni,ni); POLYBENCH_2D_ARRAY_DECL(C_outputFromGpu,DATA_TYPE,NI,NI,ni,ni); init_arrays(ni, nj, &alpha, &beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C)); read_cl_file(); cl_initialization(); cl_mem_init(POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C)); cl_load_prog(); cl_launch_kernel(ni, nj, alpha, beta); errcode = clEnqueueReadBuffer(clCommandQue, c_mem_obj, CL_TRUE, 0, NI*NJ*sizeof(DATA_TYPE), POLYBENCH_ARRAY(C_outputFromGpu), 0, NULL, NULL); if(errcode != CL_SUCCESS) printf("Error in reading GPU mem\n"); #ifdef RUN_ON_CPU /* Start timer. */ polybench_start_instruments; syr2kCpu(ni, nj, alpha, beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C)); /* Stop and print timer. */ printf("CPU Time in seconds:\n"); polybench_stop_instruments; polybench_print_instruments; compareResults(ni, POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(C_outputFromGpu)); #else //prevent dead code elimination polybench_prevent_dce(print_array(ni, POLYBENCH_ARRAY(C_outputFromGpu))); #endif //RUN_ON_CPU cl_clean_up(); POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); POLYBENCH_FREE_ARRAY(C); POLYBENCH_FREE_ARRAY(C_outputFromGpu); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int q = Q; int d = D; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(M, DATA_TYPE, Q, D, q, d); POLYBENCH_2D_ARRAY_DECL(MatchQ, DATA_TYPE, Q, D, q, d); POLYBENCH_1D_ARRAY_DECL(QS, DATA_TYPE, Q, q); POLYBENCH_1D_ARRAY_DECL(DB, DATA_TYPE, D, d); /* Initialize array(s). */ init_array (q, d, POLYBENCH_ARRAY(QS), POLYBENCH_ARRAY(DB), POLYBENCH_ARRAY(MatchQ)); /* Start timer. */ polybench_start_instruments; /* DATA_TYPE POLYBENCH_1D(QS,Q,q), DATA_TYPE POLYBENCH_1D(DB,D,d), DATA_TYPE POLYBENCH_2D(MatchQ,Q,D,q,d), DATA_TYPE POLYBENCH_2D(M,Q,D,q,d)) */ /* Run kernel. */ kernel_mvt (q, d, POLYBENCH_ARRAY(QS), POLYBENCH_ARRAY(DB), POLYBENCH_ARRAY(MatchQ), POLYBENCH_ARRAY(M)); /* 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(q, d, POLYBENCH_ARRAY(QS), POLYBENCH_ARRAY(DB), POLYBENCH_ARRAY(MatchQ))); /* Be clean. */ POLYBENCH_FREE_ARRAY(M); POLYBENCH_FREE_ARRAY(QS); POLYBENCH_FREE_ARRAY(DB); POLYBENCH_FREE_ARRAY(MatchQ); return 0; }
int main(int argc, char *argv[]) { int tmax = TMAX; int nx = NX; int ny = NY; POLYBENCH_1D_ARRAY_DECL(_fict_,DATA_TYPE,TMAX,TMAX); POLYBENCH_2D_ARRAY_DECL(ex,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(ey,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(hz,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(hz_outputFromGpu,DATA_TYPE,NX,NY,nx,ny); init_arrays(tmax, nx, ny, POLYBENCH_ARRAY(_fict_), POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz)); read_cl_file(); cl_initialization(); cl_mem_init(POLYBENCH_ARRAY(_fict_), POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz)); cl_load_prog(); cl_launch_kernel(tmax, nx, ny); errcode = clEnqueueReadBuffer(clCommandQue, hz_mem_obj, CL_TRUE, 0, NX * NY * sizeof(DATA_TYPE), POLYBENCH_ARRAY(hz_outputFromGpu), 0, NULL, NULL); if(errcode != CL_SUCCESS) printf("Error in reading GPU mem\n"); #ifdef RUN_ON_CPU /* Start timer. */ polybench_start_instruments; runFdtd(tmax, nx, ny, POLYBENCH_ARRAY(_fict_), POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz)); /* Stop and print timer. */ printf("CPU Time in seconds:\n"); polybench_stop_instruments; polybench_print_instruments; compareResults(nx, ny, POLYBENCH_ARRAY(hz), POLYBENCH_ARRAY(hz_outputFromGpu)); #else //prevent dead code elimination polybench_prevent_dce(print_array(nx, ny, POLYBENCH_ARRAY(hz_outputFromGpu))); #endif //RUN_ON_CPU POLYBENCH_FREE_ARRAY(_fict_); POLYBENCH_FREE_ARRAY(ex); POLYBENCH_FREE_ARRAY(ey); POLYBENCH_FREE_ARRAY(hz); POLYBENCH_FREE_ARRAY(hz_outputFromGpu); cl_clean_up(); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int ni = NI; int nj = NJ; int nk = NK; int nl = NL; /* Variable declaration/allocation. */ DATA_TYPE alpha; DATA_TYPE beta; POLYBENCH_2D_ARRAY_DECL(tmp,DATA_TYPE,NI,NJ,ni,nj); POLYBENCH_2D_ARRAY_DECL(A,DATA_TYPE,NI,NK,ni,nk); POLYBENCH_2D_ARRAY_DECL(B,DATA_TYPE,NK,NJ,nk,nj); POLYBENCH_2D_ARRAY_DECL(C,DATA_TYPE,NL,NJ,nl,nj); POLYBENCH_2D_ARRAY_DECL(D,DATA_TYPE,NI,NL,ni,nl); /* Initialize array(s). */ init_array (ni, nj, nk, nl, &alpha, &beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(D)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_2mm (ni, nj, nk, nl, alpha, beta, POLYBENCH_ARRAY(tmp), POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(D)); /* 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(ni, nl, POLYBENCH_ARRAY(D))); /* Be clean. */ POLYBENCH_FREE_ARRAY(tmp); POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); POLYBENCH_FREE_ARRAY(C); POLYBENCH_FREE_ARRAY(D); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(y, DATA_TYPE, N, N, n, n); POLYBENCH_2D_ARRAY_DECL(sum, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(alpha, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(beta, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(r, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(out, DATA_TYPE, N, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(sum), POLYBENCH_ARRAY(alpha), POLYBENCH_ARRAY(beta), POLYBENCH_ARRAY(r)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_durbin (n, POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(sum), POLYBENCH_ARRAY(alpha), POLYBENCH_ARRAY(beta), POLYBENCH_ARRAY(r), POLYBENCH_ARRAY(out)); /* 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(out))); /* Be clean. */ POLYBENCH_FREE_ARRAY(y); POLYBENCH_FREE_ARRAY(sum); POLYBENCH_FREE_ARRAY(alpha); POLYBENCH_FREE_ARRAY(beta); POLYBENCH_FREE_ARRAY(r); POLYBENCH_FREE_ARRAY(out); return 0; }
int main(int argc, char** argv) { fid = fopen("memory.txt", "w+t"); /* Retrieve problem size. */ int tmax = TMAX; int nx = NX; int ny = NY; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(ex,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(ey,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(hz,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_1D_ARRAY_DECL(_fict_,DATA_TYPE,TMAX,tmax); /* Initialize array(s). */ init_array (tmax, nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz), POLYBENCH_ARRAY(_fict_)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_fdtd_2d (tmax, nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz), POLYBENCH_ARRAY(_fict_)); /* 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. */ print_array(nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz)); /* Be clean. */ POLYBENCH_FREE_ARRAY(ex); POLYBENCH_FREE_ARRAY(ey); POLYBENCH_FREE_ARRAY(hz); POLYBENCH_FREE_ARRAY(_fict_); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ DATA_TYPE alpha; DATA_TYPE beta; POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n); POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(tmp, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(x, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(y, DATA_TYPE, N, n); /* Initialize array(s). */ init_array (n, &alpha, &beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(x)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_gesummv (n, alpha, beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(tmp), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(y)); /* 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(y))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); POLYBENCH_FREE_ARRAY(tmp); POLYBENCH_FREE_ARRAY(x); POLYBENCH_FREE_ARRAY(y); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int niter = NITER; int maxgrid = MAXGRID; int length = LENGTH; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(sum_tang, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_2D_ARRAY_DECL(mean, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_3D_ARRAY_DECL(diff, DATA_TYPE, MAXGRID, MAXGRID, LENGTH, maxgrid, maxgrid, length); POLYBENCH_3D_ARRAY_DECL(sum_diff, DATA_TYPE, MAXGRID, MAXGRID, LENGTH, maxgrid, maxgrid, length); /* Initialize array(s). */ init_array (maxgrid, POLYBENCH_ARRAY(sum_tang), POLYBENCH_ARRAY(mean), POLYBENCH_ARRAY(path)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_reg_detect (niter, maxgrid, length, POLYBENCH_ARRAY(sum_tang), POLYBENCH_ARRAY(mean), POLYBENCH_ARRAY(path), POLYBENCH_ARRAY(diff), POLYBENCH_ARRAY(sum_diff)); /* 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(maxgrid, POLYBENCH_ARRAY(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(sum_tang); POLYBENCH_FREE_ARRAY(mean); POLYBENCH_FREE_ARRAY(path); POLYBENCH_FREE_ARRAY(diff); POLYBENCH_FREE_ARRAY(sum_diff); return 0; }
int main(int argc, char** argv) { if (argc < 2) { printf("Parametros: [nThreads]\n"); exit(1); } omp_set_num_threads(atoi(argv[1])); /* Retrieve problem size. */ int n = N; int m = M; /* Variable declaration/allocation. */ DATA_TYPE float_n; POLYBENCH_2D_ARRAY_DECL(data,DATA_TYPE,M,N,m,n); POLYBENCH_2D_ARRAY_DECL(symmat,DATA_TYPE,M,M,m,m); POLYBENCH_1D_ARRAY_DECL(mean,DATA_TYPE,M,m); POLYBENCH_1D_ARRAY_DECL(stddev,DATA_TYPE,M,m); /* Initialize array(s). */ init_array (m, n, &float_n, POLYBENCH_ARRAY(data)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_correlation (m, n, float_n, POLYBENCH_ARRAY(data), POLYBENCH_ARRAY(symmat), POLYBENCH_ARRAY(mean), POLYBENCH_ARRAY(stddev)); /* 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(m, POLYBENCH_ARRAY(symmat))); /* Be clean. */ POLYBENCH_FREE_ARRAY(data); POLYBENCH_FREE_ARRAY(symmat); POLYBENCH_FREE_ARRAY(mean); POLYBENCH_FREE_ARRAY(stddev); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, N, N, n, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(path)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_floyd_warshall (n, POLYBENCH_ARRAY(path)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #ifdef __PRINT print_array(n,POLYBENCH_ARRAY(path)); #endif /* 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(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(path); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(L, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(x, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(b, DATA_TYPE, N, n); /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(L), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(b)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_trisolv (n, POLYBENCH_ARRAY(L), POLYBENCH_ARRAY(x), 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(x))); /* Be clean. */ POLYBENCH_FREE_ARRAY(L); POLYBENCH_FREE_ARRAY(x); POLYBENCH_FREE_ARRAY(b); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int ni = NI; int nj = NJ; int nk = NK; int nl = NL; int nm = NM; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(E, DATA_TYPE, NI, NJ, ni, nj); POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, NI, NK, ni, nk); POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, NK, NJ, nk, nj); POLYBENCH_2D_ARRAY_DECL(F, DATA_TYPE, NJ, NL, nj, nl); POLYBENCH_2D_ARRAY_DECL(C, DATA_TYPE, NJ, NM, nj, nm); POLYBENCH_2D_ARRAY_DECL(D, DATA_TYPE, NM, NL, nm, nl); POLYBENCH_2D_ARRAY_DECL(G, DATA_TYPE, NI, NL, ni, nl); /* Initialize array(s). */ init_array (ni, nj, nk, nl, nm, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(D)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_3mm (ni, nj, nk, nl, nm, POLYBENCH_ARRAY(E), POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(F), POLYBENCH_ARRAY(C), POLYBENCH_ARRAY(D), POLYBENCH_ARRAY(G)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #ifdef __PRINT print_array(ni,nl,POLYBENCH_ARRAY(G)); #endif /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(ni, nl, POLYBENCH_ARRAY(G))); /* Be clean. */ POLYBENCH_FREE_ARRAY(E); POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); POLYBENCH_FREE_ARRAY(F); POLYBENCH_FREE_ARRAY(C); POLYBENCH_FREE_ARRAY(D); POLYBENCH_FREE_ARRAY(G); 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) { #pragma hmpp atax acquire /* Retrieve problem size. */ int nx = NX; int ny = NY; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, NX, NY, nx, ny); POLYBENCH_1D_ARRAY_DECL(x, DATA_TYPE, NY, ny); POLYBENCH_1D_ARRAY_DECL(y, DATA_TYPE, NY, ny); POLYBENCH_1D_ARRAY_DECL(tmp, DATA_TYPE, NX, nx); #pragma hmpp atax allocate, & #pragma hmpp & args[A].size={nx,ny}, args[A].hostdata="A", & #pragma hmpp & args[x].size={ny}, args[x].hostdata="x", & #pragma hmpp & args[y].size={ny}, args[y].hostdata="y", & #pragma hmpp & args[tmp].size={nx}, args[tmp].hostdata="tmp" /* Initialize array(s). */ init_array (nx, ny, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(x)); #pragma hmpp atax advancedload, args[A;x] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp atax callsite kernel_atax (nx, ny, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(tmp)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp atax delegatedstore, args[y] /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(nx, POLYBENCH_ARRAY(y))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(x); POLYBENCH_FREE_ARRAY(y); POLYBENCH_FREE_ARRAY(tmp); #pragma hmpp atax release return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ LENGTH = atoi(argv[1]); TSTEPS = atoi(argv[2]); int length = LENGTH; int tsteps = TSTEPS; /* Variable declaration/allocation. */ DATA_TYPE out; POLYBENCH_3D_ARRAY_DECL(sum_c,DATA_TYPE,LENGTH,LENGTH,LENGTH,length,length,length); POLYBENCH_2D_ARRAY_DECL(c,DATA_TYPE,LENGTH,LENGTH,length,length); POLYBENCH_2D_ARRAY_DECL(W,DATA_TYPE,LENGTH,LENGTH,length,length); /* Initialize array(s). */ init_array (length, POLYBENCH_ARRAY(c), POLYBENCH_ARRAY(W)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_dynprog (tsteps, length, POLYBENCH_ARRAY(c), POLYBENCH_ARRAY(W), POLYBENCH_ARRAY(sum_c), &out); /* 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(out)); /* Be clean. */ POLYBENCH_FREE_ARRAY(sum_c); POLYBENCH_FREE_ARRAY(c); POLYBENCH_FREE_ARRAY(W); return 0; }
int main(int argc, char** argv) { fid = fopen("memory.txt", "w+t"); /* Retrieve problem size. */ int n = N; int m = M; /* Variable declaration/allocation. */ DATA_TYPE float_n; POLYBENCH_2D_ARRAY_DECL(data,DATA_TYPE,M,N,m,n); POLYBENCH_2D_ARRAY_DECL(symmat,DATA_TYPE,M,M,m,m); POLYBENCH_1D_ARRAY_DECL(mean,DATA_TYPE,M,m); /* Initialize array(s). */ init_array (m, n, &float_n, POLYBENCH_ARRAY(data)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_covariance (m, n, float_n, POLYBENCH_ARRAY(data), POLYBENCH_ARRAY(symmat), POLYBENCH_ARRAY(mean)); /* 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(m, POLYBENCH_ARRAY(symmat))); /* Be clean. */ POLYBENCH_FREE_ARRAY(data); POLYBENCH_FREE_ARRAY(symmat); POLYBENCH_FREE_ARRAY(mean); return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int m = M; int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A,DATA_TYPE,M,N,m,n); POLYBENCH_2D_ARRAY_DECL(R,DATA_TYPE,N,N,n,n); POLYBENCH_2D_ARRAY_DECL(Q,DATA_TYPE,M,N,m,n); /* Initialize array(s). */ init_array (m, n, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(R), POLYBENCH_ARRAY(Q)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_gramschmidt (m, n, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(R), POLYBENCH_ARRAY(Q)); /* 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(m, n, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(R), POLYBENCH_ARRAY(Q))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(R); POLYBENCH_FREE_ARRAY(Q); return 0; }
int main(void) { int nx = NX; int ny = NY; POLYBENCH_2D_ARRAY_DECL(A,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_1D_ARRAY_DECL(x,DATA_TYPE,NY,ny); POLYBENCH_1D_ARRAY_DECL(y,DATA_TYPE,NY,ny); POLYBENCH_1D_ARRAY_DECL(y_outputFromGpu,DATA_TYPE,NY,ny); POLYBENCH_1D_ARRAY_DECL(tmp,DATA_TYPE,NX,nx); init_array(nx, ny, POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(A)); read_cl_file(); cl_initialization(); cl_mem_init(POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(tmp)); cl_load_prog(); cl_launch_kernel(nx, ny); errcode = clEnqueueReadBuffer(clCommandQue, y_mem_obj, CL_TRUE, 0, NY*sizeof(DATA_TYPE), POLYBENCH_ARRAY(y_outputFromGpu), 0, NULL, NULL); if(errcode != CL_SUCCESS) printf("Error in reading GPU mem\n"); #ifdef RUN_ON_CPU /* Start timer. */ polybench_start_instruments; atax_cpu(nx, ny, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(tmp)); /* Stop and print timer. */ printf("CPU Time in seconds:\n"); polybench_stop_instruments; polybench_print_instruments; compareResults(ny, POLYBENCH_ARRAY(y), POLYBENCH_ARRAY(y_outputFromGpu)); #else print_array(ny, POLYBENCH_ARRAY(y_outputFromGpu)); #endif //RUN_ON_CPU cl_clean_up(); POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(x); POLYBENCH_FREE_ARRAY(y); POLYBENCH_FREE_ARRAY(y_outputFromGpu); POLYBENCH_FREE_ARRAY(tmp); return 0; }
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) { /* 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; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int nx = NX; int ny = NY; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, NX, NY, nx, ny); POLYBENCH_1D_ARRAY_DECL(s, DATA_TYPE, NY, ny); POLYBENCH_1D_ARRAY_DECL(q, DATA_TYPE, NX, nx); POLYBENCH_1D_ARRAY_DECL(p, DATA_TYPE, NY, ny); POLYBENCH_1D_ARRAY_DECL(r, DATA_TYPE, NX, nx); /* Initialize array(s). */ init_array (nx, ny, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(r), POLYBENCH_ARRAY(p)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_bicg (nx, ny, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(s), POLYBENCH_ARRAY(q), POLYBENCH_ARRAY(p), POLYBENCH_ARRAY(r)); /* 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(nx, ny, POLYBENCH_ARRAY(s), POLYBENCH_ARRAY(q))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(s); POLYBENCH_FREE_ARRAY(q); POLYBENCH_FREE_ARRAY(p); POLYBENCH_FREE_ARRAY(r); return 0; }
/* Array initialization. */ static void init_array (int n, DATA_TYPE POLYBENCH_2D(A,N,N,n,n), DATA_TYPE POLYBENCH_1D(b,N,n), DATA_TYPE POLYBENCH_1D(x,N,n), DATA_TYPE POLYBENCH_1D(y,N,n)) { int i, j; DATA_TYPE fn = (DATA_TYPE)n; for (i = 0; i < n; i++) { x[i] = 0; y[i] = 0; b[i] = (i+1)/fn/2.0 + 4; } for (i = 0; i < n; i++) { for (j = 0; j <= i; j++) A[i][j] = (DATA_TYPE)(-j % n) / n + 1; for (j = i+1; j < n; j++) { A[i][j] = 0; } A[i][i] = 1; } /* Make the matrix positive semi-definite. */ /* not necessary for LU, but using same code as cholesky */ int r,s,t; POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, N, N, n, n); for (r = 0; r < n; ++r) for (s = 0; s < n; ++s) (POLYBENCH_ARRAY(B))[r][s] = 0; for (t = 0; t < n; ++t) for (r = 0; r < n; ++r) for (s = 0; s < n; ++s) (POLYBENCH_ARRAY(B))[r][s] += A[r][t] * A[s][t]; for (r = 0; r < n; ++r) for (s = 0; s < n; ++s) A[r][s] = (POLYBENCH_ARRAY(B))[r][s]; POLYBENCH_FREE_ARRAY(B); }
int main(int argc, char** argv) { #pragma hmpp floydwarshall acquire /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, N, N, n, n); #pragma hmpp floydwarshall allocate, & #pragma hmpp & args[path].size={n,n}, args[path].hostdata="path" /* Initialize array(s). */ init_array (n, POLYBENCH_ARRAY(path)); #pragma hmpp floydwarshall advancedload, args[path] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp floydwarshall callsite kernel_floyd_warshall (n, POLYBENCH_ARRAY(path)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp floydwarshall delegatedstore, args[path] /* 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(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(path); #pragma hmpp floydwarshall release return 0; }
int main(int argc, char** argv) { /* Retrieve problem size. */ int nr = NR; int nq = NQ; int np = NP; /* Variable declaration/allocation. */ POLYBENCH_3D_ARRAY_DECL(A,DATA_TYPE,NR,NQ,NP,nr,nq,np); POLYBENCH_1D_ARRAY_DECL(sum,DATA_TYPE,NP,np); POLYBENCH_2D_ARRAY_DECL(C4,DATA_TYPE,NP,NP,np,np); /* Initialize array(s). */ init_array (nr, nq, np, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(C4)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_doitgen (nr, nq, np, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(C4), POLYBENCH_ARRAY(sum)); /* 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(nr, nq, np, POLYBENCH_ARRAY(A))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(sum); POLYBENCH_FREE_ARRAY(C4); return 0; }
int main(int argc, char** argv) { #pragma hmpp fdtd2d acquire /* Retrieve problem size. */ int tmax = TMAX; int nx = NX; int ny = NY; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(ex,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(ey,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_2D_ARRAY_DECL(hz,DATA_TYPE,NX,NY,nx,ny); POLYBENCH_1D_ARRAY_DECL(_fict_,DATA_TYPE,TMAX,tmax); #pragma hmpp fdtd2d allocate, & #pragma hmpp & args[ex].size={nx,ny}, args[ex].hostdata="ex", & #pragma hmpp & args[ey].size={nx,ny}, args[ey].hostdata="ey", & #pragma hmpp & args[hz].size={nx,ny}, args[hz].hostdata="hz", & #pragma hmpp & args[_fict_].size={tmax}, args[_fict_].hostdata="_fict_" /* Initialize array(s). */ init_array (tmax, nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz), POLYBENCH_ARRAY(_fict_)); /* Start timer. */ polybench_start_instruments; /* Run kernel. */ kernel_fdtd_2d (tmax, nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz), POLYBENCH_ARRAY(_fict_)); #pragma hmpp fdtd2d advancedload, args[ex;ey;hz;_fict_] /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp fdtd2d delegatedstore, args[ex;ey;hz] /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(nx, ny, POLYBENCH_ARRAY(ex), POLYBENCH_ARRAY(ey), POLYBENCH_ARRAY(hz))); /* Be clean. */ POLYBENCH_FREE_ARRAY(ex); POLYBENCH_FREE_ARRAY(ey); POLYBENCH_FREE_ARRAY(hz); POLYBENCH_FREE_ARRAY(_fict_); #pragma hmpp fdtd2d release return 0; }
int main(int argc, char** argv) { #pragma hmpp regdetect acquire /* Retrieve problem size. */ int niter = NITER; int maxgrid = MAXGRID; int length = LENGTH; /* Variable declaration/allocation. */ POLYBENCH_2D_ARRAY_DECL(sum_tang, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_2D_ARRAY_DECL(mean, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_2D_ARRAY_DECL(path, DATA_TYPE, MAXGRID, MAXGRID, maxgrid, maxgrid); POLYBENCH_3D_ARRAY_DECL(diff, DATA_TYPE, MAXGRID, MAXGRID, LENGTH, maxgrid, maxgrid, length); POLYBENCH_3D_ARRAY_DECL(sum_diff, DATA_TYPE, MAXGRID, MAXGRID, LENGTH, maxgrid, maxgrid, length); #pragma hmpp regdetect allocate, & #pragma hmpp & args[sum_tang].size={maxgrid,maxgrid}, args[sum_tang].hostdata="sum_tang", & #pragma hmpp & args[mean].size={maxgrid,maxgrid}, args[mean].hostdata="mean", & #pragma hmpp & args[path].size={maxgrid,maxgrid}, args[path].hostdata="path", & #pragma hmpp & args[diff].size={maxgrid,maxgrid,length}, args[diff].hostdata="diff", & #pragma hmpp & args[sum_diff].size={maxgrid,maxgrid,length}, args[sum_diff].hostdata="sum_diff" /* Initialize array(s). */ init_array (maxgrid, POLYBENCH_ARRAY(sum_tang), POLYBENCH_ARRAY(mean), POLYBENCH_ARRAY(path)); #pragma hmpp regdetect advancedload, args[sum_tang;mean;path] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp regdetect callsite kernel_reg_detect (niter, maxgrid, length, POLYBENCH_ARRAY(sum_tang), POLYBENCH_ARRAY(mean), POLYBENCH_ARRAY(path), POLYBENCH_ARRAY(diff), POLYBENCH_ARRAY(sum_diff)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp regdetect delegatedstore, args[path] /* Prevent dead-code elimination. All live-out data must be printed by the function call in argument. */ polybench_prevent_dce(print_array(maxgrid, POLYBENCH_ARRAY(path))); /* Be clean. */ POLYBENCH_FREE_ARRAY(sum_tang); POLYBENCH_FREE_ARRAY(mean); POLYBENCH_FREE_ARRAY(path); POLYBENCH_FREE_ARRAY(diff); POLYBENCH_FREE_ARRAY(sum_diff); #pragma hmpp regdetect release return 0; }
int main(int argc, char** argv) { #pragma hmpp gesummv acquire /* Retrieve problem size. */ int n = N; /* Variable declaration/allocation. */ DATA_TYPE alpha; DATA_TYPE beta; POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n); POLYBENCH_2D_ARRAY_DECL(B, DATA_TYPE, N, N, n, n); POLYBENCH_1D_ARRAY_DECL(tmp, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(x, DATA_TYPE, N, n); POLYBENCH_1D_ARRAY_DECL(y, DATA_TYPE, N, n); #pragma hmpp gesummv allocate, & #pragma hmpp & args[A].size={n,n}, args[A].hostdata="A", & #pragma hmpp & args[B].size={n,n}, args[B].hostdata="B", & #pragma hmpp & args[x].size={n}, args[x].hostdata="x", & #pragma hmpp & args[y].size={n}, args[y].hostdata="y", & #pragma hmpp & args[tmp].size={n}, args[tmp].hostdata="tmp" /* Initialize array(s). */ init_array (n, &alpha, &beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(x)); #pragma hmpp gesummv advancedload, args[A;B;x] /* Start timer. */ polybench_start_instruments; /* Run kernel. */ #pragma hmpp gesummv callsite kernel_gesummv (n, alpha, beta, POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B), POLYBENCH_ARRAY(tmp), POLYBENCH_ARRAY(x), POLYBENCH_ARRAY(y)); /* Stop and print timer. */ polybench_stop_instruments; polybench_print_instruments; #pragma hmpp gesummv delegatedstore, args[y] /* 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(y))); /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B); POLYBENCH_FREE_ARRAY(tmp); POLYBENCH_FREE_ARRAY(x); POLYBENCH_FREE_ARRAY(y); #pragma hmpp gesummv release return 0; }