← Back to Pull requests

[pytorch] Bundle libgomp.so.1 into Linux wheels #10447

Open
unknown opened this pull request with 197 lines diff across 2 files
View on GitHub
unknown unknown commented on Dec 03, 2026 02:36 UTC
Author

Motivation

torch_cpu links against the system libgomp (OpenMP runtime), but it isn't guaranteed to be present on the machine running the wheel. Upstream PyTorch bundles libgomp into its manylinux wheels via its repair_wheel.py. Mirror that here by copying it into torch/lib before the wheel is built, the same way copy_msvc_libomp_to_torch_lib already bundles libomp140 for Windows.

Fixes #9809

Technical Details

Locate libgomp.so.1 from hardcoded path /usr/lib64/libgomp.so.1 (verified in the build image), fallback to ldconfig -p when the hardcoded path does not exist.

Copies libgomp.so.1 into torch/lib before the wheel is built.

Test Plan

  • python3 -c "import ast; ast.parse(open('external-builds/pytorch/build_prod_wheels.py').read())" and python3 -m py_compile external-builds/pytorch/build_prod_wheels.py

  • CI build and artifact check.
  • Test Result

  • Syntax checks pass

  • https://github.com/ROCm/TheRock/actions/runs/47021556502/job/143964870057?pr=10447 Linux PyTorch build success, confirmed Copying libgomp from '/usr/lib64/libgomp.so.1' to '/__w/TheRock/TheRock/external-builds/pytorch/pytorch/torch/lib' in log

  • Verified the artifact wheel has libgomp.so.1 under torch/lib and import torch works on a fresh ubuntu:24.04 container
  • Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/CONTRIBUTING.md.
  • Diff: 197 lines (+147 / -50) across 2 files Reviewer: ScottTodd Review duration: 2311m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.36) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 197 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.316
    Real PR Conversation Timeline
    1 comments
    "Review active on #10447"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.6% · Safe to merge
    20.6%
    Repository