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

Only call the vectorized SEFL routine for Gadget-2 SPH.

parent 3ee51c2b
No related branches found
No related tags found
No related merge requests found
...@@ -143,6 +143,8 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c, ...@@ -143,6 +143,8 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
__attribute__((always_inline)) INLINE void cache_read_particles( __attribute__((always_inline)) INLINE void cache_read_particles(
const struct cell *const ci, struct cache *const ci_cache) { const struct cell *const ci, struct cache *const ci_cache) {
#if defined(GADGET2_SPH)
/* Shift the particles positions to a local frame so single precision can be /* Shift the particles positions to a local frame so single precision can be
* used instead of double precision. */ * used instead of double precision. */
for (int i = 0; i < ci->count; i++) { for (int i = 0; i < ci->count; i++) {
...@@ -156,6 +158,8 @@ __attribute__((always_inline)) INLINE void cache_read_particles( ...@@ -156,6 +158,8 @@ __attribute__((always_inline)) INLINE void cache_read_particles(
ci_cache->vy[i] = ci->parts[i].v[1]; ci_cache->vy[i] = ci->parts[i].v[1];
ci_cache->vz[i] = ci->parts[i].v[2]; ci_cache->vz[i] = ci->parts[i].v[2];
} }
#endif
} }
#endif /* SWIFT_CACHE_H */ #endif /* SWIFT_CACHE_H */
...@@ -1095,7 +1095,7 @@ void *runner_main(void *data) { ...@@ -1095,7 +1095,7 @@ void *runner_main(void *data) {
switch (t->type) { switch (t->type) {
case task_type_self: case task_type_self:
if (t->subtype == task_subtype_density) { if (t->subtype == task_subtype_density) {
#ifdef WITH_VECTORIZATION #if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH)
runner_doself1_density_vec(r, ci); runner_doself1_density_vec(r, ci);
#else #else
runner_doself1_density(r, ci); runner_doself1_density(r, ci);
......
...@@ -600,6 +600,9 @@ int compare_values(double a, double b, double threshold, double *absDiff, ...@@ -600,6 +600,9 @@ int compare_values(double a, double b, double threshold, double *absDiff,
* @return 1 if difference found, 0 otherwise * @return 1 if difference found, 0 otherwise
*/ */
int compare_particles(struct part a, struct part b, double threshold) { int compare_particles(struct part a, struct part b, double threshold) {
#ifdef GADGET2_SPH
int result = 0; int result = 0;
double absDiff = 0.0, absSum = 0.0, relDiff = 0.0; double absDiff = 0.0, absSum = 0.0, relDiff = 0.0;
...@@ -720,6 +723,13 @@ int compare_particles(struct part a, struct part b, double threshold) { ...@@ -720,6 +723,13 @@ int compare_particles(struct part a, struct part b, double threshold) {
} }
return result; return result;
#else
error("Function not supported for this flavour of SPH");
return 0;
#endif
} }
/** @brief Computes the forces between all g-particles using the N^2 algorithm /** @brief Computes the forces between all g-particles using the N^2 algorithm
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment