@@ -194,16 +194,16 @@ void Factorise::processSupernode(Int sn, const bool should_parallelise) {
194194 spawn (first_child_[sn], tg, false );
195195 do_parallelise = false ;
196196 } else {
197- // spawn children of this supernode in reverse order
198- Int child_to_spawn = first_child_reverse_ [sn];
197+ // spawn children of this supernode in forward order
198+ Int child_to_spawn = first_child_ [sn];
199199 while (child_to_spawn != -1 ) {
200200 spawn (child_to_spawn, tg);
201- child_to_spawn = next_child_reverse_ [child_to_spawn];
201+ child_to_spawn = next_child_ [child_to_spawn];
202202 }
203203
204204 // wait for first child to finish, before starting the parent (if there is
205205 // a first child)
206- if (first_child_reverse_[sn] != -1 ) sync (first_child_ [sn], tg);
206+ if (first_child_reverse_[sn] != -1 ) sync (first_child_reverse_ [sn], tg);
207207 }
208208 }
209209
@@ -255,28 +255,20 @@ void Factorise::processSupernode(Int sn, const bool should_parallelise) {
255255 // ===================================================
256256 // Assemble frontal matrices of children
257257 // ===================================================
258- Int child_sn = first_child_[sn];
259- if (serial) child_sn = first_child_reverse_[sn];
260-
258+ Int child_sn = first_child_reverse_[sn];
261259 while (child_sn != -1 ) {
262260 // Child contribution is found:
263261 // - in cliquestack, if we are processing the tree in serial.
264262 // - in schur_contribution_ if we are processing the tree in parallel.
265- // Children are summed:
266- // - in reverse order in serial, so that the correct child is found on top
267- // of the CliqueStack.
268- // - in forward order otherwise, so that if a small subtree is synced, and
269- // it is not the first in its group, it will already have synced when it
270- // is needed.
271-
272- const double * child_clique;
263+ // Children are summed always in reverse order.
273264
274265 if (do_parallelise) {
275266 // sync with spawned child, apart from the first one
276- if (child_sn != first_child_ [sn]) sync (child_sn, tg);
267+ if (child_sn != first_child_reverse_ [sn]) sync (child_sn, tg);
277268 if (flag_stop_.load (std::memory_order_relaxed)) return ;
278269 }
279270
271+ const double * child_clique;
280272 if (!serial) {
281273 child_clique = schur_contribution_[child_sn].data ();
282274 if (!child_clique) {
@@ -341,10 +333,7 @@ void Factorise::processSupernode(Int sn, const bool should_parallelise) {
341333 }
342334
343335 // move on to the next child
344- if (!serial)
345- child_sn = next_child_[child_sn];
346- else
347- child_sn = next_child_reverse_[child_sn];
336+ child_sn = next_child_reverse_[child_sn];
348337 }
349338
350339 if (flag_stop_.load (std::memory_order_relaxed)) return ;
0 commit comments