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

The particle-multipole interactions can now also be created as tasks.

parent 14252fc0
No related branches found
No related tags found
No related merge requests found
......@@ -38,14 +38,14 @@
/* Some local constants. */
#define cell_pool_grow 1000
#define cell_maxparts 100
#define task_limit 1e10
#define task_limit 1
#define const_G 1 // 6.6738e-8
#define dist_min 0.5 /* Used for legacy walk only */
#define dist_cutoff_ratio 1.5
#define ICHECK -10000000
#define SANITY_CHECKS
#define NO_COM_AS_TASK
#define COM_AS_TASK
#define COUNTERS
/** Data structure for the particles. */
......@@ -103,7 +103,7 @@ struct cell {
enum task_type {
task_type_self = 0,
task_type_pair,
task_type_self_pc,
task_type_pair_pc,
task_type_com,
task_type_count
};
......@@ -939,6 +939,33 @@ void create_tasks(struct qsched *s, struct cell *ci, struct cell *cj) {
/* Are the cells NOT neighbours ? */
if (!are_neighbours(ci, cj)) {
/* We can do particle-monopole tasks */
/* Create the task. */
data[0] = ci;
data[1] = cj;
tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data,
sizeof(struct cell *) * 2, ci->count);
/* Add the resource and dependance */
qsched_addlock(s, tid, ci->res);
#ifdef COM_AS_TASK
qsched_addunlock(s, cj->com_tid, tid);
#endif
/* Create the other task. */
data[1] = ci;
data[0] = cj;
tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data,
sizeof(struct cell *) * 2, cj->count);
/* Add the resource and dependance */
qsched_addlock(s, tid, cj->res);
#ifdef COM_AS_TASK
qsched_addunlock(s, ci->com_tid, tid);
#endif
} else {/* Cells are direct neighbours */
/* Are both cells split and we are above the task limit ? */
......@@ -1253,8 +1280,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
case task_type_pair:
iact_pair(d[0], d[1]);
break;
case task_type_self_pc:
//iact_self_pc(d[0], d[1], NULL);
case task_type_pair_pc:
iact_pair_pc(d[0], d[1]);
break;
case task_type_com:
comp_com(d[0]);
......@@ -1392,13 +1419,12 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
/* root->parts[ICHECK].a_legacy[0], root->parts[ICHECK].a_legacy[1], */
/* root->parts[ICHECK].a_legacy[2]); */
/* #endif */
printf("task counts: [ %8s %8s %8s %8s %8s ]\n", "self", "pair", "m-poles",
printf("task counts: [ %10s %10s %10s %10s %10s ]\n", "self", "pair", "m-poles",
"direct", "CoMs");
printf("task counts: [ %8i %8i %8i %8i %8i ] (legacy).\n", 0, 0,
printf("task counts: [ %10i %10i %10i %10i %10i ] (legacy).\n", 0, 0,
countMultipoles, countPairs, countCoMs);
printf("task counts: [ ");
for (k = 0; k < task_type_count; k++) printf("%8i ", counts[k]);
printf("] (new).\n");
printf("task counts: [ %10i %10i %10i %10i %10i ] (legacy).\n", counts[0],
counts[1], counts[2], 0, counts[3]);
/* Loop over the number of runs. */
for (k = 0; k < runs; k++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment