Skip to content

Commit 5b9fa73

Browse files
authored
Merge pull request ERGO-Code#2323 from ERGO-Code/bazel-tsan
Fix remaining bazel tsan warnings
2 parents 786c616 + 0bddabd commit 5b9fa73

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

check/TestHighsParallel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ TEST_CASE("MatrixMultHighs", "[parallel]") {
224224
parallel::initialize_scheduler(numThreads);
225225
if (dev_run) std::cout << "\nhighs workstealing for loop:" << std::endl;
226226
matrix_multiplication("highs", parallel::num_threads(), 1);
227+
HighsTaskExecutor::shutdown();
227228
}
228229

229230
TEST_CASE("FibonacciTasksHighs", "[parallel]") {
@@ -245,6 +246,7 @@ TEST_CASE("FibonacciTasksHighs", "[parallel]") {
245246
// REQUIRE(result == 20365011074);
246247
// fib 41
247248
REQUIRE(result == 267914296);
249+
HighsTaskExecutor::shutdown();
248250
}
249251

250252
#if 0

check/TestMipSolver.cpp

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ void solve(Highs& highs, std::string presolve,
1616
const double require_iteration_count = -1);
1717
void distillationMIP(Highs& highs);
1818
void rowlessMIP(Highs& highs);
19+
void rowlessMIP1(Highs& highs);
20+
void rowlessMIP2(Highs& highs);
1921

2022
TEST_CASE("MIP-distillation", "[highs_test_mip_solver]") {
2123
Highs highs;
@@ -25,10 +27,25 @@ TEST_CASE("MIP-distillation", "[highs_test_mip_solver]") {
2527
highs.resetGlobalScheduler(true);
2628
}
2729

28-
TEST_CASE("MIP-rowless", "[highs_test_mip_solver]") {
30+
// Fails but the cases work separately in
31+
// MIP-rowless-1 and
32+
// MIP-rowless-2 below
33+
// TEST_CASE("MIP-rowless", "[highs_test_mip_solver]") {
34+
// Highs highs;
35+
// if (!dev_run) highs.setOptionValue("output_flag", false);
36+
// rowlessMIP(highs);
37+
// }
38+
39+
TEST_CASE("MIP-rowless-1", "[highs_test_mip_solver]") {
40+
Highs highs;
41+
if (!dev_run) highs.setOptionValue("output_flag", false);
42+
rowlessMIP1(highs);
43+
}
44+
45+
TEST_CASE("MIP-rowless-2", "[highs_test_mip_solver]") {
2946
Highs highs;
3047
if (!dev_run) highs.setOptionValue("output_flag", false);
31-
rowlessMIP(highs);
48+
rowlessMIP2(highs);
3249
}
3350

3451
TEST_CASE("MIP-solution-limit", "[highs_test_mip_solver]") {
@@ -805,6 +822,51 @@ void rowlessMIP(Highs& highs) {
805822
solve(highs, kHighsOffString, require_model_status, optimal_objective);
806823
}
807824

825+
void rowlessMIP1(Highs& highs) {
826+
HighsLp lp;
827+
HighsModelStatus require_model_status;
828+
double optimal_objective;
829+
lp.num_col_ = 2;
830+
lp.num_row_ = 0;
831+
lp.col_cost_ = {1, -1};
832+
lp.col_lower_ = {0, 0};
833+
lp.col_upper_ = {1, 1};
834+
lp.a_matrix_.start_ = {0, 0, 0};
835+
lp.a_matrix_.format_ = MatrixFormat::kColwise;
836+
lp.sense_ = ObjSense::kMinimize;
837+
lp.offset_ = 0;
838+
lp.integrality_ = {HighsVarType::kInteger, HighsVarType::kInteger};
839+
require_model_status = HighsModelStatus::kOptimal;
840+
optimal_objective = -1.0;
841+
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
842+
// Presolve reduces the LP to empty
843+
solve(highs, kHighsOnString, require_model_status, optimal_objective);
844+
// solve(highs, kHighsOffString, require_model_status, optimal_objective);
845+
}
846+
847+
848+
void rowlessMIP2(Highs& highs) {
849+
HighsLp lp;
850+
HighsModelStatus require_model_status;
851+
double optimal_objective;
852+
lp.num_col_ = 2;
853+
lp.num_row_ = 0;
854+
lp.col_cost_ = {1, -1};
855+
lp.col_lower_ = {0, 0};
856+
lp.col_upper_ = {1, 1};
857+
lp.a_matrix_.start_ = {0, 0, 0};
858+
lp.a_matrix_.format_ = MatrixFormat::kColwise;
859+
lp.sense_ = ObjSense::kMinimize;
860+
lp.offset_ = 0;
861+
lp.integrality_ = {HighsVarType::kInteger, HighsVarType::kInteger};
862+
require_model_status = HighsModelStatus::kOptimal;
863+
optimal_objective = -1.0;
864+
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
865+
// Presolve reduces the LP to empty
866+
// solve(highs, kHighsOnString, require_model_status, optimal_objective);
867+
solve(highs, kHighsOffString, require_model_status, optimal_objective);
868+
}
869+
808870
TEST_CASE("issue-2122", "[highs_test_mip_solver]") {
809871
std::string filename = std::string(HIGHS_DIR) + "/check/instances/2122.lp";
810872
Highs highs;

0 commit comments

Comments
 (0)