diff --git a/src/engine.c b/src/engine.c index 367993fe85ea630c68de33a3585ca46c15e6abd1..30c443226e3f2e9cdf8bb9aef61adefb9bbff948 100644 --- a/src/engine.c +++ b/src/engine.c @@ -744,7 +744,7 @@ int engine_exchange_strays ( struct engine *e , struct part *parts , struct xpar /* Wait for each part array to come in and collect the new parts from the proxies. */ for ( k = 0 ; k < 2*(nr_in + nr_out) ; k++ ) { - if ( MPI_Waitany( 2*e->nr_proxies , reqs_in , &pid , &status ) != MPI_SUCCESS ) { + if ( MPI_Waitany( 2*e->nr_proxies , reqs_in , &pid , &status ) != MPI_SUCCESS ) error( "MPI_Waitany failed." ); if ( pid == MPI_UNDEFINED ) break; diff --git a/src/scheduler.c b/src/scheduler.c index a026316077a6317d52e1bfd282873be0426020e6..64084571d7db1d16c4d373cfb522405759bb8d33 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -425,6 +425,25 @@ void scheduler_splittasks ( struct scheduler *s ) { } /* split this task? */ + /* Otherwise, break it up if it is too large? */ + else if ( scheduler_doforcesplit && ci->split && cj->split && + ( ci->count > space_maxsize && cj->count > space_maxsize ) ) { + + message( "force splitting pair with %i and %i parts." , ci->count , cj->count ); + + /* Replace the current task. */ + t->type = task_type_none; + + for ( j = 0 ; j < 8 ; j++ ) + if ( ci->progeny[j] != NULL ) + for ( k = 0 ; k < 8 ; k++ ) + if ( cj->progeny[k] != NULL ) { + t = scheduler_addtask( s , task_type_pair , t->subtype , 0 , 0 , ci->progeny[j] , cj->progeny[k] , 0 ); + t->flags = space_getsid( s->space , &t->ci , &t->cj , shift ); + } + + } + /* Otherwise, if not spilt, stitch-up the sorting. */ else { diff --git a/src/scheduler.h b/src/scheduler.h index 511e474358a1c0b5533dbf0e17b0dee1c94d8348..e7f4f3df98e058f667c9c793b1e2672c891e21a4 100644 --- a/src/scheduler.h +++ b/src/scheduler.h @@ -24,6 +24,7 @@ #define scheduler_dosub 1 #define scheduler_maxsteal 10 #define scheduler_maxtries 2 +#define scheduler_doforcesplit 1 /* Flags . */ #define scheduler_flag_none 0 diff --git a/src/space.c b/src/space.c index 99b927aa77e613b147f07f0608cbac18e0049d6d..10806d5b7b74fccffc3cc7d9d4288eb6d657a6ff 100644 --- a/src/space.c +++ b/src/space.c @@ -53,6 +53,7 @@ /* Split size. */ int space_splitsize = space_splitsize_default; int space_subsize = space_subsize_default; +int space_maxsize = space_maxsize_default; /* Map shift vector to sortlist. */ const int sortlistID[27] = { diff --git a/src/space.h b/src/space.h index 1cad653701a8af1f71272f5c39526d3e2e666f6b..1768ecefbc86e517236813d33248d8310bdf5fa4 100644 --- a/src/space.h +++ b/src/space.h @@ -25,6 +25,7 @@ #define space_cellallocchunk 1000 #define space_splitratio 0.875f #define space_splitsize_default 400 +#define space_maxsize_default 3000 #define space_subsize_default 5000 #define space_stretch 1.10f #define space_maxreldx 0.25f @@ -36,6 +37,7 @@ /* Split size. */ extern int space_splitsize; +extern int space_maxsize; extern int space_subsize; /* Map shift vector to sortlist. */ diff --git a/src/task.h b/src/task.h index 5921d88b05daaed2bf23e7658c4cdd41e473202a..c616f22a49fe5abfa6ca8c236256f2a232c04d19 100644 --- a/src/task.h +++ b/src/task.h @@ -20,7 +20,7 @@ /* Some constants. */ #define task_maxwait 3 -#define task_maxunlock 46 +#define task_maxunlock 64 /* The different task types. */