diff options
author | Erik Schnetter <schnetter@gmail.com> | 2012-11-06 13:37:47 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2012-11-06 13:37:47 -0500 |
commit | 17845edc3640298238c742a51509be2423cd6373 (patch) | |
tree | 7f49be8cd76ecaee009600d1f3b76fe2a1683a04 /Carpet/CarpetMask | |
parent | 1bdb022a5dec73500986edb41ea1c8e67c6c5fc5 (diff) |
CarpetMask: Add missing OpenMP reduction clause
Diffstat (limited to 'Carpet/CarpetMask')
-rw-r--r-- | Carpet/CarpetMask/src/mask_excluded.cc | 6 | ||||
-rw-r--r-- | Carpet/CarpetMask/src/mask_surface.cc | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Carpet/CarpetMask/src/mask_excluded.cc b/Carpet/CarpetMask/src/mask_excluded.cc index aec5ffa6c..8787ef18c 100644 --- a/Carpet/CarpetMask/src/mask_excluded.cc +++ b/Carpet/CarpetMask/src/mask_excluded.cc @@ -62,7 +62,8 @@ namespace CarpetMask { bool const exterior = exclude_exterior[n]; -#pragma omp parallel + CCTK_REAL local_excised = 0.0; +#pragma omp parallel reduction (+: local_excised) CCTK_LOOP3_ALL(CarpetExcludedSetup, cctkGH, i,j,k) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); @@ -75,11 +76,12 @@ namespace CarpetMask { dx2 + dy2 + dz2 <= r2) { // Tally up the weight we are removing - * excised_cells += cell_volume * factor * BCNT(iweight[ind]); + local_excised += cell_volume * factor * BCNT(iweight[ind]); iweight[ind] = 0; } } CCTK_ENDLOOP3_ALL(CarpetExcludedSetup); + * excised_cells += local_excised; } // if r>=0 } // for n diff --git a/Carpet/CarpetMask/src/mask_surface.cc b/Carpet/CarpetMask/src/mask_surface.cc index f2a592b3c..044d1de38 100644 --- a/Carpet/CarpetMask/src/mask_surface.cc +++ b/Carpet/CarpetMask/src/mask_surface.cc @@ -129,7 +129,8 @@ namespace CarpetMask { } } -#pragma omp parallel + CCTK_REAL local_excised = 0.0; +#pragma omp parallel reduction (+: local_excised) CCTK_LOOP3_ALL(CarpetSurfaceSetup, cctkGH, i,j,k) { int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); @@ -142,7 +143,7 @@ namespace CarpetMask { if (rho < 1.0e-12) { // Always excise the surface origin // Tally up the weight we are removing - * excised_cells += cell_volume * factor * BCNT(iweight[ind]); + local_excised += cell_volume * factor * BCNT(iweight[ind]); iweight[ind] = 0; } else { CCTK_REAL theta = @@ -188,11 +189,12 @@ namespace CarpetMask { sf_radius[a + maxntheta * (b + maxnphi * sn)]; if (rho <= dr * shrink_factor) { // Tally up the weight we are removing - * excised_cells += cell_volume * factor * BCNT(iweight[ind]); + local_excised += cell_volume * factor * BCNT(iweight[ind]); iweight[ind] = 0; } } } CCTK_ENDLOOP3_ALL(CarpetSurfaceSetup); + * excised_cells += local_excised; } else { |