Skip to content
Snippets Groups Projects
Commit fb75b0bd authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Use atomics also on the counters of interactions in the M2L function

parent 5ed9eced
No related branches found
No related tags found
1 merge request!1048Atomic gravity and time-step limiter
...@@ -1608,12 +1608,19 @@ INLINE static void gravity_M2L_apply( ...@@ -1608,12 +1608,19 @@ INLINE static void gravity_M2L_apply(
const struct potential_derivatives_M2L *pot) { const struct potential_derivatives_M2L *pot) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Count interactions */ /* Count all interactions
l_b->num_interacted += m_a->num_gpart; * Note that despite being in a section of the code protected by locks,
* we must use atomics here as the long-range task may update this
* counter in a lock-free section of code. */
accumulate_add_ll(&l_b->num_interacted, m_a->num_gpart);
#endif #endif
#ifdef SWIFT_GRAVITY_FORCE_CHECKS #ifdef SWIFT_GRAVITY_FORCE_CHECKS
l_b->num_interacted_tree += m_a->num_gpart; /* Count tree interactions
* Note that despite being in a section of the code protected by locks,
* we must use atomics here as the long-range task may update this
* counter in a lock-free section of code. */
accumulate_add_ll(&l_b->num_interacted_tree, m_a->num_gpart);
#endif #endif
/* Record that this tensor has received contributions */ /* Record that this tensor has received contributions */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment