diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-02-05 19:07:30 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 18:25:56 +0000 |
commit | a07cadd784da30a965b51134e59be37f7481e3d2 (patch) | |
tree | 6db5628637b8da9804d4706cf0933b812d85941c /Carpet/LoopControl | |
parent | 979282f7e7fc8a2373408b24519f2362a7f7d605 (diff) |
LoopControl: Align inner loop boundaries with vector sizes, if vectorisation is used
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol.c | 7 | ||||
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol.h | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/Carpet/LoopControl/src/loopcontrol.c b/Carpet/LoopControl/src/loopcontrol.c index 8ca8c693d..a21aa860c 100644 --- a/Carpet/LoopControl/src/loopcontrol.c +++ b/Carpet/LoopControl/src/loopcontrol.c @@ -898,10 +898,10 @@ lc_control_init (lc_control_t * restrict const lc, /*** Tilings ****************************************************************/ /* Tiling loop settings */ - lc->iimin = lc->iii; + lc->iimin = ci == 0 ? lc->iii : lc_align (lc->iii, lc->di); lc->jjmin = lc->jjj; lc->kkmin = lc->kkk; - lc->iimax = lc_min (lc->iii + lc->iiistep, lc->iiimax); + lc->iimax = lc_min (lc_align (lc->iii + lc->iiistep, lc->di), lc->iiimax); lc->jjmax = lc_min (lc->jjj + lc->jjjstep, lc->jjjmax); lc->kkmax = lc_min (lc->kkk + lc->kkkstep, lc->kkkmax); lc->iistep = lt->inpoints; @@ -921,7 +921,8 @@ lc_control_init (lc_control_t * restrict const lc, lc->iiii = cii; lc->jjjj = cjj; lc->kkkk = ckk; - lc->iiiistep = (lc->iistep + lt->inithreads - 1) / lt->inithreads; + lc->iiiistep = + lc_align ((lc->iistep + lt->inithreads - 1) / lt->inithreads, lc->di); lc->jjjjstep = (lc->jjstep + lt->jnithreads - 1) / lt->jnithreads; lc->kkkkstep = (lc->kkstep + lt->knithreads - 1) / lt->knithreads; lc->iiiimin = lc->iiii * lc->iiiistep; diff --git a/Carpet/LoopControl/src/loopcontrol.h b/Carpet/LoopControl/src/loopcontrol.h index f405f6878..635d71128 100644 --- a/Carpet/LoopControl/src/loopcontrol.h +++ b/Carpet/LoopControl/src/loopcontrol.h @@ -269,6 +269,18 @@ lc_max (int const i, int const j) return i > j ? i : j; } +/* Align by shifting to the right if necessary */ +static inline +int +lc_align (int const i, int const di) + CCTK_ATTRIBUTE_CONST; +static inline +int +lc_align (int const i, int const di) +{ + return (i + di - 1) / di * di; +} + void |