Skip to content

Throttle OpenMP stress tests to 2 threads for CRAN (#3, part 2/2) - #5

Merged
mattfidler merged 1 commit into
mainfrom
issue-3-part2
Oct 27, 2026
Merged

mattfidler merged 1 commit into
mainfrom
issue-3-part2

Conversation

@mattfidler

Copy link
Copy Markdown
Member

Part 2 of 2 for #3, stacked on #4 (base: issue-3).

Problem

CRAN's check log showed OMP: Warning #96: Cannot form a team with 8 threads, using 2 instead.: test-c-objfun-threadsafety.R asked trust_openmp_stress_test() for 8 threads, and the helpers capped only at omp_get_max_threads(), not at OMP_THREAD_LIMIT.

Fix

  • The test now requests 2 threads (the most CRAN allows, and still enough to exercise concurrency).
  • trust_openmp_stress_test() and solver_openmp_stress_test() also cap at omp_get_thread_limit(), so the runtime never has to shrink the team.
  • NEWS entry.

Verification

With a clang/libomp build and OMP_THREAD_LIMIT=2 OMP_NUM_THREADS=8, the warning reproduces on part 1 and is gone here, even when 8 threads are requested; 2 distinct threads are still used. devtools::test(): 293 pass.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.00%. Comparing base (c73d2a8) to head (c9ba9bc).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
+ Coverage   91.80%   92.00%   +0.20%     
==========================================
  Files          26       26              
  Lines        3917     3916       -1     
==========================================
+ Hits         3596     3603       +7     
+ Misses        321      313       -8     

☔ 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.

@mattfidler
mattfidler added this pull request to stack #6 October 27, 2026 21:01
Base automatically changed from issue-3 to main October 27, 2026 21:02
The trust stress test asked for 8 threads; under CRAN's OMP_THREAD_LIMIT=2
libomp warned 'Cannot form a team with 8 threads'. Request 2 threads and
cap both stress helpers at omp_get_thread_limit() (#3).
@mattfidler
mattfidler merged commit 70a7e10 into main Oct 27, 2026
7 checks passed
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.

1 participant