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

Merge branch 'disable_cache' into 'master'

Disable particle cache when vectorisation is disabled.



See merge request !337
parents 6079a299 da254a51
......@@ -34,6 +34,7 @@
#define C2_CACHE_SIZE (NUM_VEC_PROC * VEC_SIZE * 6) + (NUM_VEC_PROC * VEC_SIZE)
#define C2_CACHE_ALIGN sizeof(float) * VEC_SIZE
#ifdef WITH_VECTORIZATION
/* Cache struct to hold a local copy of a cells' particle
* properties required for density/force calculations.*/
struct cache {
......@@ -433,4 +434,6 @@ static INLINE void cache_clean(struct cache *c) {
}
}
#endif /* WITH_VECTORIZATION */
#endif /* SWIFT_CACHE_H */
......@@ -4264,11 +4264,13 @@ void engine_init(struct engine *e, struct space *s,
e->runners[k].qid = k * nr_queues / e->nr_threads;
}
#ifdef WITH_VECTORIZATION
/* Allocate particle caches. */
e->runners[k].ci_cache.count = 0;
e->runners[k].cj_cache.count = 0;
cache_init(&e->runners[k].ci_cache, CACHE_SIZE);
cache_init(&e->runners[k].cj_cache, CACHE_SIZE);
#endif
if (verbose) {
if (with_aff)
......@@ -4355,8 +4357,10 @@ void engine_compute_next_snapshot_time(struct engine *e) {
*/
void engine_clean(struct engine *e) {
#ifdef WITH_VECTORIZATION
for (int i = 0; i < e->nr_threads; ++i) cache_clean(&e->runners[i].ci_cache);
for (int i = 0; i < e->nr_threads; ++i) cache_clean(&e->runners[i].cj_cache);
#endif
free(e->runners);
free(e->snapshotUnits);
free(e->links);
......
......@@ -49,11 +49,13 @@ struct runner {
/*! The engine owing this runner. */
struct engine *e;
#ifdef WITH_VECTORIZATION
/*! The particle cache of cell ci. */
struct cache ci_cache;
/*! The particle cache of cell cj. */
struct cache cj_cache;
#endif
};
/* Function prototypes. */
......
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