Commit b35e5126 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Prevent floating point excetion involving the padded gravity caches

parent 33bbf9ff
......@@ -131,7 +131,7 @@ static INLINE void gravity_cache_init(struct gravity_cache *c, int count) {
*/
__attribute__((always_inline)) INLINE void gravity_cache_populate(
struct gravity_cache *c, const struct gpart *restrict gparts, int gcount,
int gcount_padded, const double shift[3]) {
int gcount_padded, const double shift[3], const struct cell *cell) {
/* Make the compiler understand we are in happy vectorization land */
float *restrict x = c->x;
......@@ -161,9 +161,9 @@ __attribute__((always_inline)) INLINE void gravity_cache_populate(
/* Pad the caches */
for (int i = gcount; i < gcount_padded; ++i) {
x[i] = 0.f;
y[i] = 0.f;
z[i] = 0.f;
x[i] = -3.f * cell->width[0];
y[i] = -3.f * cell->width[0];
z[i] = -3.f * cell->width[0];
epsilon[i] = 0.f;
m[i] = 0.f;
}
......
......@@ -194,9 +194,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i,
loc_mean);
loc_mean, ci);
gravity_cache_populate(cj_cache, gparts_j, gcount_j, gcount_padded_j,
loc_mean);
loc_mean, cj);
/* Ok... Here we go ! */
......@@ -542,9 +542,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate(ci_cache, gparts_i, gcount_i, gcount_padded_i,
loc_mean);
loc_mean, ci);
gravity_cache_populate(cj_cache, gparts_j, gcount_j, gcount_padded_j,
loc_mean);
loc_mean, cj);
/* Ok... Here we go ! */
......@@ -941,7 +941,7 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) {
/* Computed the padded counts */
const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE;
gravity_cache_populate(ci_cache, gparts, gcount, gcount_padded, loc);
gravity_cache_populate(ci_cache, gparts, gcount, gcount_padded, loc, c);
/* Ok... Here we go ! */
......@@ -1155,7 +1155,7 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) {
/* Computed the padded counts */
const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE;
gravity_cache_populate(ci_cache, gparts, gcount, gcount_padded, loc);
gravity_cache_populate(ci_cache, gparts, gcount, gcount_padded, loc, c);
/* Ok... Here we go ! */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment