MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / reportProfiling

Method reportProfiling

highs/lp_data/HighsInterface.cpp:4501–4664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4499// assert(1==4); return 0;}
4500
4501void Highs::reportProfiling() const {
4502 if (!this->profiling_->sub_solver_) return;
4503 HighsInt num_thread = this->profiling_->numThread();
4504 double mip_time = 0;
4505 double max_sumip_time = 0;
4506 const std::vector<HighsProfilingRecord>& record = this->profiling_->record;
4507 const std::vector<HighsProfilingRecord>& submip_record =
4508 this->profiling_->submip_record;
4509 for (HighsInt thread_num = 0; thread_num < num_thread; thread_num++) {
4510 mip_time = std::max(record[thread_num].run_time[kSubSolverMip], mip_time);
4511 max_sumip_time =
4512 std::max(record[thread_num].run_time[kSubSolverSubMip], max_sumip_time);
4513 }
4514
4515 std::vector<HighsInt> used_thread;
4516 for (HighsInt thread_num = 0; thread_num < num_thread; thread_num++) {
4517 bool used = false;
4518 for (HighsInt Ix = kFromSubSolver; Ix < kToSubSolver; Ix++)
4519 if (record[thread_num].num_call[Ix]) used = true;
4520 for (HighsInt Ix = kFromSubSolver; Ix < kToSubSolver; Ix++)
4521 if (submip_record[thread_num].num_call[Ix]) used = true;
4522 if (!used) continue;
4523 used_thread.push_back(thread_num);
4524 }
4525 const double num_threads_used = used_thread.size();
4526 std::stringstream ss;
4527 std::vector<bool> mip_used_sub_solver(kToSubSolver, false);
4528 std::vector<bool> submip_used_sub_solver(kToSubSolver, false);
4529 const HighsInt to_k = max_sumip_time > 0 ? 2 : 1;
4530 const std::vector<std::string>& name = this->profiling_->name;
4531 double sum_sum_mip_sub_solve_time = 0;
4532 for (HighsInt k = 0; k < to_k; k++) {
4533 if (k == 0) {
4534 highsLogUser(options_.log_options, HighsLogType::kInfo,
4535 "\nMIP sub-solver profiling: number of threads used = %d\n",
4536 int(num_threads_used));
4537 } else {
4538 highsLogUser(options_.log_options, HighsLogType::kInfo,
4539 "\nSub-MIP sub-solver profiling\n");
4540 }
4541 for (HighsInt thread_ix = 0; thread_ix < HighsInt(num_threads_used);
4542 thread_ix++) {
4543 HighsInt thread_num = used_thread[thread_ix];
4544 double ideal_time =
4545 k == 0
4546 ? mip_time
4547 : this->profiling_->record[thread_num].run_time[kSubSolverSubMip];
4548 if (ideal_time <= 0) continue;
4549 const std::vector<HighsProfilingRecord>& record =
4550 k == 0 ? this->profiling_->record : this->profiling_->submip_record;
4551 std::vector<bool>& used_sub_solver =
4552 k == 0 ? mip_used_sub_solver : submip_used_sub_solver;
4553 const std::vector<HighsInt>& num_call = record[thread_num].num_call;
4554 const std::vector<double>& run_time = record[thread_num].run_time;
4555 ss.str(std::string());
4556 ss << highsFormatToString(
4557 "\nThread %d\n"
4558 "Solver Calls Time "

Callers 1

optimizeModelMethod · 0.95

Calls 7

highsLogUserFunction · 0.85
highsFormatToStringFunction · 0.85
numThreadMethod · 0.80
push_backMethod · 0.80
strMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected