filename
stringlengths
19
182
omp_pragma_line
stringlengths
24
416
context_chars
int64
100
100
text
stringlengths
152
177k
HExSA-Lab/nautilus/src/test/openmp/openmpbench_C_v31/syncbench.c
#pragma omp parallel for ordered schedule (static,1)
100
ck); delay(delaylength); omp_unset_lock(&lock); } } } void testorder() { int j; <LOOP-START>for (j = 0; j < (int)innerreps; j++) { #pragma omp ordered delay(delaylength); }<LOOP-END> <OMP-START>#pragma omp parallel for ordered schedule (static,1)<OMP-END>
HExSA-Lab/nautilus/src/test/openmp/streamcluster/streamcluster_omp.c
#pragma omp parallel for
100
global *lower* fields double* gl_lower = &work_mem[nproc*stride]; // OpenMP parallelization // <LOOP-START>#pragma omp parallel for reduction(+: cost_of_opening_x) for ( i = k1; i < k2; i++ ) { float x_cost = dist(points->p[i], points->p[x], points->dim) * points->p[i].weight; float current_cost = points->p[i].cost; if ( x_cost < current_cost ) { // point i would save cost just by switching to x // (note that i cannot be a median, // or else dist(p[i], p[x]) would be 0) switch_membership[i] = 1; cost_of_opening_x += x_cost - current_cost; } else { // cost of assigning i to x is at least current assignment cost of i // consider the savings that i's **current** median would realize // if we reassigned that median and all its members to x; // note we've already accounted for the fact that the median // would save z by closing; now we have to subtract from the savings // the extra cost of reassigning that median and its members int assign = points->p[i].assign; lower[center_table[assign]] += current_cost - x_cost; } }<LOOP-END> <OMP-START>#pragma omp parallel for <OMP-END>
HExSA-Lab/nautilus/src/test/openmp/streamcluster/streamcluster_omp.c
#pragma omp parallel for reduction(+: cost_of_opening_x)
100
ble* gl_lower = &work_mem[nproc*stride]; // OpenMP parallelization // #pragma omp parallel for <LOOP-START>for ( i = k1; i < k2; i++ ) { float x_cost = dist(points->p[i], points->p[x], points->dim) * points->p[i].weight; float current_cost = points->p[i].cost; if ( x_cost < current_cost ) { // point i would save cost just by switching to x // (note that i cannot be a median, // or else dist(p[i], p[x]) would be 0) switch_membership[i] = 1; cost_of_opening_x += x_cost - current_cost; } else { // cost of assigning i to x is at least current assignment cost of i // consider the savings that i's **current** median would realize // if we reassigned that median and all its members to x; // note we've already accounted for the fact that the median // would save z by closing; now we have to subtract from the savings // the extra cost of reassigning that median and its members int assign = points->p[i].assign; lower[center_table[assign]] += current_cost - x_cost; } }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+: cost_of_opening_x)<OMP-END>
HExSA-Lab/nautilus/src/test/openmp/streamcluster/streamcluster_omp.c
#pragma omp parallel for
100
do nothing if ( gl_cost_of_opening_x < 0 ) { // we'd save money by opening x; we'll do it <LOOP-START>for ( int i = k1; i < k2; i++ ) { bool close_center = gl_lower[center_table[points->p[i].assign]] > 0 ; if ( switch_membership[i] || close_center ) { // Either i's median (which may be i itself) is closing, // or i is closer to x than to its current median points->p[i].cost = points->p[i].weight * dist(points->p[i], points->p[x], points->dim); points->p[i].assign = x; } }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Transpose/transpose.c
#pragma omp parallel for private(i) reduction(+:abserr)
100
transposition */ double test_results (int order, double *B) { double abserr=0.0; int i,j; <LOOP-START>for (j=0;j<order;j++) { for (i=0;i<order; i++) { abserr += ABS(B(i,j) - (i*order + j)); } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i) reduction(+:abserr)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/DGEMM/dgemm.c
#pragma omp parallel for private(i,j)
100
exit(EXIT_FAILURE); } ref_checksum = (0.25*forder*forder*forder*(forder-1.0)*(forder-1.0)); <LOOP-START>for(j = 0; j < order; j++) for(i = 0; i < order; i++) { A_arr(i,j) = B_arr(i,j) = (double) j; C_arr(i,j) = 0.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private(i,j) <OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Stencil/stencil.c
#pragma omp parallel for private(i)
100
* intialize the input and output arrays */ #ifdef PARALLELFOR <LOOP-START>#else #pragma omp for for (j=0; j<n; j++) for (i=0; i<n; i++) IN(i,j) = COEFX*i+COEFY*j; #ifdef PARALLELFOR #pragma omp parallel for private(i) #else #pragma omp for for (j=RADIUS; j<n-RADIUS; j++) for (i=RADIUS; i<n-RADIUS; i++) OUT(i,j) = (DTYPE)0.0; for (iter = 0; iter<=iterations; iter++){ /* start timer after a warmup iteration */ if (iter == 1) { #ifndef PARALLELFOR #pragma omp barrier #pragma omp master { stencil_time = wtime(); } } #ifdef PARALLELFOR #pragma omp parallel for private(i, ii, jj) #else #pragma omp for for (j=RADIUS; j<n-RADIUS; j++) { for (i=RADIUS; i<n-RADIUS; i++) { #ifdef STAR for (jj=-RADIUS; jj<=RADIUS; jj++) OUT(i,j) += WEIGHT(0,jj)*IN(i,j+jj); for (ii=-RADIUS; ii<0; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); for (ii=1; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); #else /* would like to be able to unroll this loop, but compiler will ignore */ for (jj=-RADIUS; jj<=RADIUS; jj++) for (ii=-RADIUS; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,jj)*IN(i+ii,j+jj); } } /* add constant to solution to force refresh of neighbor data, if any */ #ifdef PARALLELFOR #pragma omp parallel for private(i) #else #pragma omp for for (j=0; j<n; j++) for (i=0; i<n; i++) IN(i,j)+= 1.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private(i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Stencil/stencil.c
#pragma omp parallel for private(i)
100
ndif for (j=0; j<n; j++) for (i=0; i<n; i++) IN(i,j) = COEFX*i+COEFY*j; #ifdef PARALLELFOR <LOOP-START>#else #pragma omp for for (j=RADIUS; j<n-RADIUS; j++) for (i=RADIUS; i<n-RADIUS; i++) OUT(i,j) = (DTYPE)0.0; for (iter = 0; iter<=iterations; iter++){ /* start timer after a warmup iteration */ if (iter == 1) { #ifndef PARALLELFOR #pragma omp barrier #pragma omp master { stencil_time = wtime(); } } #ifdef PARALLELFOR #pragma omp parallel for private(i, ii, jj) #else #pragma omp for for (j=RADIUS; j<n-RADIUS; j++) { for (i=RADIUS; i<n-RADIUS; i++) { #ifdef STAR for (jj=-RADIUS; jj<=RADIUS; jj++) OUT(i,j) += WEIGHT(0,jj)*IN(i,j+jj); for (ii=-RADIUS; ii<0; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); for (ii=1; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); #else /* would like to be able to unroll this loop, but compiler will ignore */ for (jj=-RADIUS; jj<=RADIUS; jj++) for (ii=-RADIUS; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,jj)*IN(i+ii,j+jj); } } /* add constant to solution to force refresh of neighbor data, if any */ #ifdef PARALLELFOR #pragma omp parallel for private(i) #else #pragma omp for for (j=0; j<n; j++) for (i=0; i<n; i++) IN(i,j)+= 1.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private(i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Stencil/stencil.c
#pragma omp parallel for private(i, ii, jj)
100
omp master #endif { stencil_time = wtime(); } } #ifdef PARALLELFOR <LOOP-START>#else #pragma omp for for (j=RADIUS; j<n-RADIUS; j++) { for (i=RADIUS; i<n-RADIUS; i++) { #ifdef STAR for (jj=-RADIUS; jj<=RADIUS; jj++) OUT(i,j) += WEIGHT(0,jj)*IN(i,j+jj); for (ii=-RADIUS; ii<0; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); for (ii=1; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); #else /* would like to be able to unroll this loop, but compiler will ignore */ for (jj=-RADIUS; jj<=RADIUS; jj++) for (ii=-RADIUS; ii<=RADIUS; ii++) OUT(i,j) += WEIGHT(ii,jj)*IN(i+ii,j+jj); } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i, ii, jj)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Stencil/stencil.c
#pragma omp parallel for private(i)
100
add constant to solution to force refresh of neighbor data, if any */ #ifdef PARALLELFOR <LOOP-START>#else #pragma omp for for (j=0; j<n; j++) for (i=0; i<n; i++) IN(i,j)+= 1.0; } /* end of iterations */ #ifndef PARALLELFOR #pragma omp barrier #pragma omp master { stencil_time = wtime() - stencil_time; }<LOOP-END> <OMP-START>#pragma omp parallel for private(i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/OPENMP/Stencil/stencil.c
#pragma omp parallel for reduction(+:norm), private (i)
100
compute L1 norm in parallel */ #ifdef PARALLELFOR <LOOP-START>#else #pragma omp for reduction(+:norm) for (j=RADIUS; j<n-RADIUS; j++) for (i=RADIUS; i<n-RADIUS; i++) { norm += (DTYPE)ABS(OUT(i,j)); }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:norm), private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (i,it,jt) collapse(2)
100
*/ istart = 0; if (tiling) { #ifdef COLLAPSE <LOOP-START>#else #pragma omp parallel for private (i,it,jt) for (j=0; j<Block_order; j+=Tile_order) for (i=0; i<order; i+=Tile_order) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) for (it=i; it<MIN(order,i+Tile_order); it++) { A(it,jt) = (double) (order*(jt+colstart) + it); B(it,jt) = -1.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private (i,it,jt) collapse(2)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (i,it,jt)
100
if (tiling) { #ifdef COLLAPSE #pragma omp parallel for private (i,it,jt) collapse(2) #else <LOOP-START>for (j=0; j<Block_order; j+=Tile_order) for (i=0; i<order; i+=Tile_order) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) for (it=i; it<MIN(order,i+Tile_order); it++) { A(it,jt) = (double) (order*(jt+colstart) + it); B(it,jt) = -1.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private (i,it,jt)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (i)
100
t) = (double) (order*(jt+colstart) + it); B(it,jt) = -1.0; } } else { <LOOP-START>for (j=0;j<Block_order;j++) for (i=0;i<order; i++) { A(i,j) = (double) (order*(j+colstart) + i); B(i,j) = -1.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j)
100
*/ istart = colstart; if (!tiling) { <LOOP-START>for (i=0; i<Block_order; i++) for (j=0; j<Block_order; j++) { B(j,i) = A(i,j); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j,it,jt) collapse(2)
100
or (j=0; j<Block_order; j++) { B(j,i) = A(i,j); } } else { #ifdef COLLAPSE <LOOP-START>#else #pragma omp parallel for private (j,it,jt) for (i=0; i<Block_order; i+=Tile_order) for (j=0; j<Block_order; j+=Tile_order) for (it=i; it<MIN(Block_order,i+Tile_order); it++) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) { B(jt,it) = A(it,jt); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j,it,jt) collapse(2)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j,it,jt)
100
else { #ifdef COLLAPSE #pragma omp parallel for private (j,it,jt) collapse(2) #else <LOOP-START>for (i=0; i<Block_order; i+=Tile_order) for (j=0; j<Block_order; j+=Tile_order) for (it=i; it<MIN(Block_order,i+Tile_order); it++) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) { B(jt,it) = A(it,jt); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j,it,jt)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j)
100
COMM_WORLD, &recv_req); #endif istart = send_to*Block_order; if (!tiling) { <LOOP-START>for (i=0; i<Block_order; i++) for (j=0; j<Block_order; j++){ Work_out(j,i) = A(i,j); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j,it,jt) collapse(2)
100
j<Block_order; j++){ Work_out(j,i) = A(i,j); } } else { #ifdef COLLAPSE <LOOP-START>#else #pragma omp parallel for private (j,it,jt) for (i=0; i<Block_order; i+=Tile_order) for (j=0; j<Block_order; j+=Tile_order) for (it=i; it<MIN(Block_order,i+Tile_order); it++) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) { Work_out(jt,it) = A(it,jt); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j,it,jt) collapse(2)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (j,it,jt)
100
else { #ifdef COLLAPSE #pragma omp parallel for private (j,it,jt) collapse(2) #else <LOOP-START>for (i=0; i<Block_order; i+=Tile_order) for (j=0; j<Block_order; j+=Tile_order) for (it=i; it<MIN(Block_order,i+Tile_order); it++) for (jt=j; jt<MIN(Block_order,j+Tile_order);jt++) { Work_out(jt,it) = A(it,jt); }<LOOP-END> <OMP-START>#pragma omp parallel for private (j,it,jt)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (i)
100
v_from*Block_order; /* scatter received block to transposed matrix; no need to tile */ <LOOP-START>for (j=0; j<Block_order; j++) for (i=0; i<Block_order; i++) { B(i,j) = Work_in(i,j); }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Transpose/transpose.c
#pragma omp parallel for private (i)
100
_time, 1, MPI_DOUBLE, MPI_MAX, root, MPI_COMM_WORLD); abserr = 0.0; istart = 0; <LOOP-START>for (j=0;j<Block_order;j++) for (i=0;i<order; i++) { abserr += ABS(B(i,j) - (double)(order*i + j+colstart)); }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Nstream/nstream.c
#pragma omp parallel for
100
fset = %ld\n", offset); printf("Number of iterations = %d\n", iterations); } <LOOP-START>#pragma vector always for (j=0; j<length; j++) { a[j] = 0.0; b[j] = 2.0; c[j] = 2.0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Nstream/nstream.c
#pragma omp parallel for
100
if (iter == 1) { MPI_Barrier(MPI_COMM_WORLD); local_nstream_time = wtime(); } <LOOP-START>#pragma vector always for (j=0; j<length; j++) a[j] += b[j]+scalar*c[j]; } /* end iterations */ /********************************************************************* ** Analyze and output results. *********************************************************************/ local_nstream_time = wtime() - local_nstream_time; MPI_Reduce(&local_nstream_time, &nstream_time, 1, MPI_DOUBLE, MPI_MAX, root, MPI_COMM_WORLD); if (my_ID == root) { if (checkTRIADresults(iterations, length)) { avgtime = nstream_time/iterations; printf("Rate (MB/s): %lf Avg time (s): %lf\n", 1.0E-06 * bytes/avgtime, avgtime); } else error = 1; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Nstream/nstream.c
#pragma omp parallel for reduction(+:asum)
100
0; iter<=iterations; iter++) aj += bj+scalar*cj; aj = aj * (double) (length); asum = 0.0; <LOOP-START>for (j=0; j<length; j++) asum += a[j]; #ifdef VERBOSE printf ("Results Comparison: \n"); printf (" Expected checksum: %f\n",aj); printf (" Observed checksum: %f\n",asum); if (ABS(aj-asum)/asum > epsilon) { printf ("Failed Validation on output array\n"); #ifndef VERBOSE printf (" Expected checksum: %f \n",aj); printf (" Observed checksum: %f \n",asum); return (0); }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:asum)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Stencil/stencil.c
#pragma omp parallel for private (i)
100
) (n-2*RADIUS); /* intialize the input and output arrays */ <LOOP-START>for (j=jstart; j<=jend; j++) for (i=istart; i<=iend; i++) { IN(i,j) = COEFX*i+COEFY*j; OUT(i,j) = (DTYPE)0.0; }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Stencil/stencil.c
#pragma omp parallel for private (i)
100
IN(i,j) = left_buf_in[kk++]; } } /* Apply the stencil operator */ <LOOP-START>for (j=MAX(jstart,RADIUS); j<=MIN(n-RADIUS-1,jend); j++) { for (i=MAX(istart,RADIUS); i<=MIN(n-RADIUS-1,iend); i++) { for (jj=-RADIUS; jj<=RADIUS; jj++) { OUT(i,j) += WEIGHT(0,jj)*IN(i,j+jj); } for (ii=-RADIUS; ii<0; ii++) { OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); } for (ii=1; ii<=RADIUS; ii++) { OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); } } }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Stencil/stencil.c
#pragma omp parallel for private (i)
100
ii<=RADIUS; ii++) { OUT(i,j) += WEIGHT(ii,0)*IN(i+ii,j); } } } <LOOP-START>/* add constant to solution to force refresh of neighbor data, if any */ for (j=jstart; j<=jend; j++) for (i=istart; i<=iend; i++) IN(i,j)+= 1.0; } local_stencil_time = wtime() - local_stencil_time; MPI_Reduce(&local_stencil_time, &stencil_time, 1, MPI_DOUBLE, MPI_MAX, root, MPI_COMM_WORLD); /* compute L1 norm in parallel */ local_norm = (DTYPE) 0.0; #pragma omp parallel for reduction(+:local_norm) private (i) for (j=MAX(jstart,RADIUS); j<=MIN(n-RADIUS-1,jend); j++) { for (i=MAX(istart,RADIUS); i<=MIN(n-RADIUS-1,iend); i++) { local_norm += (DTYPE)ABS(OUT(i,j)); } }<LOOP-END> <OMP-START>#pragma omp parallel for private (i)<OMP-END>
openhpc/ohpc/tests/apps/prk/tests/MPIOPENMP/Stencil/stencil.c
#pragma omp parallel for reduction(+:local_norm) private (i)
100
e L1 norm in parallel */ local_norm = (DTYPE) 0.0; <LOOP-START>for (j=MAX(jstart,RADIUS); j<=MIN(n-RADIUS-1,jend); j++) { for (i=MAX(istart,RADIUS); i<=MIN(n-RADIUS-1,iend); i++) { local_norm += (DTYPE)ABS(OUT(i,j)); } }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:local_norm) private (i)<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/GenerateProblem_ref.cpp
#pragma omp parallel for
100
utes the physical placement of arrays of pointers across the memory system #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i< localNumberOfRows; ++i) { matrixValues[i] = 0; matrixDiagonal[i] = 0; mtxIndG[i] = 0; mtxIndL[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/GenerateProblem_ref.cpp
#pragma omp parallel for
100
ODO: This triply nested loop could be flattened or use nested parallelism #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t iz=0; iz<nz; iz++) { global_int_t giz = ipz*nz+iz; for (local_int_t iy=0; iy<ny; iy++) { global_int_t giy = ipy*ny+iy; for (local_int_t ix=0; ix<nx; ix++) { global_int_t gix = ipx*nx+ix; local_int_t currentLocalRow = iz*nx*ny+iy*nx+ix; global_int_t currentGlobalRow = giz*gnx*gny+giy*gnx+gix; #ifndef HPCG_NO_OPENMP // C++ std::map is not threadsafe for writing #pragma omp critical A.globalToLocalMap[currentGlobalRow] = currentLocalRow; A.localToGlobalMap[currentLocalRow] = currentGlobalRow; #ifdef HPCG_DETAILED_DEBUG HPCG_fout << " rank, globalRow, localRow = " << A.geom->rank << " " << currentGlobalRow << " " << A.globalToLocalMap[currentGlobalRow] << endl; char numberOfNonzerosInRow = 0; double * currentValuePointer = matrixValues[currentLocalRow]; // Pointer to current value in current row global_int_t * currentIndexPointerG = mtxIndG[currentLocalRow]; // Pointer to current index in current row for (int sz=-1; sz<=1; sz++) { if (giz+sz>-1 && giz+sz<gnz) { for (int sy=-1; sy<=1; sy++) { if (giy+sy>-1 && giy+sy<gny) { for (int sx=-1; sx<=1; sx++) { if (gix+sx>-1 && gix+sx<gnx) { global_int_t curcol = currentGlobalRow+sz*gnx*gny+sy*gnx+sx; if (curcol==currentGlobalRow) { matrixDiagonal[currentLocalRow] = currentValuePointer; *currentValuePointer++ = 26.0; } else { *currentValuePointer++ = -1.0; } *currentIndexPointerG++ = curcol; numberOfNonzerosInRow++; } // end x bounds test } // end sx loop } // end y bounds test } // end sy loop } // end z bounds test } // end sz loop nonzerosInRow[currentLocalRow] = numberOfNonzerosInRow; #ifndef HPCG_NO_OPENMP #pragma omp critical localNumberOfNonzeros += numberOfNonzerosInRow; // Protect this with an atomic if (b!=0) bv[currentLocalRow] = 26.0 - ((double) (numberOfNonzerosInRow-1)); if (x!=0) xv[currentLocalRow] = 0.0; if (xexact!=0) xexactv[currentLocalRow] = 1.0; } // end ix loop } // end iy loop }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/SetupHalo_ref.cpp
#pragma omp parallel for
100
/ In the non-MPI case we simply copy global indices to local index storage #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i< localNumberOfRows; i++) { int cur_nnz = nonzerosInRow[i]; for (int j=0; j<cur_nnz; j++) mtxIndL[i][j] = mtxIndG[i][j]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/SetupHalo_ref.cpp
#pragma omp parallel for
100
l ids of entry to send } } // Convert matrix indices to local IDs #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i< localNumberOfRows; i++) { for (int j=0; j<nonzerosInRow[i]; j++) { global_int_t curIndex = mtxIndG[i][j]; int rankIdOfColumnEntry = ComputeRankOfMatrixRow(*(A.geom), curIndex); if (A.geom->rank==rankIdOfColumnEntry) { // My column index, so convert to local index mtxIndL[i][j] = A.globalToLocalMap[curIndex]; } else { // If column index is not a row index, then it comes from another processor mtxIndL[i][j] = externalToLocalMap[curIndex]; } } }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/ComputeDotProduct_ref.cpp
#pragma omp parallel for reduction (+:local_result)
100
0.0; double * xv = x.values; double * yv = y.values; if (yv==xv) { #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i<n; i++) local_result += xv[i]*xv[i]; } else { #ifndef HPCG_NO_OPENMP #pragma omp parallel for reduction (+:local_result) for (local_int_t i=0; i<n; i++) local_result += xv[i]*yv[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction (+:local_result)<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/ComputeWAXPBY_ref.cpp
#pragma omp parallel for
100
const yv = y.values; double * const wv = w.values; if (alpha==1.0) { #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i<n; i++) wv[i] = xv[i] + beta * yv[i]; } else if (beta==1.0) { #ifndef HPCG_NO_OPENMP #pragma omp parallel for for (local_int_t i=0; i<n; i++) wv[i] = alpha * xv[i] + yv[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/ComputeWAXPBY_ref.cpp
#pragma omp parallel for
100
t i=0; i<n; i++) wv[i] = xv[i] + beta * yv[i]; } else if (beta==1.0) { #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i<n; i++) wv[i] = alpha * xv[i] + yv[i]; } else { #ifndef HPCG_NO_OPENMP #pragma omp parallel for for (local_int_t i=0; i<n; i++) wv[i] = alpha * xv[i] + beta * yv[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/ComputeSPMV_ref.cpp
#pragma omp parallel for
100
ble * const yv = y.values; const local_int_t nrow = A.localNumberOfRows; #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i< nrow; i++) { double sum = 0.0; const double * const cur_vals = A.matrixValues[i]; const local_int_t * const cur_inds = A.mtxIndL[i]; const int cur_nnz = A.nonzerosInRow[i]; for (int j=0; j< cur_nnz; j++) sum += cur_vals[j]*xv[cur_inds[j]]; yv[i] = sum; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/GenerateCoarseProblem.cpp
#pragma omp parallel for
100
utes the physical placement of arrays of pointers across the memory system #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t i=0; i< localNumberOfRows; ++i) { f2cOperator[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/GenerateCoarseProblem.cpp
#pragma omp parallel for
100
ODO: This triply nested loop could be flattened or use nested parallelism #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t izc=0; izc<nzc; ++izc) { local_int_t izf = 2*izc; for (local_int_t iyc=0; iyc<nyc; ++iyc) { local_int_t iyf = 2*iyc; for (local_int_t ixc=0; ixc<nxc; ++ixc) { local_int_t ixf = 2*ixc; local_int_t currentCoarseRow = izc*nxc*nyc+iyc*nxc+ixc; local_int_t currentFineRow = izf*nxf*nyf+iyf*nxf+ixf; f2cOperator[currentCoarseRow] = currentFineRow; } // end iy loop } // end even iz if statement }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/hpcg/src/CheckProblem.cpp
#pragma omp parallel for
100
ODO: This triply nested loop could be flattened or use nested parallelism #ifndef HPCG_NO_OPENMP <LOOP-START>for (local_int_t iz=0; iz<nz; iz++) { global_int_t giz = ipz*nz+iz; for (local_int_t iy=0; iy<ny; iy++) { global_int_t giy = ipy*ny+iy; for (local_int_t ix=0; ix<nx; ix++) { global_int_t gix = ipx*nx+ix; local_int_t currentLocalRow = iz*nx*ny+iy*nx+ix; global_int_t currentGlobalRow = giz*gnx*gny+giy*gnx+gix; assert(A.localToGlobalMap[currentLocalRow] == currentGlobalRow); #ifdef HPCG_DETAILED_DEBUG HPCG_fout << " rank, globalRow, localRow = " << A.geom->rank << " " << currentGlobalRow << " " << A.globalToLocalMap[currentGlobalRow] << endl; char numberOfNonzerosInRow = 0; double * currentValuePointer = A.matrixValues[currentLocalRow]; // Pointer to current value in current row global_int_t * currentIndexPointerG = A.mtxIndG[currentLocalRow]; // Pointer to current index in current row for (int sz=-1; sz<=1; sz++) { if (giz+sz>-1 && giz+sz<gnz) { for (int sy=-1; sy<=1; sy++) { if (giy+sy>-1 && giy+sy<gny) { for (int sx=-1; sx<=1; sx++) { if (gix+sx>-1 && gix+sx<gnx) { global_int_t curcol = currentGlobalRow+sz*gnx*gny+sy*gnx+sx; if (curcol==currentGlobalRow) { assert(A.matrixDiagonal[currentLocalRow] == currentValuePointer); assert(*currentValuePointer++ == 26.0); } else { assert(*currentValuePointer++ == -1.0); } assert(*currentIndexPointerG++ == curcol); numberOfNonzerosInRow++; } // end x bounds test } // end sx loop } // end y bounds test } // end sy loop } // end z bounds test } // end sz loop assert(A.nonzerosInRow[currentLocalRow] == numberOfNonzerosInRow); #ifndef HPCG_NO_OPENMP #pragma omp critical localNumberOfNonzeros += numberOfNonzerosInRow; // Protect this with an atomic if (b!=0) assert(bv[currentLocalRow] == 26.0 - ((double) (numberOfNonzerosInRow-1))); if (x!=0) assert(xv[currentLocalRow] == 0.0); if (xexact!=0) assert(xexactv[currentLocalRow] == 1.0); } // end ix loop } // end iy loop }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/perform_element_loop.hpp
#pragma omp parallel for shared (elemIDs)
100
= 0, t_si = 0; timer_type t0 = 0; const MINIFE_GLOBAL_ORDINAL elemID_size = elemIDs.size(); <LOOP-START>for(MINIFE_GLOBAL_ORDINAL i=0; i < elemID_size; ++i) { ElemData<GlobalOrdinal,Scalar> elem_data; compute_gradient_values(elem_data.grad_vals); get_elem_nodes_and_coords(mesh, elemIDs[i], elem_data); compute_element_matrix_and_vector(elem_data); sum_into_global_linear_system(elem_data, A, b); }<LOOP-END> <OMP-START>#pragma omp parallel for shared (elemIDs)<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/generate_matrix_structure.hpp
#pragma omp parallel for
100
ffset_ptr = &row_offsets[0]; MINIFE_LOCAL_ORDINAL* const row_coords_ptr = &row_coords[0]; <LOOP-START>for(int r = 0; r < r_n; ++r) { int iz = r / (xy_width) + box[2][0]; int iy = (r / x_width) % y_width + box[1][0]; int ix = r % x_width + box[0][0]; GlobalOrdinal row_id = get_id<GlobalOrdinal>(global_nodes_x, global_nodes_y, global_nodes_z, ix, iy, iz); row_ptr[r] = mesh.map_id_to_row(row_id); row_coords_ptr[r*3] = ix; row_coords_ptr[r*3+1] = iy; row_coords_ptr[r*3+2] = iz; MINIFE_LOCAL_ORDINAL nnz = 0; for(int sz=-1; sz<=1; ++sz) { for(int sy=-1; sy<=1; ++sy) { for(int sx=-1; sx<=1; ++sx) { GlobalOrdinal col_id = get_id<GlobalOrdinal>(global_nodes_x, global_nodes_y, global_nodes_z, ix+sx, iy+sy, iz+sz); if (col_id >= 0 && col_id < global_nrows) { ++nnz; } } } } row_offset_ptr[r+1] = nnz; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/exchange_externals.hpp
#pragma omp parallel for
100
.size(); #ifdef MINIFE_DEBUG os << "total_to_be_sent: " << total_to_be_sent << std::endl; #endif <LOOP-START>for(size_t i=0; i<total_to_be_sent; ++i) { #ifdef MINIFE_DEBUG //expensive index range-check: if (elements_to_send[i] < 0 || elements_to_send[i] > x.local_size) { os << "error, out-of-range. x.coefs.size()=="<<x.local_size<<", elements_to_send[i]=="<<elements_to_send[i]<<std::endl; } send_buffer[i] = x.coefs[elements_to_send[i]]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
T wcoefs __attribute__ ((aligned (64))) = &w.coefs[0]; if(beta == 0.0) { if(alpha == 1.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i=0; i<n; ++i) { wcoefs[i] = xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
#pragma unroll(8) for(int i=0; i<n; ++i) { wcoefs[i] = xcoefs[i]; } } else { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i=0; i<n; ++i) { wcoefs[i] = alpha * xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
=0; i<n; ++i) { wcoefs[i] = alpha * xcoefs[i]; } } } else { if(alpha == 1.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i=0; i<n; ++i) { wcoefs[i] = xcoefs[i] + beta * ycoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
for(int i=0; i<n; ++i) { wcoefs[i] = xcoefs[i] + beta * ycoefs[i]; } } else { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i=0; i<n; ++i) { wcoefs[i] = alpha * xcoefs[i] + beta * ycoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
STRICT ycoefs __attribute__ ((aligned (64))) = &y.coefs[0]; if(alpha == 1.0 && beta == 1.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] += xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
for(int i = 0; i < n; ++i) { ycoefs[i] += xcoefs[i]; } } else if (beta == 1.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] += alpha * xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
nt i = 0; i < n; ++i) { ycoefs[i] += alpha * xcoefs[i]; } } else if (alpha == 1.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] = xcoefs[i] + beta * ycoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
i < n; ++i) { ycoefs[i] = xcoefs[i] + beta * ycoefs[i]; } } else if (beta == 0.0) { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] = alpha * xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for
100
unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] = alpha * xcoefs[i]; } } else { <LOOP-START>#pragma vector nontemporal #pragma unroll(8) for(int i = 0; i < n; ++i) { ycoefs[i] = alpha * xcoefs[i] + beta * ycoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for reduction(+:result)
100
INIFE_RESTRICT ycoefs __attribute__ ((aligned (64))) = &y.coefs[0]; MINIFE_SCALAR result = 0; <LOOP-START>for(int i=0; i<n; ++i) { result += xcoefs[i] * ycoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:result)<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector_functions.hpp
#pragma omp parallel for reduction(+:result)
100
MINIFE_RESTRICT xcoefs __attribute__ ((aligned (64))) = &x.coefs[0]; MINIFE_SCALAR result = 0; <LOOP-START>#pragma unroll(8) for(MINIFE_LOCAL_ORDINAL i = 0; i < n; ++i) { result += xcoefs[i] * xcoefs[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:result)<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/CSRMatrix.hpp
#pragma omp parallel for
100
rows * ncols_per_row; packed_cols.reserve(nrows_max); packed_coefs.reserve(nrows_max); <LOOP-START>for(MINIFE_GLOBAL_ORDINAL i = 0; i < nrows; ++i) { rows[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/CSRMatrix.hpp
#pragma omp parallel for
100
ma omp parallel for for(MINIFE_GLOBAL_ORDINAL i = 0; i < nrows; ++i) { rows[i] = 0; } <LOOP-START>for(MINIFE_GLOBAL_ORDINAL i = 0; i < nrows + 1; ++i) { row_offsets[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/CSRMatrix.hpp
#pragma omp parallel for
100
llel for for(MINIFE_GLOBAL_ORDINAL i = 0; i < nrows + 1; ++i) { row_offsets[i] = 0; } <LOOP-START>for(MINIFE_GLOBAL_ORDINAL i = 0; i < nrows_max; ++i) { packed_cols[i] = 0; packed_coefs[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/SparseMatrix_functions.hpp
#pragma omp parallel for
100
zero_row_and_put_1_on_diagonal(A, row); } } const int ROW_COUNT = A.rows.size(); <LOOP-START>for(MINIFE_GLOBAL_ORDINAL i=0; i < ROW_COUNT; ++i) { GlobalOrdinal row = A.rows[i]; if (bc_rows.find(row) != bc_rows.end()) continue; size_t row_length = 0; GlobalOrdinal* cols = NULL; Scalar* coefs = NULL; A.get_row_pointers(row, row_length, cols, coefs); Scalar sum = 0; for(size_t j=0; j<row_length; ++j) { if (bc_rows.find(cols[j]) != bc_rows.end()) { sum += coefs[j]; coefs[j] = 0; } } #pragma omp atomic b.coefs[i] -= sum*prescribed_value; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/SparseMatrix_functions.hpp
#pragma omp parallel for
100
4))) = &x.coefs[0]; ScalarType* ycoefs __attribute__((aligned(64))) = &y.coefs[0]; <LOOP-START>for(MINIFE_GLOBAL_ORDINAL row = 0; row < rows_size; ++row) { const MINIFE_GLOBAL_ORDINAL row_start = Arowoffsets[row]; const MINIFE_GLOBAL_ORDINAL row_end = Arowoffsets[row+1]; MINIFE_SCALAR sum = 0; #pragma loop_count(15) #pragma vector nontemporal for(MINIFE_GLOBAL_ORDINAL i = row_start; i < row_end; ++i) { sum += Acoefs[i] * xcoefs[Acols[i]]; } ycoefs[row] = sum; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/SparseMatrix_functions.hpp
#pragma omp parallel for
100
alarType* xcoefs = &x.coefs[0]; ScalarType* ycoefs = &y.coefs[0]; ScalarType beta = 0; <LOOP-START>for(int row=0; row<n; ++row) { ScalarType sum = beta*ycoefs[row]; int row_start=row*row_len; int row_end=row_start+row_len; for(LocalOrdinalType i=row_start; i<row_end; ++i) { sum += Acoefs[i]*xcoefs[Acols[i]]; } ycoefs[row] = sum; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/SparseMatrix_functions.hpp
#pragma omp parallel for
100
= &y.coefs[0]; const ScalarType beta = 0; <LOOP-START>for(MINIFE_GLOBAL_ORDINAL row = 0; row < rows_size; ++row) { const MINIFE_GLOBAL_ORDINAL row_start = Arowoffsets[row]; const MINIFE_GLOBAL_ORDINAL row_end = Arowoffsets[row+1]; MINIFE_SCALAR sum = 0; #pragma loop_count(15) for(MINIFE_GLOBAL_ORDINAL i = row_start; i < row_end; ++i) { sum += Acoefs[i] * xcoefs[Acols[i]]; } ycoefs[row] = sum; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/SparseMatrix_functions.hpp
#pragma omp parallel for
100
alarType* xcoefs = &x.coefs[0]; ScalarType* ycoefs = &y.coefs[0]; ScalarType beta = 0; <LOOP-START>for(int row=0; row<n; ++row) { ScalarType sum = beta*ycoefs[row]; int row_start=row*row_len; int row_end=row_start+row_len; for(LocalOrdinalType i=row_start; i<row_end; ++i) { sum += Acoefs[i]*xcoefs[Acols[i]]; } ycoefs[row] = sum; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/main.cpp
#pragma omp parallel for reduction(+:value)
100
PENMP const int thread_count = omp_get_max_threads(); #else const int thread_count = 1; #endif <LOOP-START>for(int i = 0; i < thread_count; ++i) { value += 1; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:value)<OMP-END>
openhpc/ohpc/tests/apps/miniFE/tests/src/Vector.hpp
#pragma omp parallel for
100
int )coefs) % 64); } const MINIFE_LOCAL_ORDINAL n = (MINIFE_LOCAL_ORDINAL) local_sz; <LOOP-START>for(MINIFE_LOCAL_ORDINAL i = 0; i < n; ++i) { coefs[i] = 0; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
yzhaiustc/Optimizing-DGEMV-on-Intel-CPUs/mydgemv.c
#pragma omp parallel for schedule(static)
100
i++; } } void mydgemv_t(double *A, double *x, double *y, int m, int n) { int tid; <LOOP-START>for (tid = 0; tid < omp_get_num_threads(); tid++) { int TOTAL_THREADS = omp_get_num_threads(); long int NUM_DIV_NUM_THREADS = m / TOTAL_THREADS * TOTAL_THREADS; long int DIM_LEN = m / TOTAL_THREADS; long int EDGE_LEN = (NUM_DIV_NUM_THREADS == m) ? m / TOTAL_THREADS : m - NUM_DIV_NUM_THREADS + DIM_LEN; if (tid == 0) mydgemv_compute(A,x,y,EDGE_LEN,n); else mydgemv_compute(A+EDGE_LEN*n + (tid - 1) * DIM_LEN*n,x,y + EDGE_LEN + (tid - 1) * DIM_LEN,DIM_LEN,n); }<LOOP-END> <OMP-START>#pragma omp parallel for schedule(static)<OMP-END>
bsc-pm/dlb/doc/examples/mpi+omp_ompt/mpi_omp_pils.c
#pragma omp parallel for private(j) reduction(+:iter_time) shared(fib)
100
i<steps; i+=BS) { int upper_bound = MIN(steps, i+BS); int j; <LOOP-START>for(j=i; j<upper_bound; j++){ iter(&iter_time, &fib, task_usec); }<LOOP-END> <OMP-START>#pragma omp parallel for private(j) reduction(+:iter_time) shared(fib)<OMP-END>
bsc-pm/dlb/doc/examples/mpi+omp/mpi_omp_pils.c
#pragma omp parallel for private(j) reduction(+:iter_time) shared(fib)
100
int upper_bound = MIN(steps, i+BS); int j; DLB_Borrow(); <LOOP-START>for(j=i; j<upper_bound; j++){ iter(&iter_time, &fib, task_usec); }<LOOP-END> <OMP-START>#pragma omp parallel for private(j) reduction(+:iter_time) shared(fib)<OMP-END>
bsc-pm/mcxx/src/tl/omp/core/tl-omp-reduction.cpp
#pragma omp parallel for reduction(A::F : A::d)
100
argument is special, we have to look for a ':' that is not followed by any other ':' // <LOOP-START>std::string current_argument = *list_it; // Trim blanks current_argument.erase(std::remove(current_argument.begin(), current_argument.end(), ' '), current_argument.end()); std::string::iterator split_colon = current_argument.end(); for (std::string::iterator it = current_argument.begin(); it != current_argument.end(); it++) { if ((*it) == ':' && (it + 1) != current_argument.end()) { if (*(it + 1) != ':') { split_colon = it; break; } else { // Next one is also a ':' but it is not a valid splitting // ':', so ignore it it++; } } }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(A::F : A::d)<OMP-END>
bsc-pm/mcxx/src/tl/omp/core/tl-omp-core.cpp
#pragma omp parallel for'\n");
100
error_printf_at(n.get_locus(), "invalid 'break' inside '#pragma omp for' or '<LOOP-START>} } else if (IS_FORTRAN_LANGUAGE) { if (n.get_construct_name().is_null() && nest_of_break == 0) { error_printf_at(n.get_locus(), "invalid 'EXIT' inside '!$OMP DO' or '!$OMP PARALLEL DO'\n"); } else if (!n.get_construct_name().is_null()) { TL::Symbol name = n.get_construct_name().get_symbol(); if ((name == loop_label) || !stack_of_labels.contains(name)) { // We are doing an EXIT of the whole loop or a loop not nested error_printf_at(n.get_locus(), "invalid 'EXIT' inside '!$OMP DO' or '!$OMP PARALLEL DO'\n"); } } }<LOOP-END> <OMP-START>#pragma omp parallel for'\n");<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_34_parallel_convolv_overlap_epilog.c
#pragma omp parallel for default(none) \
100
ge, 64); __assume_aligned(filter, 64); __assume((W%16) == 0); __assume((H%16) == 0); <LOOP-START>private(mv, mh, i, j) \ firstprivate(input_image, output_image, filter, H, W, K, normal_factor) \ schedule(static) num_threads(183) for (mv = 0; mv < W-K; mv++) { /* rows, top-to-bottom */ for (mh = 0; mh < H-K; mh++) { /* columns, LEFT-to-RIGHT */ int sum = 0; for (i = 0; i < K; i++) { for (j = 0; j < K; j++) { /* FIR outer-loop... */ sum += input_image[(mh + i)*W + mv + j] * filter[i*K + j]; } } output_image[mh * W + mv] = (sum >> normal_factor); } }<LOOP-END> <OMP-START>#pragma omp parallel for default(none) \<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_34_parallel_convolv_overlap_epilog.c
#pragma omp parallel for private(i, j)
100
id **) &filter, VECTOR_SIZE, K*K * sizeof(int)) != 0) { exit(1); } <LOOP-START>for (i = 0; i < H; i++) { for (j = 0; j < W; ++j) { input_image[i * W + j] = i + j; output_image[i * W + j] = 0; } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i, j)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_34_parallel_convolv_overlap_epilog.c
#pragma omp parallel for private(i, j)
100
utput_image_sc, VECTOR_SIZE, H*W * sizeof(int)) != 0) { exit(1); } <LOOP-START>for (i = 0; i < H; i++) { for (j = 0; j < W; ++j) { output_image_sc[i * W + j] = 0; } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i, j)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_33_parallel_convolv_overlap.c
#pragma omp parallel for default(none) \
100
ge, 64); __assume_aligned(filter, 64); __assume((W%16) == 0); __assume((H%16) == 0); <LOOP-START>private(mv, mh, i, j) \ firstprivate(input_image, output_image, filter, H, W, K, normal_factor) \ schedule(static) num_threads(183) for (mv = 0; mv < W-K; mv++) { /* rows, top-to-bottom */ for (mh = 0; mh < H-K; mh++) { /* columns, LEFT-to-RIGHT */ int sum = 0; for (i = 0; i < K; i++) { for (j = 0; j < K; j++) { /* FIR outer-loop... */ sum += input_image[(mh + i)*W + mv + j] * filter[i*K + j]; } } output_image[mh * W + mv] = (sum >> normal_factor); } }<LOOP-END> <OMP-START>#pragma omp parallel for default(none) \<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_33_parallel_convolv_overlap.c
#pragma omp parallel for private(i, j)
100
id **) &filter, VECTOR_SIZE, K*K * sizeof(int)) != 0) { exit(1); } <LOOP-START>for (i = 0; i < H; i++) { for (j = 0; j < W; ++j) { input_image[i * W + j] = i + j; output_image[i * W + j] = 0; } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i, j)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_33_parallel_convolv_overlap.c
#pragma omp parallel for private(i, j)
100
utput_image_sc, VECTOR_SIZE, H*W * sizeof(int)) != 0) { exit(1); } <LOOP-START>for (i = 0; i < H; i++) { for (j = 0; j < W; ++j) { output_image_sc[i * W + j] = 0; } }<LOOP-END> <OMP-START>#pragma omp parallel for private(i, j)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_32_parallel_moving_average_overlap.c
#pragma omp parallel for firstprivate(N) private(i)
100
_memalign((void **) &result_sc, VECTOR_SIZE, N * sizeof(float)) != 0) { exit(1); } <LOOP-START>for (i=0; i<N; i++) { input[i] = _popcnt32(i); }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(N) private(i)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_32_parallel_moving_average_overlap.c
#pragma omp parallel for firstprivate(N, points, input, result, result_sc)
100
fprintf(stderr, "%.10f\n", result[N-1]); moving_average_sc(input, result_sc, N, points); <LOOP-START>for(i=0; i<N-points; i++) { if(fabs(result[i]-result_sc[i]) > 5) { printf("ERROR (%i) %.20f != %.20f\n", i, result[i], result_sc[i]); exit(1); } }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(N, points, input, result, result_sc)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/simd/mic/success_simd_35_parallel_heat_eq.c
#pragma omp parallel for private(k, j, i) firstprivate(Anext, Anext_sc, nx) shared(stderr, errors) schedule(static) num_threads(183) default(none)
100
_sc); /* stencil function */ stencil_14_sc(A0_sc, Anext_sc, nx, tx, timesteps); <LOOP-START>for (i=0; i<nx; i++) { float simd_value = Anext[i]; float ref_value = Anext_sc[i]; float abs = fabsf(simd_value - ref_value); if (isnan(simd_value) || isnan(ref_value) || isnan(abs) || abs > 0.001f) { fprintf(stderr, "Error: abs(Anext[%d]=%f - Anext_sc[%d]=%f) = %f\n", i, Anext[i], i, Anext_sc[i], abs); errors = 1; } }<LOOP-END> <OMP-START>#pragma omp parallel for private(k, j, i) firstprivate(Anext, Anext_sc, nx) shared(stderr, errors) schedule(static) num_threads(183) default(none)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_02.cpp
#pragma omp parallel for reduction(A::plus : x)
100
[N]; A::myInt x = {0}; for ( i = 0; i < N ; i++ ) { a[i] = i; s += i; } <LOOP-START>for ( i = 0; i < N ; i++ ) { x += a[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(A::plus : x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_12.cpp
#pragma omp parallel for reduction (foo : x)
100
omp_out, &omp_in) ) int main (int argc, char* argv[]) { std::vector<int> v(10,1); int x; <LOOP-START>for (int i=0; i<10; i++) { x += v[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction (foo : x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_01.cpp
#pragma omp parallel for reduction(+:x)
100
int a[N]; myInt x; for ( i = 0; i < N ; i++ ) { a[i] = i; s += i; } <LOOP-START>for ( i = 0; i < N ; i++ ) { x += a[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_13.cpp
#pragma omp parallel for reduction(merge : v2)
100
) ) int main (int argc, char* argv[]) { std::vector<int> v1(5); std::vector<int> v2(5); <LOOP-START>for (int i=0; i<5; i++) { v1 = v2; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(merge : v2)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_for_04.cpp
#pragma omp parallel for
100
fo> */ #include <assert.h> template <typename T> void f(T* t, T lower, T length, T val) { T i; <LOOP-START>for (i = lower; i < (lower + length); i++) { t[i] = val + i; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_07.cpp
#pragma omp parallel for reduction(A::plus:x)
100
int a[N]; A::myInt x; for ( i = 0; i < N ; i++ ) { a[i] = i; s += i; } <LOOP-START>for ( i = 0; i < N ; i++ ) { x += a[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(A::plus:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_collapse_01.cpp
#pragma omp parallel for collapse(2)
100
][j] == 1); } int main(int argc, char* argv[]) { int v[N][N]; { init(v); <LOOP-START>for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) v[i][j] += 1; check(v); } { init(v); #pragma omp parallel { #pragma omp for collapse(2) for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) v[i][j] += 1; } check(v); }<LOOP-END> <OMP-START>#pragma omp parallel for collapse(2)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_08.cpp
#pragma omp parallel for reduction(myInt::operator+ :x)
100
int a[N]; myInt x; for ( i = 0; i < N ; i++ ) { a[i] = i; s += i; } <LOOP-START>for ( i = 0; i < N ; i++ ) { x += a[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(myInt::operator+ :x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_for_03.cpp
#pragma omp parallel for
100
c[i] = i; } for (i=0; i < x + y; i = i + 2) { if (c[i] != i) abort(); } <LOOP-START>for (i=0; i < x + y; i = i + 2) { c[i] = 2*i; }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/cxx/success_new_udr_20.cpp
#pragma omp parallel for reduction(plus : sum)
100
zer(init(&omp_priv)) my_data_t foo(my_data_t* v, int n) { my_data_t sum; sum.my_data = 0; <LOOP-START>for (int i = 0; i < n; i++) { reducer(&sum, &v[i]); }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(plus : sum)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_for_10.c
#pragma omp parallel for firstprivate(a, b) lastprivate(a, b)
100
char *argv[]) { int b[10]; int i; a[1] = 3; a[2] = 2; b[4] = 4; b[5] = 5; <LOOP-START>for (i = 0; i < 10; i++) { a[1] = a[2]; b[4] = b[5]; }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(a, b) lastprivate(a, b)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_03.c
#pragma omp parallel for reduction(mymin:x)
100
for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else <LOOP-START>for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(mymin:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_for_05.c
#pragma omp parallel for lastprivate(a, b)
100
<stdio.h> int a; int main(int argc, char *argv[]) { int b; int i; a = 3; b = 4; <LOOP-START>for (i = 0; i < 10; i++) { a = i; b = i + 1; }<LOOP-END> <OMP-START>#pragma omp parallel for lastprivate(a, b)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_parallel_for_04.c
#pragma omp parallel for
100
estinfo> */ #ifndef __ICC #include <stdlib.h> void f(int N1, int N2, int a[N1][N2]) { int i; <LOOP-START>for (i = 0; i < N1; i++) { int j; for (j = 0; j < N2; j++) { a[i][j] = i - j; } }<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_05.c
#pragma omp parallel for reduction(mymin:x)
100
for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else <LOOP-START>for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(mymin:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_array_reduction_01.c
#pragma omp parallel for firstprivate(a) reduction(+:[ARRAY_SIZE]result)
100
Y_SIZE], int *result) { int i; for (i = 0; i < ARRAY_SIZE; i++) { result[i] = 0; } <LOOP-START>for (i = 0; i < NUM_ITEMS; i++) { int j; for (j = 0; j < ARRAY_SIZE; j++) { result[j] += a[i][j]; } }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(a) reduction(+:[ARRAY_SIZE]result)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_07.c
#pragma omp parallel for reduction(+:x)
100
struct myInt x = {0}; for ( i = 0; i < N ; i++ ) { a[i] = i; s += i; } <LOOP-START>for ( i = 0; i < N ; i++ ) { x.x += a[i]; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(+:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_04.c
#pragma omp parallel for reduction(mymin:x)
100
for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else <LOOP-START>for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(mymin:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_array_reduction_02.c
#pragma omp parallel for firstprivate(a) reduction(+:[array_size]result)
100
y_size], int *result) { int i; for (i = 0; i < array_size; i++) { result[i] = 0; } <LOOP-START>for (i = 0; i < NUM_ITEMS; i++) { int j; for (j = 0; j < array_size; j++) { result[j] += a[i][j]; } }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(a) reduction(+:[array_size]result)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_02.c
#pragma omp parallel for reduction(mymin:x)
100
for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else <LOOP-START>for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(mymin:x)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/failure_parallel_for_01.c
#pragma omp parallel for firstprivate(i)
100
fig/mercurium-omp test_compile_fail=yes test_nolink=yes </testinfo> */ int main() { int i; <LOOP-START>for (i = 0; i < 100; ++i) { }<LOOP-END> <OMP-START>#pragma omp parallel for firstprivate(i)<OMP-END>
bsc-pm/mcxx/tests/07_phases_omp.dg/common/c/success_new_udr_01.c
#pragma omp parallel for reduction(mymin:x)
100
for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else <LOOP-START>for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; }<LOOP-END> <OMP-START>#pragma omp parallel for reduction(mymin:x)<OMP-END>