Skip to content

Fix #3708 - #3743

Merged
galabovaa merged 4 commits into
latestfrom
sysfs
Nov 19, 2026
Merged

galabovaa merged 4 commits into
latestfrom
sysfs

Conversation

@galabovaa

@galabovaa galabovaa commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Since v1.16, every Highs::run() called available_core_count(). On Linux that function opens two sysfs files per CPU. With the default threads=0 it ran twice per run, and once more per MIP solve. Each time, the result was either unused or used only for a log line that wasn't printed.

This PR skips those calls:

  • initialize_scheduler(): compute the default thread count only if the scheduler isn't already running. A running scheduler ignores the count anyway.
  • Highs::initializeMultiThreading(): compute the core count only when dev logging is on.
  • MIP "Thread count" log line: compute the core count only when output_flag is on.

When logging is on, the output is unchanged. The declaration of available_core_count() now warns not to call it per solve.

I chose this over the caching patch suggested in the issue because it adds no global state. On the issue's repro the two perform the same.

Timings (issue's 2×2 LP repro, Linux, 22 CPUs, median of 7 interleaved runs):

v1.15.1 before after
threads=1 32.6 us 137.5 us 28.2 us
threads=0 (default) 43.6 us 252.0 us 32.1 us

Checklist

  • I have read the contributing guidelines
  • This PR targets the latest branch
  • Tests are passing
  • Documentation was updated where relevant
  • This PR is not primarily AI-generated (per the AI contributions policy in CONTRIBUTING.md)

Comment thread highs/lp_data/Highs.cpp Resolved
Comment thread highs/mip/HighsMipSolverData.cpp Resolved
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.85%. Comparing base (e8340d3) to head (dcf8061).
⚠️ Report is 22 commits behind head on latest.

Files with missing lines Patch % Lines
highs/lp_data/Highs.cpp 71.42% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           latest    #3743   +/-   ##
=======================================
  Coverage   75.84%   75.85%           
=======================================
  Files         461      461           
  Lines      115554   115588   +34     
  Branches    18055    18059    +4     
=======================================
+ Hits        87646    87677   +31     
- Misses      27668    27671    +3     
  Partials      240      240           

☔ View full report in Codecov by Harness.
📢 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.

@jajhall jajhall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very minor simplifications, otherwise this is fine

@galabovaa
galabovaa merged commit f33563c into latest Nov 19, 2026
575 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants