aboutsummaryrefslogtreecommitdiff
path: root/Carpet/LoopControl
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-02-09 11:09:05 -0500
committerErik Schnetter <schnetter@gmail.com>2013-02-09 11:09:05 -0500
commitb4277735d56ae023bd52bc19214d5a6280ce932f (patch)
tree9c791c2f8b7da8d1254b6a6a7b9e7a0481b29f41 /Carpet/LoopControl
parent5c504a42ef7218c2a075d4e44bc09435139ef02e (diff)
LoopControl: Share cache lines for SMT threads
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r--Carpet/LoopControl/src/loopcontrol.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc
index 50672cded..95165e754 100644
--- a/Carpet/LoopControl/src/loopcontrol.cc
+++ b/Carpet/LoopControl/src/loopcontrol.cc
@@ -465,17 +465,17 @@ void lc_control_init(lc_control_t* restrict const control,
}
// Parameters (all in units of grid points)
- // TODO: put fine threads into i direction, so that they share cache
- // lines
ptrdiff_t smt_size[LC_DIM] = { 1, 1, 1 };
{
int const num_fine_threads = get_num_fine_threads();
- if (num_fine_threads <= loopsize_j) {
+ // If possible, stagger fine threads in the i direction, so that
+ // they share cache lines
+ if (istr * num_fine_threads <= loopsize_i) {
+ smt_size[0] = num_fine_threads;
+ } else if (num_fine_threads <= loopsize_j) {
smt_size[1] = num_fine_threads;
- } else if (num_fine_threads <= loopsize_k) {
- smt_size[2] = num_fine_threads;
} else {
- smt_size[0] = num_fine_threads;
+ smt_size[2] = num_fine_threads;
}
}
ptrdiff_t const tile_size[LC_DIM] = {