@@ -378,37 +378,47 @@ void Factorise::spawn(Int sn, const TaskGroupSpecial& tg, bool do_spawn) {
378378 // immediately. This avoids the overhead of spawning a task if a supernode has
379379 // a single child.
380380
381- const NodeData* data = S_ .treeSplitting ().find (sn);
381+ if (S_ .useSplitting ()) {
382+ const NodeData* data = S_ .treeSplitting ().find (sn);
382383
383- if (!data) {
384- // sn is head of small subtree, but not the first subtree in the group.
385- // It is processed in another task.
386- return ;
387- }
384+ if (!data) {
385+ // sn is head of small subtree, but not the first subtree in the group.
386+ // It is processed in another task.
387+ return ;
388+ }
388389
389- if (data->type == NodeType::single) {
390- // sn is single node; run only that
391- auto f = [this , sn]() { processSupernode (sn, true ); };
390+ if (data->type == NodeType::single) {
391+ // sn is single node; run only that
392+ auto f = [this , sn]() { processSupernode (sn, true ); };
392393
393- if (do_spawn)
394- tg.spawn (std::move (f));
395- else
396- f ();
394+ if (do_spawn)
395+ tg.spawn (std::move (f));
396+ else
397+ f ();
397398
398- } else {
399- // sn is head of the first subtree in a group of small subtrees; run all
400- // of them
401-
402- auto f = [this , data]() {
403- for (Int i = 0 ; i < data->group .size (); ++i) {
404- Int st_head = data->group [i];
405- Int start = data->firstdesc [i];
406- Int end = st_head + 1 ;
407- for (Int sn = start; sn < end; ++sn) {
408- processSupernode (sn, false );
399+ } else {
400+ // sn is head of the first subtree in a group of small subtrees; run all
401+ // of them
402+
403+ auto f = [this , data]() {
404+ for (Int i = 0 ; i < data->group .size (); ++i) {
405+ Int st_head = data->group [i];
406+ Int start = data->firstdesc [i];
407+ Int end = st_head + 1 ;
408+ for (Int sn = start; sn < end; ++sn) {
409+ processSupernode (sn, false );
410+ }
409411 }
410- }
411- };
412+ };
413+
414+ if (do_spawn)
415+ tg.spawn (std::move (f));
416+ else
417+ f ();
418+ }
419+
420+ } else {
421+ auto f = [this , sn]() { processSupernode (sn, true ); };
412422
413423 if (do_spawn)
414424 tg.spawn (std::move (f));
@@ -420,7 +430,12 @@ void Factorise::spawn(Int sn, const TaskGroupSpecial& tg, bool do_spawn) {
420430void Factorise::sync (Int sn, const TaskGroupSpecial& tg) {
421431 // If spawn(sn,tg) created a task, then sync it.
422432 // This happens only if sn is found in the treeSplitting data structure.
423- if (S_ .treeSplitting ().belong (sn)) tg.sync ();
433+
434+ if (S_ .useSplitting ()) {
435+ if (S_ .treeSplitting ().belong (sn)) tg.sync ();
436+ } else {
437+ tg.sync ();
438+ }
424439}
425440
426441bool Factorise::run (Numeric& num) {
0 commit comments