Skip to content

python3Packages.torch: drop submodules in favor of Nixpkgs#239291

Draft
ConnorBaker wants to merge 10 commits intoNixOS:masterfrom
ConnorBaker:feat/torch-use-system-libs
Draft

python3Packages.torch: drop submodules in favor of Nixpkgs#239291
ConnorBaker wants to merge 10 commits intoNixOS:masterfrom
ConnorBaker:feat/torch-use-system-libs

Conversation

@ConnorBaker
Copy link
Contributor

@ConnorBaker ConnorBaker commented Jun 23, 2023

Description of changes

WARNING

This PR is stacked on #240498 and cannot be merged before it.

Closes #239211.

Warning
This is a draft in the "it doesn't work right yet" sense.

Todo:

PyTorch efforts regarding upstream CMake:

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ConnorBaker ConnorBaker added 0.kind: enhancement Add something new or improve an existing system. 6.topic: cuda Parallel computing platform and API labels Jun 23, 2023
@ConnorBaker ConnorBaker self-assigned this Jun 23, 2023
@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Jun 23, 2023
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Jun 23, 2023
@ofborg ofborg bot requested review from teh, thoughtpolice and tscholak June 23, 2023 05:27
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. ofborg-internal-error Ofborg encountered an error 8.has: clean-up This PR removes packages or removes other cruft and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. labels Jun 23, 2023
@ConnorBaker ConnorBaker force-pushed the feat/torch-use-system-libs branch 2 times, most recently from 7a1b72b to 3513293 Compare July 4, 2023 06:15
ConnorBaker pushed a commit to ConnorBaker/pytorch that referenced this pull request Jul 5, 2023
Fixes pytorch#44255.

This is part of larger work I'm doing to allow for more `USE_SYSTEM_*` options to allow Nix to have faster re-builds of PyTorch: NixOS/nixpkgs#239291.

Pull Request resolved: pytorch#104611
Approved by: https://github.com/ezyang, https://github.com/malfet
@ConnorBaker ConnorBaker force-pushed the feat/torch-use-system-libs branch from 864c0e9 to 448fb88 Compare July 5, 2023 07:21
@ConnorBaker
Copy link
Contributor Author

@Dessix as you had asked about potential ways to help with this:

The near-term goal is to be able to build libtorch separately from PyTorch. This is something upstream is interested in doing for Conda: pytorch/pytorch#93081.

Longer-term, I'd like to be able to build libtorch_cpu and libtorch_cuda separately, either independently of each other, or with libtorch_cuda depending on libtorch_cpu. Packaging-wise, that would allow us to re-use the libtorch_cpu derivation for GPU-enabled builds, or just for PyTorch directly.

If you wanted to take a look into the targets CMake supports building, and whether we're able to build libtorch_cpu and libtorch_cuda independently of each other, that would be helpful!

Alternatively, if you have any CMake experience, I'd love a second eye on the CMake PRs I've submitted upstream.

@ConnorBaker ConnorBaker force-pushed the feat/torch-use-system-libs branch from aaeaf3b to 09ea472 Compare July 10, 2023 05:56
@github-actions github-actions bot removed the 6.topic: python Python is a high-level, general-purpose programming language. label Jul 10, 2023
@ofborg ofborg bot requested a review from acairncross July 10, 2023 06:16
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels Jul 10, 2023
@ofborg ofborg bot requested a review from andersk August 22, 2023 15:19
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Aug 22, 2023
Connor Baker added 9 commits August 22, 2023 16:38
This change which involves creating multiple outputs for CUDA
redistributable packages.

We use a script to find out, ahead of time, the outputs each redist
package provides. From that, we are able to create multiple outputs for
supported redist packages, allowing users to specify exactly which
components they require.

Beyond the script which finds outputs ahead of time, there is some custom
code involved in making this happen. For example, the way Nixpkgs
typically handles multiple outputs involves making `dev` the default
output when available, and adding `out` to `dev`'s
`propagatedBuildInputs`.

Instead, we make each output independent of the others. If a user wants
only to include the headers found in a redist package, they can do so by
choosing the `dev` output. If they want to include dynamic libraries,
they can do so by specifying the `lib` output, or `static` for static
libraries.

To avoid breakages, we continue to provide the `out` output, which
becomes the union of all other outputs, effectively making the split
outputs opt-in.
@ConnorBaker ConnorBaker force-pushed the feat/torch-use-system-libs branch from 225a72a to faaf22c Compare August 23, 2023 03:20
@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 8.has: documentation This PR adds or changes documentation labels Aug 23, 2023
@ofborg ofborg bot requested review from SomeoneSerge, mdaiter and samuela August 23, 2023 03:59
@cole-h cole-h removed the ofborg-internal-error Ofborg encountered an error label Sep 21, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: enhancement Add something new or improve an existing system. 2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: cuda Parallel computing platform and API 6.topic: python Python is a high-level, general-purpose programming language. 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

python3Packages.torch: "unbundle" git submodules

5 participants