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

Code formatting

parent b9293cf9
No related branches found
No related tags found
1 merge request!398Use particle caches for the gravity P-P interactions. Ewald summation for the gravity force checks
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
#define SWIFT_CACHE_ALIGN __attribute__((aligned(SWIFT_CACHE_ALIGNMENT))) #define SWIFT_CACHE_ALIGN __attribute__((aligned(SWIFT_CACHE_ALIGNMENT)))
/** /**
* @brief Macro to tell the compiler that a given array has the specified alignment. * @brief Macro to tell the compiler that a given array has the specified
* alignment.
* *
* Note that this turns into a no-op but gives information to the compiler. * Note that this turns into a no-op but gives information to the compiler.
* *
...@@ -56,7 +57,8 @@ ...@@ -56,7 +57,8 @@
#endif #endif
/** /**
* @brief Macro to tell the compiler that a given number is 0 modulo a given size. * @brief Macro to tell the compiler that a given number is 0 modulo a given
* size.
* *
* Note that this turns into a no-op but gives information to the compiler. * Note that this turns into a no-op but gives information to the compiler.
* GCC does not have the equivalent built-in so defaults to nothing. * GCC does not have the equivalent built-in so defaults to nothing.
...@@ -65,8 +67,7 @@ ...@@ -65,8 +67,7 @@
* @param size The modulo of interest. * @param size The modulo of interest.
*/ */
#if defined(__ICC) #if defined(__ICC)
#define swift_assume_size(var, size) \ #define swift_assume_size(var, size) __assume(var % size == 0);
__assume(var % size == 0);
#else #else
#define swift_assume_size(var, size) ; #define swift_assume_size(var, size) ;
#endif #endif
......
...@@ -249,5 +249,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_nonsym( ...@@ -249,5 +249,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_nonsym(
gpi->a_grav[2] -= fdx[2]; gpi->a_grav[2] -= fdx[2];
} }
#endif /* SWIFT_DEFAULT_GRAVITY_IACT_H */ #endif /* SWIFT_DEFAULT_GRAVITY_IACT_H */
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include "../config.h" #include "../config.h"
/* Includes. */ /* Includes. */
#include "gravity_cache.h"
#include "cache.h" #include "cache.h"
#include "gravity_cache.h"
struct cell; struct cell;
struct engine; struct engine;
......
...@@ -180,16 +180,18 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -180,16 +180,18 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Check that we fit in cache */ /* Check that we fit in cache */
if (gcount_i > ci_cache->count || gcount_j > cj_cache->count) if (gcount_i > ci_cache->count || gcount_j > cj_cache->count)
error("Not enough space in the caches! gcount_i=%d gcount_j=%d", error("Not enough space in the caches! gcount_i=%d gcount_j=%d", gcount_i,
gcount_i, gcount_j); gcount_j);
/* Computed the padded counts */ /* Computed the padded counts */
const int gcount_padded_i = gcount_i - (gcount_i % VEC_SIZE) + VEC_SIZE; const int gcount_padded_i = gcount_i - (gcount_i % VEC_SIZE) + VEC_SIZE;
const int gcount_padded_j = gcount_j - (gcount_j % VEC_SIZE) + VEC_SIZE; const int gcount_padded_j = gcount_j - (gcount_j % VEC_SIZE) + VEC_SIZE;
/* Fill the caches */ /* Fill the caches */
gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i, ci_active, shift); gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i,
gravity_cache_populate_no_shift(cj_cache, gparts_j, gcount_j, gcount_padded_j, cj_active); ci_active, shift);
gravity_cache_populate_no_shift(cj_cache, gparts_j, gcount_j, gcount_padded_j,
cj_active);
/* Ok... Here we go ! */ /* Ok... Here we go ! */
...@@ -272,7 +274,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -272,7 +274,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
gparts_i[pid].num_interacted++; gparts_i[pid].num_interacted++;
#endif #endif
} }
/* Store everything back in cache */ /* Store everything back in cache */
...@@ -362,7 +363,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -362,7 +363,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
gparts_j[pjd].num_interacted++; gparts_j[pjd].num_interacted++;
#endif #endif
} }
/* Store everything back in cache */ /* Store everything back in cache */
...@@ -373,10 +373,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -373,10 +373,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
} }
/* Write back to the particles */ /* Write back to the particles */
if(ci_active) if (ci_active) gravity_cache_write_back(ci_cache, gparts_i, gcount_i);
gravity_cache_write_back(ci_cache, gparts_i, gcount_i); if (cj_active) gravity_cache_write_back(cj_cache, gparts_j, gcount_j);
if(cj_active)
gravity_cache_write_back(cj_cache, gparts_j, gcount_j);
#ifdef MATTHIEU_OLD_STUFF #ifdef MATTHIEU_OLD_STUFF
...@@ -492,7 +490,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci, ...@@ -492,7 +490,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
struct cell *cj, double shift[3]) { struct cell *cj, double shift[3]) {
/* Some constants */ /* Some constants */
const struct engine *const e = r->e; const struct engine *const e = r->e;
const struct space *s = e->s; const struct space *s = e->s;
...@@ -518,16 +515,18 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -518,16 +515,18 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Check that we fit in cache */ /* Check that we fit in cache */
if (gcount_i > ci_cache->count || gcount_j > cj_cache->count) if (gcount_i > ci_cache->count || gcount_j > cj_cache->count)
error("Not enough space in the caches! gcount_i=%d gcount_j=%d", error("Not enough space in the caches! gcount_i=%d gcount_j=%d", gcount_i,
gcount_i, gcount_j); gcount_j);
/* Computed the padded counts */ /* Computed the padded counts */
const int gcount_padded_i = gcount_i - (gcount_i % VEC_SIZE) + VEC_SIZE; const int gcount_padded_i = gcount_i - (gcount_i % VEC_SIZE) + VEC_SIZE;
const int gcount_padded_j = gcount_j - (gcount_j % VEC_SIZE) + VEC_SIZE; const int gcount_padded_j = gcount_j - (gcount_j % VEC_SIZE) + VEC_SIZE;
/* Fill the caches */ /* Fill the caches */
gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i, ci_active, shift); gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i,
gravity_cache_populate_no_shift(cj_cache, gparts_j, gcount_j, gcount_padded_j, cj_active); ci_active, shift);
gravity_cache_populate_no_shift(cj_cache, gparts_j, gcount_j, gcount_padded_j,
cj_active);
/* Ok... Here we go ! */ /* Ok... Here we go ! */
...@@ -615,7 +614,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -615,7 +614,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
gparts_i[pid].num_interacted++; gparts_i[pid].num_interacted++;
#endif #endif
} }
/* Store everything back in cache */ /* Store everything back in cache */
...@@ -710,7 +708,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -710,7 +708,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
gparts_j[pjd].num_interacted++; gparts_j[pjd].num_interacted++;
#endif #endif
} }
/* Store everything back in cache */ /* Store everything back in cache */
...@@ -721,10 +718,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci, ...@@ -721,10 +718,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
} }
/* Write back to the particles */ /* Write back to the particles */
if(ci_active) if (ci_active) gravity_cache_write_back(ci_cache, gparts_i, gcount_i);
gravity_cache_write_back(ci_cache, gparts_i, gcount_i); if (cj_active) gravity_cache_write_back(cj_cache, gparts_j, gcount_j);
if(cj_active)
gravity_cache_write_back(cj_cache, gparts_j, gcount_j);
#ifdef MATTHIEU_OLD_STUFF #ifdef MATTHIEU_OLD_STUFF
/* Some constants */ /* Some constants */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment