|
1 | 1 | #include "FactorHiGHSSolver.h" |
2 | 2 |
|
| 3 | +#include <cstring> |
3 | 4 | #include <limits> |
4 | 5 |
|
5 | 6 | #include "HighsExternalApi.h" |
@@ -597,35 +598,36 @@ void FactorHiGHSSolver::setParallel() { |
597 | 598 | assert(1 == 0); |
598 | 599 |
|
599 | 600 | } else if (options_.parallel == kHighsChooseString) { |
600 | | -#ifdef HIPO_USES_APPLE_BLAS |
601 | | - // Blas on Apple do not work well with parallel_node, but parallel_tree |
602 | | - // seems to always be beneficial. |
603 | | - parallel_node = false; |
604 | | - parallel_tree = true; |
605 | | -#else |
606 | | - // Otherwise, parallel_node is active because it is triggered only if the |
607 | | - // frontal matrix is large enough anyway. |
608 | | - parallel_node = true; |
609 | | - |
610 | | - // parallel_tree instead is chosen with a heuristic |
611 | | - |
612 | | - double tree_speedup = S_.flops() / S_.critops(); |
613 | | - double sn_size = (double)S_.size() / S_.sn(); |
614 | | - |
615 | | - bool enough_sn = S_.sn() > kMinNumberSn; |
616 | | - bool enough_flops = S_.flops() > kLargeFlopsThresh; |
617 | | - bool speedup_is_large = tree_speedup > kLargeSpeedupThresh; |
618 | | - bool sn_are_large = sn_size > kLargeSnThresh; |
619 | | - bool sn_are_not_small = sn_size > kSmallSnThresh; |
620 | | - |
621 | | - // parallel_tree is active if the supernodes are large, or if there is a |
622 | | - // large expected speedup and the supernodes are not too small, provided |
623 | | - // that the number of flops and supernodes is not too small. |
624 | | - if (enough_sn && enough_flops && |
625 | | - (sn_are_large || (speedup_is_large && sn_are_not_small))) { |
| 601 | + if (strcmp(HighsExtras::blas::getInfo()->provider, "Apple Accelerate") == |
| 602 | + 0) { |
| 603 | + // Blas on Apple do not work well with parallel_node, but parallel_tree |
| 604 | + // seems to always be beneficial. |
| 605 | + parallel_node = false; |
626 | 606 | parallel_tree = true; |
| 607 | + } else { |
| 608 | + // Otherwise, parallel_node is active because it is triggered only if the |
| 609 | + // frontal matrix is large enough anyway. |
| 610 | + parallel_node = true; |
| 611 | + |
| 612 | + // parallel_tree instead is chosen with a heuristic |
| 613 | + |
| 614 | + double tree_speedup = S_.flops() / S_.critops(); |
| 615 | + double sn_size = (double)S_.size() / S_.sn(); |
| 616 | + |
| 617 | + bool enough_sn = S_.sn() > kMinNumberSn; |
| 618 | + bool enough_flops = S_.flops() > kLargeFlopsThresh; |
| 619 | + bool speedup_is_large = tree_speedup > kLargeSpeedupThresh; |
| 620 | + bool sn_are_large = sn_size > kLargeSnThresh; |
| 621 | + bool sn_are_not_small = sn_size > kSmallSnThresh; |
| 622 | + |
| 623 | + // parallel_tree is active if the supernodes are large, or if there is a |
| 624 | + // large expected speedup and the supernodes are not too small, provided |
| 625 | + // that the number of flops and supernodes is not too small. |
| 626 | + if (enough_sn && enough_flops && |
| 627 | + (sn_are_large || (speedup_is_large && sn_are_not_small))) { |
| 628 | + parallel_tree = true; |
| 629 | + } |
627 | 630 | } |
628 | | -#endif |
629 | 631 |
|
630 | 632 | // If serial memory is too large, switch off tree parallelism to avoid |
631 | 633 | // running out of memory |
|
0 commit comments