Commit a4f7feb9 authored by James Willis's avatar James Willis
Browse files

Fixed bug where max_index_i could be count_j instead of count_j - 1. Also...

Fixed bug where max_index_i could be count_j instead of count_j - 1. Also fixed bug where an exit iteration of 0 prevents the inner loop from executing.
parent 716e54cb
...@@ -289,7 +289,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( ...@@ -289,7 +289,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift; sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift;
/* Loop through particles in cell j until they are not in range of pi. */ /* Loop through particles in cell j until they are not in range of pi. */
while (temp < cj->count && first_di > sort_j[temp].d) temp++; while (temp < cj->count - 1 && first_di > sort_j[temp].d) temp++;
max_index_i[first_pi] = temp; max_index_i[first_pi] = temp;
...@@ -300,7 +300,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( ...@@ -300,7 +300,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift; const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift;
while (temp < cj->count && di > sort_j[temp].d) temp++; while (temp < cj->count - 1 && di > sort_j[temp].d) temp++;
max_index_i[i] = temp; max_index_i[i] = temp;
} }
...@@ -1170,7 +1170,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci, ...@@ -1170,7 +1170,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
vector pjx, pjy, pjz; vector pjx, pjy, pjz;
/* Loop over the parts in cj. */ /* Loop over the parts in cj. */
for (int pjd = 0; pjd < exit_iteration_align; pjd += VEC_SIZE) { for (int pjd = 0; pjd <= exit_iteration_align; pjd += VEC_SIZE) {
/* Get the cache index to the jth particle. */ /* Get the cache index to the jth particle. */
int cj_cache_idx = pjd; int cj_cache_idx = pjd;
......
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