本文整理汇总了C++中POLYBENCH_2D_ARRAY_DECL函数的典型用法代码示例。如果您正苦于以下问题:C++ POLYBENCH_2D_ARRAY_DECL函数的具体用法?C++ POLYBENCH_2D_ARRAY_DECL怎么用?C++ POLYBENCH_2D_ARRAY_DECL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了POLYBENCH_2D_ARRAY_DECL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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;
}
示例2: main
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;
}
示例3: main
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;
}
示例4: main
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;
}
示例5: main
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;
}
示例6: main
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;
}
示例7: main
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;
}
示例8: main
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;
}
示例9: main
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;
}
示例10: main
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;
}
示例11: main
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;
}
示例12: main
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;
}
示例13: main
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;
}
示例14: main
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;
}
示例15: main
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;
}