Skip to content

Commit 26eba55

Browse files
committed
Node parallelism off for subtrees
1 parent 393a115 commit 26eba55

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

highs/ipm/hipo/factorhighs/Factorise.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,13 @@ void Factorise::processSupernode(Int sn, bool parallelise) {
195195

196196
if (flag_stop_) return;
197197

198-
if (parallelise) {
198+
bool do_parallelise = parallelise;
199+
200+
if (do_parallelise) {
199201
// if there is only one child, do not parallelise
200202
if (first_child_[sn] != -1 && next_child_[first_child_[sn]] == -1) {
201203
spawnNode(first_child_[sn], tg, false);
202-
parallelise = false;
204+
do_parallelise = false;
203205
} else {
204206
// spawn children of this supernode in reverse order
205207
Int child_to_spawn = first_child_reverse_[sn];
@@ -266,7 +268,7 @@ void Factorise::processSupernode(Int sn, bool parallelise) {
266268
// Schur contribution of the current child
267269
std::vector<double>& child_clique = schur_contribution_[child_sn];
268270

269-
if (parallelise) {
271+
if (do_parallelise) {
270272
// sync with spawned child, apart from the first one
271273
if (child_sn != first_child_[sn]) syncNode(child_sn, tg);
272274

@@ -351,7 +353,10 @@ void Factorise::processSupernode(Int sn, bool parallelise) {
351353
// const double reg_thresh = max_diag_ * kDynamicDiagCoeff;
352354
const double reg_thresh = A_norm1_ * kDynamicDiagCoeff;
353355

354-
if (Int flag = FH->denseFactorise(reg_thresh)) {
356+
// Node-level parallelism is off if in a subtree
357+
bool node_parallel = parallelise && S_.parNode();
358+
359+
if (Int flag = FH->denseFactorise(reg_thresh, node_parallel)) {
355360
flag_stop_ = true;
356361

357362
if (log_ && flag == kRetInvalidInput)

highs/ipm/hipo/factorhighs/FormatHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class FormatHandler {
8080
Int j) = 0;
8181
virtual void assembleClique(const std::vector<double>& child, Int nc,
8282
Int child_sn) = 0;
83-
virtual Int denseFactorise(double reg_thresh) = 0;
83+
virtual Int denseFactorise(double reg_thresh, bool parallelise) = 0;
8484

8585
// =================================================================
8686
// Virtual functions.

highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void HybridHybridFormatHandler::assembleFrontalMultiple(
5757
&frontal_[diag_start_[block] + ii + ldb * jj], 1, data_);
5858
}
5959

60-
Int HybridHybridFormatHandler::denseFactorise(double reg_thresh) {
60+
Int HybridHybridFormatHandler::denseFactorise(double reg_thresh,
61+
bool parallelise) {
6162
Int status;
6263

6364
status = denseFactFP2FH(frontal_.data(), ldf_, sn_size_, nb_, data_);
@@ -70,7 +71,7 @@ Int HybridHybridFormatHandler::denseFactorise(double reg_thresh) {
7071
status = denseFactFH('H', ldf_, sn_size_, S_->blockSize(), frontal_.data(),
7172
clique_.data(), pivot_sign, reg_thresh, regul_,
7273
local_reg_.data(), swaps_.data(), pivot_2x2_.data(),
73-
S_->parNode(), data_);
74+
parallelise, data_);
7475

7576
return status;
7677
}

highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class HybridHybridFormatHandler : public FormatHandler {
1616
void assembleFrontalMultiple(Int num, const std::vector<double>& child,
1717
Int nc, Int child_sn, Int row, Int col, Int i,
1818
Int j) override;
19-
Int denseFactorise(double reg_thresh) override;
19+
Int denseFactorise(double reg_thresh, bool parallelise) override;
2020
void assembleClique(const std::vector<double>& child, Int nc,
2121
Int child_sn) override;
2222
void extremeEntries() override;

0 commit comments

Comments
 (0)