Skip to content

python3Packages.warp-lang: fix CUDA build#419750

Merged
ConnorBaker merged 1 commit intoNixOS:masterfrom
ConnorBaker:fix/python3Packages-warp-lang-cuda-build
Jun 27, 2025
Merged

python3Packages.warp-lang: fix CUDA build#419750
ConnorBaker merged 1 commit intoNixOS:masterfrom
ConnorBaker:fix/python3Packages-warp-lang-cuda-build

Conversation

@ConnorBaker
Copy link
Contributor

@ConnorBaker ConnorBaker commented Jun 25, 2025

Most of these changes were taken from https://github.com/ConnorBaker/cuda-packages/blob/2fc8ba8c37acee427a94cdd1def55c2ec701ad82/pkgs/development/python-modules/warp/default.nix#L56-L65.

I confirmed that I was able to build all variants and run all passthru.tests on my NixOS desktop with an NVIDIA GPU.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@ConnorBaker ConnorBaker requested a review from yzx9 June 25, 2025 01:27
@ConnorBaker ConnorBaker self-assigned this Jun 25, 2025
@ConnorBaker ConnorBaker added the 6.topic: cuda Parallel computing platform and API label Jun 25, 2025
@ConnorBaker ConnorBaker moved this from New to 🏗 In progress in CUDA Team Jun 25, 2025
@ConnorBaker
Copy link
Contributor Author

CC @yzx9 this is a WIP PR where I'm trying to fix the CUDA build. Currently it's failing with an error that makes me think the wrong version of libmathdx is vendored -- I remember seeing something similar when I was packaging warp, and had to use an earlier version: https://github.com/ConnorBaker/cuda-packages/blob/2fc8ba8c37acee427a94cdd1def55c2ec701ad82/pkgs/development/cuda-modules/packages/libmathdx.nix.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: python Python is a high-level, general-purpose programming language. and removed 6.topic: cuda Parallel computing platform and API labels Jun 25, 2025
@ConnorBaker
Copy link
Contributor Author

It looks like the version of libmathdx used is too new: https://github.com/NVIDIA/warp/blob/v1.7.2.post1/deps/libmathdx-deps.packman.xml

@ConnorBaker ConnorBaker force-pushed the fix/python3Packages-warp-lang-cuda-build branch from cdee0f7 to 96233a1 Compare June 25, 2025 22:35
@ConnorBaker ConnorBaker marked this pull request as ready for review June 25, 2025 22:36
@ConnorBaker ConnorBaker moved this from 🏗 In progress to 👀 Awaits reviews in CUDA Team Jun 25, 2025
Copy link
Contributor

@yzx9 yzx9 left a comment

Choose a reason for hiding this comment

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

Thanks for the great work! I just have a few nits.

BTW, it looks like I still have a lot to learn about CUDA in Nix. Are there any good resources or documentation you’d recommend?

Copy link
Contributor

Choose a reason for hiding this comment

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

It’s good practice not to reference the package itself directly, as the test should respect overrides.

Suggested change
warp-lang
finalAttrs.finalPackage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! But, the Python wrappers around mkDerivation don't accept fixed-points or extensions as arguments, only plain attribute sets. That's why you don't see any called with finalAttrs: { ... } -- they mostly use rec (which effectively breaks overriding attributes).

There have been multiple attempts in the past to support this functionality (most recently with the introduction of lib.customisation.extendMkDerivation: #234651).

Unfortunately, that hasn't been adopted by the python packaging yet: see #379602 and #271387.

And so we wait...

@yzx9
Copy link
Contributor

yzx9 commented Jun 26, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 419750
Commit: 96233a176d483c5b1f2dbdd553ad6922b8fce1fa


x86_64-linux

✅ 4 packages built:
  • python312Packages.warp-lang
  • python312Packages.warp-lang.dist
  • python313Packages.warp-lang
  • python313Packages.warp-lang.dist

aarch64-darwin

✅ 4 packages built:
  • python312Packages.warp-lang
  • python312Packages.warp-lang.dist
  • python313Packages.warp-lang
  • python313Packages.warp-lang.dist

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Jun 26, 2025
@yzx9
Copy link
Contributor

yzx9 commented Jun 26, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 419750 --extra-nixpkgs-config '{ cudaSupport = true; }' --package python3Packages.warp-lang.passthru.tests
Commit: 96233a176d483c5b1f2dbdd553ad6922b8fce1fa


x86_64-linux

✅ 3 packages built:
  • python3Packages.warp-lang.passthru.tests.cpu
  • python3Packages.warp-lang.passthru.tests.cuda.cudaOnly
  • python3Packages.warp-lang.passthru.tests.cuda.cudaWithLibmathDx

The update script was removed given the dependency on libmathdx, which is not easily updated.

Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
@ConnorBaker ConnorBaker force-pushed the fix/python3Packages-warp-lang-cuda-build branch from 96233a1 to e5d0d6c Compare June 27, 2025 15:14
@ConnorBaker
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 419750 --extra-nixpkgs-config '{ allowUnfree = true; cudaSupport = true; cudaCapabilities = [ "8.9" ]; }'
Commit: e5d0d6ca5761a85effc2a4602ceff57070b1ff63


x86_64-linux

✅ 4 packages built:
  • python312Packages.warp-lang
  • python312Packages.warp-lang.dist
  • python313Packages.warp-lang
  • python313Packages.warp-lang.dist

aarch64-linux

✅ 4 packages built:
  • python312Packages.warp-lang
  • python312Packages.warp-lang.dist
  • python313Packages.warp-lang
  • python313Packages.warp-lang.dist

@ConnorBaker ConnorBaker added the 6.topic: cuda Parallel computing platform and API label Jun 27, 2025
@ConnorBaker ConnorBaker moved this from 👀 Awaits reviews to 🔖 Awaits the merge in CUDA Team Jun 27, 2025
@ConnorBaker
Copy link
Contributor Author

Thanks for the great work! I just have a few nits.

BTW, it looks like I still have a lot to learn about CUDA in Nix. Are there any good resources or documentation you’d recommend?

Unfortunately, not really :(

Lack of documentation has long been one of the pain points facing the CUDA packaging in Nixpkgs. Most of what I (and I assume the other CUDA maintainers) know about the packaging comes from a combination of having written it, reviewed it, or read through the implementation while trying to debug it.

Making matters worse, most of the larger projects (OpenCV, PyTorch, ONNX, etc.) are far off and away from the packaging happy path because they involve multiple languages, build systems, and wrappers around those build systems (e.g., Bash build scripts which wrap Python build scripts which wrap CMake).

Most recently, @SomeoneSerge and myself have been trying to rewrite the way the package set is created and updated to make it more maintainable, as well as more extensible for out-of-tree users. I've also been focusing on cleaning up the re-packaging of NVIDIA's binary archives and the setup hooks which underpin most of our package discovery and propagation. As part of that work, I've been trying to write documentation (https://github.com/ConnorBaker/cuda-packages/tree/main/pkgs/development/cuda-modules and https://github.com/ConnorBaker/cuda-packages/blob/main/doc/language-frameworks/cuda.section.md) but it's exhausting, regularly a very low priority, and hard to keep up to date or accurate (for example, most of what's there now is incorrect with respect to what exist in the repo, much less what exists here in Nixpkgs).

All that said, we'd love to have more people involved with Nixpkgs and CUDA -- please feel free to join us in the CUDA matrix channel: https://matrix.to/#/#cuda:nixos.org

@ConnorBaker ConnorBaker merged commit c0874d9 into NixOS:master Jun 27, 2025
30 of 32 checks passed
@github-project-automation github-project-automation bot moved this from 🔖 Awaits the merge to ✅ Done in CUDA Team Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cuda Parallel computing platform and API 6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants