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

Align the tasks when allocated. Alignment set to 32 bytes.

parent e15891f8
Branches
Tags
1 merge request!238Pack the task types and re-arrange the task structure to go from 80 bytes to 64 bytes.
......@@ -763,8 +763,9 @@ void scheduler_set_unlocks(struct scheduler *s) {
t->unlock_tasks = &s->unlocks[offsets[k]];
}
#ifdef SWIFT_DEBUG_CHECKS
/* Verify that there are no duplicate unlocks. */
/* for (int k = 0; k < s->nr_tasks; k++) {
for (int k = 0; k < s->nr_tasks; k++) {
struct task *t = &s->tasks[k];
for (int i = 0; i < t->nr_unlock_tasks; i++) {
for (int j = i + 1; j < t->nr_unlock_tasks; j++) {
......@@ -772,7 +773,8 @@ void scheduler_set_unlocks(struct scheduler *s) {
error("duplicate unlock!");
}
}
} */
}
#endif
/* Clean up. */
free(counts);
......@@ -861,9 +863,11 @@ void scheduler_reset(struct scheduler *s, int size) {
if (s->tasks_ind != NULL) free(s->tasks_ind);
/* Allocate the new lists. */
if ((s->tasks = (struct task *)malloc(sizeof(struct task) * size)) ==
NULL ||
(s->tasks_ind = (int *)malloc(sizeof(int) * size)) == NULL)
if (posix_memalign((void *)&s->tasks, task_align,
size * sizeof(struct task)) != 0)
error("Failed to allocate task array.");
if ((s->tasks_ind = (int *)malloc(sizeof(int) * size)) == NULL)
error("Failed to allocate task lists.");
}
......
......@@ -29,6 +29,8 @@
#include "cell.h"
#include "cycle.h"
#define task_align 32
/**
* @brief The different task types.
*/
......@@ -103,6 +105,16 @@ struct task {
/*! Start and end time of this task */
ticks tic, toc;
#ifdef WITH_MPI
/*! Buffer for this task's communications */
void *buff;
/*! MPI request corresponding to this task */
MPI_Request req;
#endif
/*! Flags used to carry additional information (e.g. sort directions) */
int flags;
......@@ -121,16 +133,6 @@ struct task {
/*! Number of unsatisfied dependencies */
short int wait;
#ifdef WITH_MPI
/*! Buffer for this task's communications */
void *buff;
/*! MPI request corresponding to this task */
MPI_Request req;
#endif
/*! Type of the task */
enum task_types type;
......@@ -145,7 +147,8 @@ struct task {
/*! Is this task implicit (i.e. does not do anything) ? */
char implicit;
};
} __attribute__((aligned(task_align)));
/* Function prototypes. */
void task_unlock(struct task *t);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment