Skip to content
Snippets Groups Projects
Commit dfa964db authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

use random tags for cell data.

Former-commit-id: 6b2caa84daa84db5e5ec413861f1fe8bc22d6a39
parent 99d28aa4
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,7 @@ int cell_unpack ( struct pcell *pc , struct cell *c , struct space *s ) {
c->dt_min = pc->dt_min;
c->dt_max = pc->dt_max;
c->count = pc->count;
c->tag = pc->tag;
/* Fill the progeny recursively, depth-first. */
for ( k = 0 ; k < 8 ; k++ )
......@@ -175,6 +176,7 @@ int cell_pack ( struct cell *c , struct pcell *pc ) {
pc->dt_min = c->dt_min;
pc->dt_max = c->dt_max;
pc->count = c->count;
c->tag = pc->tag = rand() % (1 << 24);
/* Fill in the progeny, depth-first recursion. */
for ( k = 0 ; k < 8 ; k++ )
......
......@@ -30,9 +30,12 @@ struct pcell {
/* Number of particles in this cell. */
int count;
/* tag used for MPI communication. */
int tag;
/* Relative indices of the cell's progeny. */
int progeny[8];
};
......@@ -138,6 +141,7 @@ struct cell {
/* Pointer to this cell's packed representation. */
struct pcell *pcell;
int pcell_size;
int tag;
} __attribute__((aligned (64)));
......
......@@ -462,7 +462,7 @@ void engine_repartition ( struct engine *e ) {
void engine_addtasks_send ( struct engine *e , struct cell *ci , struct cell *cj ) {
int k, tag;
int k;
/* Check if any of the density tasks are for the target node. */
for ( k = 0 ; k < ci->nr_density ; k++ )
......@@ -473,15 +473,9 @@ void engine_addtasks_send ( struct engine *e , struct cell *ci , struct cell *cj
/* If so, attach send tasks. */
if ( k < ci->nr_density ) {
/* Compute the cell's tag. */
tag = (int)( ci->loc[0] / e->s->dim[0] * 512 ) +
((int)( ci->loc[1] / e->s->dim[1] * 512 ) << 9 ) +
((int)( ci->loc[2] / e->s->dim[2] * 512 ) << 18 );
tag = tag*2;
/* Create the tasks. */
struct task *t_xv = scheduler_addtask( &e->sched , task_type_send_xv , task_subtype_none , tag , 0 , ci , cj , 0 );
struct task *t_rho = scheduler_addtask( &e->sched , task_type_send_rho , task_subtype_none , tag + 1 , 0 , ci , cj , 0 );
struct task *t_xv = scheduler_addtask( &e->sched , task_type_send_xv , task_subtype_none , 2*ci->tag , 0 , ci , cj , 0 );
struct task *t_rho = scheduler_addtask( &e->sched , task_type_send_rho , task_subtype_none , 2*ci->tag + 1 , 0 , ci , cj , 0 );
/* The send_rho task depends on the cell's ghost task. */
task_addunlock( ci->ghost , t_rho );
......@@ -514,20 +508,14 @@ void engine_addtasks_send ( struct engine *e , struct cell *ci , struct cell *cj
void engine_addtasks_recv ( struct engine *e , struct cell *c , struct task *t_xv , struct task *t_rho ) {
int k, tag;
int k;
/* Do we need to construct a recv task? */
if ( t_xv != NULL || c->nr_density > 0 ) {
/* Compute the cell's tag. */
tag = (int)( c->loc[0] / e->s->dim[0] * 512 ) +
((int)( c->loc[1] / e->s->dim[1] * 512 ) << 9 ) +
((int)( c->loc[2] / e->s->dim[2] * 512 ) << 18 );
tag = tag*2;
/* Create the tasks. */
c->recv_xv = scheduler_addtask( &e->sched , task_type_recv_xv , task_subtype_none , tag , 0 , c , NULL , 0 );
c->recv_rho = scheduler_addtask( &e->sched , task_type_recv_rho , task_subtype_none , tag + 1 , 0 , c , NULL , 0 );
c->recv_xv = scheduler_addtask( &e->sched , task_type_recv_xv , task_subtype_none , 2*c->tag , 0 , c , NULL , 0 );
c->recv_rho = scheduler_addtask( &e->sched , task_type_recv_rho , task_subtype_none , 2*c->tag + 1 , 0 , c , NULL , 0 );
/* If there has been a higher-up recv task, then these tasks
are implicit and depend on the higher-up task. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment