Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/git/
/.zed/


# pixi environments
.pixi
*.egg-info
pixi.lock
106 changes: 106 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[workspace]
authors = ["Hameer Abbasi <[email protected]>"]
channels = ["conda-forge"]
name = "pytorch-dev"
platforms = ["linux-64", "osx-arm64"]
version = "0.1.0"

[tasks]
build-core = { cmd = "./pytorch-build.sh", cwd = "." }
build-all = { cmd = "./torch-build.sh", cwd = "." }
update = { cmd = "./torch-update.sh", cwd = "." }
clone = { cmd = "./torch-clone.sh", cwd = "." }

[activation.env]
PYTORCH_BUILD_DIRECTORY = "${PIXI_PROJECT_ROOT}/git"
PYTORCH_PIXI_BUILD = "1"

[activation]
scripts = ["./torch-common.sh"]

[feature.freethreading.dependencies]
python = "3.13.*"
python-freethreading = "3.13.*"

[dependencies]
python = "3.9.*"

[target.linux-64.dependencies]
# These three don't have free-threading support
lldb = "*"
gdb = "*"
halide-python = "*"

[feature.core.dependencies]
pip = "*"
cpython = "*"
cmake = ">=3.27"
ninja = "*"
numpy = "*"
packaging = "*"
pkg-config = "*"
libuv = "*"
pyyaml = "*"
requests = "*"
six = "*"
typing-extensions = ">=4.10.0"
ccache = "*"
scikit-build = "*"
setuptools = ">=70.1.0,<80.0a0"
wheel = "*"
fsspec = "*"
types-dataclasses = "*"
expecttest = "*"
hypothesis = "*"
lintrunner = "*"
scipy = "*"
psutil = "*"
pytest = "*"
ghstack = "*"
ipython = "*"
pytest-sugar = "*"
pytest-xdist = "*"
filelock = "*"
sympy = "*"
astunparse = "*"
dill = "*"
jinja2 = "*"
lark = "*"
optree = "*"
tabulate = "*"
networkx = "*"
zlib = "*"
parameterized = "*"
libglib = "*"
pango = "*"
pillow = "*"

[feature.core.target.linux-64.dependencies]
gcc = "13.*"
gxx = "13.*"
clang = "*"
clangxx = "*"
magma = "*"
cuda-driver-dev = "*"
cuda-version = "12.6.*"
cudnn = "*"
conda-gcc-specs = "*"
cuda-libraries-dev = "*"
cuda-nvcc = "*"
cuda-gdb = "*"
cuda-nvtx-dev = "*"
cuda-nvml-dev = "*"
cuda-cupti-dev = "*"
mkl = "*"
mkl-include = "*"
sysroot_linux-64 = ">=2.17"

[feature.core.pypi-dependencies]
z3-solver = "*"

[environments]
default = ["default", "core"]
freethreading = { features = [
"freethreading",
"core",
], no-default-feature = true }
6 changes: 4 additions & 2 deletions pytorch-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

eval "$(conda shell.bash hook)"
conda activate ${PYTORCH_CONDA_ENV:=pytorch-dev$PYTORCH_BUILD_SUFFIX}
if ${PYTORCH_PIXI_BUILD:-0} -eq 0; then
eval "$(conda shell.bash hook)"
conda activate ${PYTORCH_CONDA_ENV:=pytorch-dev$PYTORCH_BUILD_SUFFIX}
fi
cd ${PYTORCH_BUILD_DIRECTORY:=~/git$PYTORCH_BUILD_SUFFIX}/pytorch

source $SCRIPT_DIR/torch-common.sh
Expand Down
16 changes: 8 additions & 8 deletions torch-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
set -e

SCRIPT_DIR=$( pushd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

conda env create \
-f $SCRIPT_DIR/pytorch-dev.yaml \
-n ${PYTORCH_CONDA_ENV:=pytorch-dev$PYTORCH_BUILD_SUFFIX}

conda activate ${PYTORCH_CONDA_ENV:=pytorch-dev${PYTORCH_BUILD_SUFFIX}}
echo "source $SCRIPT_DIR/torch-common.sh" > $CONDA_PREFIX/etc/conda/activate.d/activate-torch.sh
echo "source $SCRIPT_DIR/deactivate-torch-common.sh" > $CONDA_PREFIX/etc/conda/activate.d/deactivate-torch.sh
if ${PYTORCH_PIXI_BUILD:-0} -eq 0; then
conda env create \
-f $SCRIPT_DIR/pytorch-dev.yaml \
-n ${PYTORCH_CONDA_ENV:=pytorch-dev$PYTORCH_BUILD_SUFFIX}
conda activate ${PYTORCH_CONDA_ENV:=pytorch-dev${PYTORCH_BUILD_SUFFIX}}
echo "source $SCRIPT_DIR/torch-common.sh" > $CONDA_PREFIX/etc/conda/activate.d/activate-torch.sh
echo "source $SCRIPT_DIR/deactivate-torch-common.sh" > $CONDA_PREFIX/etc/conda/activate.d/deactivate-torch.sh
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

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

This is needed to make sure the environment is set up properly

Copy link
Author

@hameerabbasi hameerabbasi Jul 30, 2025

Choose a reason for hiding this comment

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

With conda, yes. But if you look at the following lines; pixi will take care of that for us. I'm calling the script inside the activation.scripts section of pixi.toml.

torch-build/pixi.toml

Lines 18 to 19 in 9634e20

[activation]
scripts = ["./torch-common.sh"]

Copy link
Member

Choose a reason for hiding this comment

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

What about deactivation?

Copy link
Author

@hameerabbasi hameerabbasi Jul 30, 2025

Choose a reason for hiding this comment

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

Pixi tasks are generally run under a new shell process with pixi shell or pixi run instead of in the same process. Thus the deactivation cleanup isn't needed. One CAN use the same shell with eval "$(pixi shell-hook)", but that's a fringe use-case.

fi

popd