Skip to content

feat: add PyTorch setup script for modular installation#117

Draft
cmagina wants to merge 7 commits intoredhat-et:mainfrom
cmagina:pr-03-pytorch-setup-script
Draft

feat: add PyTorch setup script for modular installation#117
cmagina wants to merge 7 commits intoredhat-et:mainfrom
cmagina:pr-03-pytorch-setup-script

Conversation

@cmagina
Copy link
Copy Markdown
Collaborator

@cmagina cmagina commented Feb 7, 2026

Summary

This PR is part 3 of 11 in the rework modernization effort. It adds the PyTorch setup script as part of the modular framework installation architecture.

Changes:

  • ✅ Add scripts/setup_torch.sh for PyTorch installation and configuration

Features:

  • Downloads PyTorch source from GitHub when not mounted as a volume
  • Installs build dependencies for PyTorch compilation
  • Supports multiple installation modes via INSTALL_TORCH environment variable:
    • source: Build from source (with auto-download if not mounted)
    • release, nightly, test: Install wheels from PyPI
    • skip: Skip PyTorch installation
  • Provides flexible configuration for different container setups

Why this change?

PyTorch is a core framework used by Triton, vLLM, and other projects. This dedicated setup script:

Testing:

Dependencies:

Related PRs:

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab46221f-d558-43bb-bf03-7db0cb98c5ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cmagina cmagina force-pushed the pr-03-pytorch-setup-script branch 2 times, most recently from 294eac2 to f61a04f Compare March 30, 2026 23:42
@cmagina cmagina requested a review from hinriksnaer March 31, 2026 13:17
@cmagina cmagina force-pushed the pr-03-pytorch-setup-script branch from 55e5a0e to 96a56df Compare April 2, 2026 17:00
Add scripts/setup_torch.sh to support PyTorch installation and
configuration within containers. This script:

- Downloads PyTorch source from GitHub when not mounted as a volume
- Installs build dependencies for PyTorch compilation
- Supports installing PyTorch wheels from PyPI (release, nightly, test)
- Provides flexible configuration via INSTALL_TORCH environment variable

The script supports multiple installation modes:
- source: Build from source (with auto-download if not mounted)
- release/nightly/test: Install wheels from PyPI
- skip: Skip PyTorch installation

This is part of the modular script architecture introduced in PR redhat-et#115.

Signed-off-by: Craig Magina <cmagina@redhat.com>
@cmagina cmagina force-pushed the pr-03-pytorch-setup-script branch from 96a56df to 67d97a4 Compare April 2, 2026 17:17
git submodule update --init --recursive

if [ -n "${TORCH_GITREF:-}" ]; then
git checkout ""
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.

looks like TORCH_GITREF might be missing here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Wow, that is quite a miss, thanks.

if [ -f requirements.txt ]; then
pip_install --group dev
pip_install mkl-static mkl-include
make triton
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.

Doesn't this cause us to install triton twice due to the preceding devinstall_triton.sh?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Those are the instructions from pytorch for installing build deps.
https://github.com/pytorch/pytorch?tab=readme-ov-file#install-dependencies

Although, re-reading the comment, that one should be left to the dev. Will remove it.

Makefile Outdated
INSTALL_NSIGHT ?=false
user_path ?=
torch_path ?=
user_path ?=
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.

double entry

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Rebase miss

Copy link
Copy Markdown
Collaborator

@hinriksnaer hinriksnaer left a comment

Choose a reason for hiding this comment

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

left a couple of comments

cmagina added 6 commits April 6, 2026 18:15
Signed-off-by: Craig Magina <cmagina@redhat.com>
Signed-off-by: Craig Magina <cmagina@redhat.com>
Signed-off-by: Craig Magina <cmagina@redhat.com>
Signed-off-by: Craig Magina <cmagina@redhat.com>
- Moved to using local variables inside install_whl cleaning up old globals from when it wasn't a function
- Fixed the devinstall_triton torch dep install to respect the user's INSTALL_TORCH

Signed-off-by: Craig Magina <cmagina@redhat.com>
Signed-off-by: Craig Magina <cmagina@redhat.com>
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.

2 participants