Skip to content

Added sub-solver timers to hmw-mt#2966

Merged
jajhall merged 53 commits intohmw-mtfrom
hmw-mt-timer
Apr 13, 2026
Merged

Added sub-solver timers to hmw-mt#2966
jajhall merged 53 commits intohmw-mtfrom
hmw-mt-timer

Conversation

@jajhall
Copy link
Copy Markdown
Member

@jajhall jajhall commented Apr 11, 2026

The sub-solver timers - sub-MIPs, and LP solves (primal/dual simplex with/without basis and IPM) - are now multi-threaded.

They are now (necessarily) built on common memory for recording sub-solver timing data across all threads that's passed down via a pointer. Hence the calls to Highs::setGlobalSubSolverCallTime whenever a new Highs instance is created - either explicitly, or by creating a HighsLpRelaxation instance.

I had to develop the multi-threaded sub-solver timers in a branch thread-mip-timer of latest, and then merge them into hmw-mt-timer - which is a branch of the most recent hmw-mt.

This PR merges hmw-mt-timer into hmw-mt so that @Opt-Mucca can see what's changed in the MIP solver. Of course, this does mean that a whole bunch of changes in latest are merged in, too, but that's not a bad thing!

The changes in highs/mip are mainly simplifications of what was there before - when sub-solver data from one level was added in to data at the higher level. All that has gone now that common memory is passed around

In the course of this, I created Highs::initializeGlobalScheduler(); to call highs::parallel::initialize_scheduler(this->options_.threads); (and perform some subsequent error checking and logging) rather than do it with duplicated code in two places. I also needed to add my own stuff.

Currently the sub-solver timing data are always logged - for ease of development. Normally it is dependent on this->options_.log_dev_level > 0

The more detailed timing of MIP computational components will be done the same way, but I wanted to get this working first.

Julian Hall and others added 30 commits March 17, 2026 16:19
…way to converting hessian to square in issue-2821
…t conversion to square Hessian and passing it via Highs::passHessian
…alysis and calling setup before mipsolver.run()
…lobal_sub_solver_call_time_ into HiGHS.h so that any Highs instance can work with the sub_solver_call_time_ member from a root Highs instance
@jajhall jajhall requested a review from Opt-Mucca April 11, 2026 16:13
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 86.10568% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.18%. Comparing base (dc108e6) to head (9b5e292).
⚠️ Report is 54 commits behind head on hmw-mt.

Files with missing lines Patch % Lines
highs/mip/HighsMipAnalysis.cpp 0.00% 41 Missing ⚠️
highs/lp_data/Highs.cpp 84.78% 7 Missing ⚠️
highs/lp_data/HighsInterface.cpp 96.37% 7 Missing ⚠️
check/TestCheckSolution.cpp 66.66% 6 Missing ⚠️
highs/mip/HighsMipSolverData.cpp 45.45% 6 Missing ⚠️
highs/mip/MipTimer.h 0.00% 2 Missing ⚠️
highs/model/HighsHessian.cpp 95.74% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           hmw-mt    #2966      +/-   ##
==========================================
- Coverage   81.42%   81.18%   -0.25%     
==========================================
  Files         361      361              
  Lines       89621    89801     +180     
==========================================
- Hits        72976    72903      -73     
- Misses      16645    16898     +253     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Opt-Mucca
Copy link
Copy Markdown
Collaborator

@jajhall will review this sometime today!

Copy link
Copy Markdown
Collaborator

@Opt-Mucca Opt-Mucca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @jajhall ! I've made some minor comments (assuming the printf statements will all be removed at some later point). Am a big fan of this abstracting away the + / - changes for run times in the middle of the MIP code.
Do you want to keep this on the separate branch for now, or merge it and finish it directly on hmw-mt?

Comment thread check/TestMipSolver.cpp
#endif
}

/*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this test now commented out?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because it's testing consistency between the subsolver times and the corresponding times in the MIP profiling - which isn't working at present.

I should have a unit test for the sub-solver timing for code coverage

for (HighsInt thread_ix = 0; thread_ix < HighsInt(num_threads_used);
thread_ix++) {
if (totalPct[thread_ix]) {
ss << highsFormatToString(" %5.1f", totalPct[thread_ix]);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great breakdown! (Did not consider printing results per thread)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I view this as a way to see how many threads are being used, and to what activity.

clock_name.c_str());
}
mip_clocks.timer_pointer_->stop(highs_timer_clock);
HighsInt local_thread_id = 0; // highs::parallel::thread_num();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment a TODO?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there's a lot of incomplete code for the MIP profiling

@jajhall
Copy link
Copy Markdown
Member Author

jajhall commented Apr 13, 2026

Looks good @jajhall ! I've made some minor comments (assuming the printf statements will all be removed at some later point). Am a big fan of this abstracting away the + / - changes for run times in the middle of the MIP code. Do you want to keep this on the separate branch for now, or merge it and finish it directly on hmw-mt?

Since I'm on the right track, I'll improve let's merge it. I'll do the MIP profiling later on a separate branch

@jajhall jajhall merged commit 412be8e into hmw-mt Apr 13, 2026
371 of 372 checks passed
@jajhall jajhall deleted the hmw-mt-timer branch April 13, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants