Skip to content

Commit 228e8b3

Browse files
allenwang28meta-codesync[bot]
authored andcommitted
Build with nightly Torch instead of the latest (#1681)
Summary: Pull Request resolved: #1681 Changes in the PyTorch C++ layer affect Monarch's tensor engine builds. Without this change, the CI builds will pick up the latest PyTorch through build-requirements.txt. This diff removes this dependency. We see this affecting #1680 Reviewed By: amirafzali Differential Revision: D85670693 fbshipit-source-id: 1de2188ac5c84271c41bf253f9a12fd2e2cd66e6
1 parent 0a088fe commit 228e8b3

File tree

6 files changed

+27
-9
lines changed

6 files changed

+27
-9
lines changed

.github/workflows/build-cpu.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ jobs:
2929
# Setup build environment (conda + system deps + rust + build deps)
3030
setup_build_environment
3131
32+
# Install torch nightly (CPU version)
33+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
34+
pip install -r build-requirements.txt
35+
3236
# Build monarch (No tensor engine, CPU version)
3337
USE_TENSOR_ENGINE=0 python setup.py bdist_wheel

.github/workflows/build-cuda.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ jobs:
3434
# Setup build environment (conda + system deps + rust + build deps)
3535
setup_build_environment
3636
37+
# Install torch nightly
38+
pip install ${{ matrix.torch-spec }}
39+
pip install -r build-requirements.txt
40+
3741
# Setup Tensor Engine
3842
setup_tensor_engine
3943

.github/workflows/test-cpu-python.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
# Disable tensor engine
3232
export USE_TENSOR_ENGINE=0
3333
34+
# Install PyTorch nightly
35+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
36+
3437
# Install the built wheel from artifact
3538
install_wheel_from_artifact
3639

.github/workflows/test-gpu-python.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
# Setup CUDA environment and library paths
4646
setup_cuda_environment
4747
48+
# Install torch nightly before installing the wheel,
49+
# so that we can test the wheel against the latest nightly
50+
pip install ${{ matrix.torch-spec }}
51+
4852
# Install the built wheel from artifact
4953
install_wheel_from_artifact
5054

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ torchmonarch-nightly is built with torch nightly.
7070

7171
### Build and Install from Source
7272

73+
If you're building Monarch from source, you should be building it with the nightly PyTorch as well for ABI compatibility.
74+
75+
7376
#### On Fedora distributions
7477

7578
```sh
@@ -87,7 +90,7 @@ rustup default nightly
8790
conda install libunwind -y
8891

8992
# Install the correct cuda and cuda-toolkit versions for your machine
90-
sudo dnf install cuda-toolkit-12-0 cuda-12-0
93+
sudo dnf install cuda-toolkit-12-8 cuda-12-8
9194

9295
# Install clang-dev and nccl-dev
9396
sudo dnf install clang-devel libnccl-devel
@@ -99,6 +102,7 @@ conda update -n monarchenv --all -c conda-forge -y
99102
sudo dnf install -y libibverbs rdma-core libmlx5 libibverbs-devel rdma-core-devel
100103

101104
# Install build dependencies
105+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128
102106
pip install -r build-requirements.txt
103107
# Install test dependencies
104108
pip install -r python/tests/requirements.txt
@@ -134,7 +138,11 @@ sudo apt install -y clang
134138
export CC=clang
135139
export CXX=clang++
136140

141+
# Install the correct cuda and cuda-toolkit versions for your machine
142+
sudo apt install -y cuda-toolkit-12-8 cuda-12-8
143+
137144
# Install build dependencies
145+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128
138146
pip install -r build-requirements.txt
139147
# Install test dependencies
140148
pip install -r python/tests/requirements.txt
@@ -153,9 +161,9 @@ pip install --no-build-isolation -e .
153161
pip list | grep monarch
154162
```
155163

156-
#### On MacOS
164+
#### On non-CUDA machines
157165

158-
You can also build Monarch to run locally on a MacOS system.
166+
You can also build Monarch to run on non-CUDA machines, e.g. locally on a MacOS system.
159167

160168
Note that this does not support tensor engine, which is tied to CUDA and RDMA (via ibverbs).
161169

@@ -172,6 +180,7 @@ rustup toolchain install nightly
172180
rustup default nightly
173181

174182
# Install build dependencies
183+
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
175184
pip install -r build-requirements.txt
176185
# Install test dependencies
177186
pip install -r python/tests/requirements.txt

scripts/common-setup.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ setup_rust_toolchain() {
4040
cargo install cargo-nextest --locked
4141
}
4242

43-
install_build_dependencies() {
44-
echo "Installing build dependencies..."
45-
pip install -r build-requirements.txt ${1:-}
46-
}
47-
4843
# Install Python test dependencies
4944
install_python_test_dependencies() {
5045
echo "Installing test dependencies..."
@@ -115,7 +110,6 @@ setup_build_environment() {
115110
setup_conda_environment "${python_version}"
116111
install_system_dependencies
117112
setup_rust_toolchain
118-
install_build_dependencies "${install_args}"
119113
}
120114

121115
# Detect and configure CUDA environment for linking

0 commit comments

Comments
 (0)