From 85f5aced56bc7e52c4104f0ce21c1351024565f0 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 27 Oct 2024 01:03:20 -0700 Subject: [PATCH] False sharing solution --- labs/memory_bound/false_sharing_1/solution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/memory_bound/false_sharing_1/solution.cpp b/labs/memory_bound/false_sharing_1/solution.cpp index c01aba9e..3cddfc2c 100644 --- a/labs/memory_bound/false_sharing_1/solution.cpp +++ b/labs/memory_bound/false_sharing_1/solution.cpp @@ -9,7 +9,7 @@ std::size_t solution(const std::vector &data, int thread_count) { // memory location into a register. This way we ensure that the store // to `target` stays inside the loop. struct Accumulator { - std::atomic value = 0; + alignas(64) std::atomic value = 0; }; std::vector accumulators(thread_count);