Skip to content
Snippets Groups Projects
Commit 9ade785e authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'skinny_task' into 'master'

Pack the task types and re-arrange the task structure to go from 80 bytes to 64 bytes.



See merge request !238
parents 4dbf6d45 6d1f3277
Branches
Tags
1 merge request!238Pack the task types and re-arrange the task structure to go from 80 bytes to 64 bytes.
......@@ -764,8 +764,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++) {
......@@ -773,7 +774,8 @@ void scheduler_set_unlocks(struct scheduler *s) {
error("duplicate unlock!");
}
}
} */
}
#endif
/* Clean up. */
free(counts);
......@@ -862,9 +864,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 128
/**
* @brief The different task types.
*/
......@@ -52,7 +54,7 @@ enum task_types {
task_type_grav_up,
task_type_grav_external,
task_type_count
};
} __attribute__((packed));
/**
* @brief The different task sub-types (for pairs, selfs and sub-tasks).
......@@ -65,7 +67,7 @@ enum task_subtypes {
task_subtype_grav,
task_subtype_tend,
task_subtype_count
};
} __attribute__((packed));
/**
* @brief The type of particles/objects this task acts upon in a given cell.
......@@ -94,48 +96,48 @@ extern const char *subtaskID_names[];
*/
struct task {
/*! Type of the task */
enum task_types type;
/*! Pointers to the cells this task acts upon */
struct cell *ci, *cj;
/*! Sub-type of the task (for the tasks that have one */
enum task_subtypes subtype;
/*! List of tasks unlocked by this one */
struct task **unlock_tasks;
/*! 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;
/*! Number of unsatisfied dependencies */
int wait;
/*! Rank of a task in the order */
int rank;
/*! Weight of the task */
int weight;
/*! Pointers to the cells this task acts upon */
struct cell *ci, *cj;
/*! ID of the queue or runner owning this task */
int rid;
short int rid;
/*! Number of tasks unlocked by this one */
int nr_unlock_tasks;
/*! List of tasks unlocked by this one */
struct task **unlock_tasks;
#ifdef WITH_MPI
/*! Buffer for this task's communications */
void *buff;
short int nr_unlock_tasks;
/*! MPI request corresponding to this task */
MPI_Request req;
/*! Number of unsatisfied dependencies */
short int wait;
#endif
/*! Type of the task */
enum task_types type;
/*! Start and end time of this task */
ticks tic, toc;
/*! Sub-type of the task (for the tasks that have one */
enum task_subtypes subtype;
/*! Should the scheduler skip this task ? */
char skip;
......@@ -145,7 +147,8 @@ struct task {
/*! Is this task implicit (i.e. does not do anything) ? */
char implicit;
};
} __attribute__((aligned(32)));
/* 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