Skip to content

Add a script to compile modkit with libtorch GPU support#601

Open
SuhasSrinivasan wants to merge 5 commits intonanoporetech:masterfrom
SuhasSrinivasan:mac-compile
Open

Add a script to compile modkit with libtorch GPU support#601
SuhasSrinivasan wants to merge 5 commits intonanoporetech:masterfrom
SuhasSrinivasan:mac-compile

Conversation

@SuhasSrinivasan
Copy link

What the script does:

  1. Installs Xcode Command Line Tools
  2. Installs Homebrew package manager
  3. Installs rustup (Rust toolchain installer)
  4. Installs Rust compiler (rustc) and Cargo build tool
  5. Clones the modkit GitHub repository
  6. Checks out the latest release version
  7. Creates a Python virtual environment
  8. Installs PyTorch in the virtual environment
  9. Sets and verifies environment variables for libtorch
  10. Builds modkit with macOS GPU (MPS) support

This script has been tested with the following:
macOS Version: 26.3.1 (a)
Modkit Version: v0.6.1
Rust Version: rustc 1.90.0 (1159e78c4 2025-09-14)
Cargo Version: cargo 1.90.0 (840b83a10 2025-07-30)
Python Version: Python 3.13.11
PyTorch Version: 2.10.0

Update LD_LIBRARY_PATH export format for compatibility.
# What this script does:
#   0. Installs Xcode Command Line Tools
#   1. Installs Homebrew package manager
#   2. Installs rustup (Rust toolchain installer)
#   3. Installs Rust compiler (rustc) and Cargo build tool
#   4. Clones the modkit GitHub repository
#   5. Checks out the latest release version
#   6. Creates a Python virtual environment
#   7. Installs PyTorch in the virtual environment
#   8. Sets and verifies environment variables for libtorch
#   9. Builds modkit with macOS GPU (MPS) support
Copilot AI review requested due to automatic review settings March 23, 2026 03:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds macOS automation and minor documentation updates to support building/running modkit with PyTorch/libtorch GPU acceleration (Apple Silicon / MPS), plus a doc image fix.

Changes:

  • Add mac_compile_modkit.sh to install prerequisites, create a venv with PyTorch, set libtorch env vars, and build modkit with accelerate,tch.
  • Update open-chromatin docs to reference a new non-alpha PNG asset.
  • Improve LD_LIBRARY_PATH export in BUILD_NOTES_tch.txt to safely append without clobbering existing values.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.

File Description
mac_compile_modkit.sh New end-to-end macOS build/install script for modkit with PyTorch/libtorch + MPS support.
docs/intro_open_chromatin.html Switch referenced figure to new “no alpha” image.
docs/images/chromatin_stenciling_3_no_alpha.png Add updated image asset used by the open chromatin intro docs.
BUILD_NOTES_tch.txt Make LD_LIBRARY_PATH export append-safe (preserves existing path).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Updated installation messages and added timeout handling for Xcode Command Line Tools. Improved Homebrew path setup and ensured compatibility checks for macOS version.
@ArtRand
Copy link
Contributor

ArtRand commented Mar 23, 2026

Hello @SuhasSrinivasan thank you for this! Could you pull the documentation and image changes out into a separate PR? I can merge those immediately. I'll want to test the mac-releated scripts.

@SuhasSrinivasan
Copy link
Author

Hi @ArtRand ,

Thank you for reviewing.
The documentation changes are part of an earlier PR #593

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.

3 participants