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

Define a constant for the cell memory allocation alignment.

parent 12e4a201
......@@ -44,6 +44,8 @@ struct space;
* The maximum was lowered by a further factor of 2 to be on the safe side.*/
#define cell_max_tag (1 << 29)
#define cell_align 32
/* Global variables. */
extern int cell_next_tag;
......@@ -198,7 +200,7 @@ struct cell {
#endif
} __attribute__((aligned(64)));
} __attribute__((aligned(cell_align)));
/* Convert cell location to ID. */
#define cell_getid(cdim, i, j, k) \
......
......@@ -3126,7 +3126,7 @@ void engine_init(struct engine *e, struct space *s,
e->timeStep = 0.;
e->timeBase = 0.;
e->timeBase_inv = 0.;
e->drift_all = 0;
e->drift_all = (policy & engine_policy_drift_all);
e->internalUnits = internal_units;
e->timeFirstSnapshot =
parser_get_param_double(params, "Snapshots:time_first");
......
......@@ -272,7 +272,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
/* Allocate the highest level of cells. */
s->tot_cells = s->nr_cells = cdim[0] * cdim[1] * cdim[2];
if (posix_memalign((void *)&s->cells, 64,
if (posix_memalign((void *)&s->cells, cell_align,
s->nr_cells * sizeof(struct cell)) != 0)
error("Failed to allocate cells.");
bzero(s->cells, s->nr_cells * sizeof(struct cell));
......@@ -1406,7 +1406,7 @@ struct cell *space_getcell(struct space *s) {
/* Is the buffer empty? */
if (s->cells_new == NULL) {
if (posix_memalign((void *)&s->cells_new, 64,
if (posix_memalign((void *)&s->cells_new, cell_align,
space_cellallocchunk * sizeof(struct cell)) != 0)
error("Failed to allocate more cells.");
bzero(s->cells_new, space_cellallocchunk * sizeof(struct cell));
......
Markdown is supported
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