diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-10-05 13:47:06 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:45:11 +0000 |
commit | ab5f214316eb015f5508bf4f527d342c23009709 (patch) | |
tree | fc75e780b4e58b6bf12fd199b3f364b2e959d567 /Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc | |
parent | e7a09f1868e5a4d9403fe579a857da338bae93a2 (diff) |
CarpetLib: Improve OpenMP parallelisation
Ensure that there is exactly one OpenMP parallelisation for each
operator.
Improve the prolongation operator parallellisation method by splitting
along the direction of longest extent, not always in the z direction.
Use LoopControl for copy, restriction, and time interpolation
operators instead of explicit OpenMP directives.
Diffstat (limited to 'Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc')
-rw-r--r-- | Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc b/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc index 729bb20b5..c1dad8e27 100644 --- a/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc +++ b/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc @@ -6,6 +6,8 @@ #include <cctk.h> #include <cctk_Parameters.h> +#include <loopcontrol.h> + #include "operator_prototypes_3d.hh" #include "typeprops.hh" @@ -163,33 +165,31 @@ namespace CarpetLib { // Loop over region -#pragma omp parallel for - for (int k=0; k<regkext; ++k) { - for (int j=0; j<regjext; ++j) { - for (int i=0; i<regiext; ++i) { - - T const s1 = src1 [SRCIND3(i, j, k)]; - T const s2 = src2 [SRCIND3(i, j, k)]; - T const s3 = src3 [SRCIND3(i, j, k)]; - - // 3-point interpolation - T d = s1fac3 * s1 + s2fac3 * s2 + s3fac3 * s3; - - // If the 3-point interpolation leads to a new extremum, - // fall back to 2-point interpolation instead - if (d > max3 (s1, s2, s3) or d < min3 (s1, s2, s3)) { - if (use_12) { - d = s1fac2_12 * s1 + s2fac2_12 * s2; - } else { - d = s2fac2_23 * s2 + s3fac2_23 * s3; - } - } - - dst [DSTIND3(i, j, k)] = d; - +#pragma omp parallel + LC_LOOP3 (interpolate_end_3d_3tl, + i,j,k, 0,0,0, regiext,regjext,regkext, regiext,regjext,regkext) + { + + T const s1 = src1 [SRCIND3(i, j, k)]; + T const s2 = src2 [SRCIND3(i, j, k)]; + T const s3 = src3 [SRCIND3(i, j, k)]; + + // 3-point interpolation + T d = s1fac3 * s1 + s2fac3 * s2 + s3fac3 * s3; + + // If the 3-point interpolation leads to a new extremum, + // fall back to 2-point interpolation instead + if (d > max3 (s1, s2, s3) or d < min3 (s1, s2, s3)) { + if (use_12) { + d = s1fac2_12 * s1 + s2fac2_12 * s2; + } else { + d = s2fac2_23 * s2 + s3fac2_23 * s3; } } - } + + dst [DSTIND3(i, j, k)] = d; + + } LC_ENDLOOP3(interpolate_end_3d_3tl); } |