Skip to content

Commit

Permalink
False sharing solution
Browse files Browse the repository at this point in the history
  • Loading branch information
romaf5 committed Oct 27, 2024
1 parent 37d8c7d commit 85f5ace
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion labs/memory_bound/false_sharing_1/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ std::size_t solution(const std::vector<uint32_t> &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<uint32_t> value = 0;
alignas(64) std::atomic<uint32_t> value = 0;
};
std::vector<Accumulator> accumulators(thread_count);

Expand Down

0 comments on commit 85f5ace

Please sign in to comment.