diff --git a/src/align.h b/src/align.h index 84e2909c0866c18f0f8378df9d0efc8d0f6545b5..915af33e6e2ba59be1a0849c4de0e2f1bd5b0d96 100644 --- a/src/align.h +++ b/src/align.h @@ -19,9 +19,13 @@ #ifndef SWIFT_ALIGN_H #define SWIFT_ALIGN_H +/** + * @brief The default struct alignment in SWIFT. + */ +#define SWIFT_STRUCT_ALIGNMENT 32 /** * @brief Defines alignment of structures */ -#define SWIFT_STRUCT_ALIGN __attribute__((aligned(32))) +#define SWIFT_STRUCT_ALIGN __attribute__((aligned(SWIFT_STRUCT_ALIGNMENT))) #endif /* SWIFT_ALIGN_H */ diff --git a/src/debug.c b/src/debug.c index 48572df7f046944613d2598b0d340e949ad3ab7e..21f539b62eef3b0b36f52520486f1e725abc0cda 100644 --- a/src/debug.c +++ b/src/debug.c @@ -227,21 +227,21 @@ int checkCellhdxmax(const struct cell *c, int *depth) { if (c->h_max != h_max) { message("%d Inconsistent h_max: cell %f != parts %f", *depth, c->h_max, h_max); - message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); + error("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); result = 0; } if (c->dx_max != dx_max) { message("%d Inconsistent dx_max: %f != %f", *depth, c->dx_max, dx_max); - message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); + error("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); result = 0; } /* Check rebuild criterion. */ - if (h_max > c->dmin) { + /* if (h_max > c->dmin) { message("%d Inconsistent c->dmin: %f > %f", *depth, h_max, c->dmin); - message("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); + error("location: %f %f %f", c->loc[0], c->loc[1], c->loc[2]); result = 0; - } + } */ return result; } diff --git a/src/proxy.c b/src/proxy.c index 764448faa35c31036da017c158717e06f8c4da3d..e68fe9cb3ad23956d3d3c012573b0af6047c1904 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -102,7 +102,7 @@ void proxy_cells_exch2(struct proxy *p) { /* Re-allocate the pcell_in buffer. */ if (p->pcells_in != NULL) free(p->pcells_in); - if (posix_memalign((void **)p->pcells_in, SWIFT_STRUCT_ALIGNMENT, + if (posix_memalign((void **)&p->pcells_in, SWIFT_STRUCT_ALIGNMENT, sizeof(struct pcell) * p->size_pcells_in) != 0) error("Failed to allocate pcell_in buffer."); diff --git a/src/queue.h b/src/queue.h index c0a2fb1da6e6e3cbea813a0ef53841084ab0f933..951a3e5a056d7ad0c3935f98341a0d93c805e3ad 100644 --- a/src/queue.h +++ b/src/queue.h @@ -30,6 +30,7 @@ #define queue_sizegrow 2 #define queue_search_window 8 #define queue_incoming_size 1024 +#define queue_struct_align 64 /* Counters. */ enum { @@ -57,7 +58,7 @@ struct queue { int *tid_incoming; volatile unsigned int first_incoming, last_incoming, count_incoming; -} __attribute__((aligned(64))); +} __attribute__((aligned(queue_struct_align))); /* Function prototypes. */ struct task *queue_gettask(struct queue *q, const struct task *prev, diff --git a/src/scheduler.c b/src/scheduler.c index df50f8525529d734abde5128ef75bef955d73f55..a96a5923d7e65f9536953b06ba0ccb4ce8b814b6 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1413,8 +1413,8 @@ void scheduler_init(struct scheduler *s, struct space *space, int nr_tasks, lock_init(&s->lock); /* Allocate the queues. */ - if ((s->queues = (struct queue *)malloc(sizeof(struct queue) * nr_queues)) == - NULL) + if (posix_memalign((void **)&s->queues, queue_struct_align, + sizeof(struct queue) * nr_queues) != 0) error("Failed to allocate queues."); /* Initialize each queue. */