@@ -172,19 +172,21 @@ void Factorise::processSupernode(Int sn) {
172172 // Assemble frontal matrix for supernode sn, perform partial factorisation and
173173 // store the result.
174174
175+ highs::parallel::TaskGroup tg;
176+
175177 if (flag_stop_) return ;
176178
177179 if (S_.parTree ()) {
178180 // spawn children of this supernode in reverse order
179181 Int child_to_spawn = first_child_reverse_[sn];
180182 while (child_to_spawn != -1 ) {
181- highs::parallel:: spawn ([=]() { processSupernode (child_to_spawn); });
183+ tg. spawn ([=]() { processSupernode (child_to_spawn); });
182184 child_to_spawn = next_child_reverse_[child_to_spawn];
183185 }
184186
185187 // wait for first child to finish, before starting the parent (if there is a
186188 // first child)
187- if (first_child_reverse_[sn] != -1 ) highs::parallel:: sync ();
189+ if (first_child_reverse_[sn] != -1 ) tg. sync ();
188190 }
189191
190192#if HIPO_TIMING_LEVEL >= 2
@@ -240,7 +242,7 @@ void Factorise::processSupernode(Int sn) {
240242
241243 if (S_.parTree ()) {
242244 // sync with spawned child, apart from the first one
243- if (child_sn != first_child_[sn]) highs::parallel:: sync ();
245+ if (child_sn != first_child_[sn]) tg. sync ();
244246
245247 if (flag_stop_) return ;
246248
@@ -356,6 +358,8 @@ bool Factorise::run(Numeric& num) {
356358 Clock clock;
357359#endif
358360
361+ highs::parallel::TaskGroup tg;
362+
359363 total_reg_.assign (n_, 0.0 );
360364
361365 // allocate space
@@ -372,15 +376,13 @@ bool Factorise::run(Numeric& num) {
372376 // spawn tasks for root supernodes
373377 for (Int sn = 0 ; sn < S_.sn (); ++sn) {
374378 if (S_.snParent (sn) == -1 ) {
375- highs::parallel:: spawn ([=]() { processSupernode (sn); });
379+ tg. spawn ([=]() { processSupernode (sn); });
376380 ++spawned_roots;
377381 }
378382 }
379383
380384 // sync tasks for root supernodes
381- for (Int root = 0 ; root < spawned_roots; ++root) {
382- highs::parallel::sync ();
383- }
385+ tg.taskWait ();
384386 } else {
385387 // go through each supernode serially
386388 for (Int sn = 0 ; sn < S_.sn (); ++sn) {
0 commit comments