Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cuda: make cudatoolkit & cudnn packages overrideable #72826

Merged
merged 2 commits into from Nov 26, 2019

Conversation

andir
Copy link
Member

@andir andir commented Nov 5, 2019

Motivation for this change

I currently need to override some aspects of a specific cudatoolkit and cudnn packages. The current mechanism doesn't allow overriding any of the dependencies. By adding a cudaPackages and cudnnPackages attribute we are at least able to override the inputs of those packages and pick packages from the resulting attribute set as needed.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@knedlsepp
Copy link
Member

I'm interested in how you would now override stuff. Maybe a short example in the commit message?

@andir
Copy link
Member Author

andir commented Nov 5, 2019

I'm interested in how you would now override stuff. Maybe a short example in the commit message?

What I've done in a local repo today was:

{
  nixpkgs.overlays = [
    (self: super: { inherit (super.callPackage (super.path + "/pkgs/…/cudatoolkit") {
        addOpenGLRunpath =;
     }) cudatoolkit_10; })
  ];
}

The probably ugliest part about this is that super.path has to be used and I've to re-import the package definition. Ideally each of the derivations would allow overriding.

Instead of the above super.path hack you can now do:

{
  nixpkgs.overlays = [
    (self: super: { inherit (super.cudatoolkitPackages.override {
        addOpenGLRunpath =;
     }) cudatoolkit_10; })
  ];
}

Ideally we would be able to override each package. That is something I will work on in the next days once the more pressuring work has been done.

This has the benefit of being able to override all the inputs to the
build where you were previously only able to override the entire package
set (if at all).
@andir
Copy link
Member Author

andir commented Nov 26, 2019

@knedlsepp I did the overridable changes for cudaPackages. Does that look good to you? I am going to do the same for cudnn as soon as you confirm that it is okay-ish :)

@gilligan
Copy link
Contributor

That's useful! LGTM

@andir
Copy link
Member Author

andir commented Nov 26, 2019

Looking at cudnn it actually looks fine already. I am merging this in as it.

@andir andir merged commit e38f83c into NixOS:master Nov 26, 2019
@andir andir deleted the cudapackages branch November 26, 2019 12:11
@eadwu
Copy link
Member

eadwu commented Nov 28, 2019

Getting a build error

builder for '/nix/store/88l0mjgisahp4qrpymwm5nzal07iykdz-cudatoolkit-10.1.243.drv' failed with exit code 1; last 3 log lines:
  unpacking sources
  Creating directory pkg
  /nix/store/whpnlfj79vd8p175rp1bwg0x7wz5lmj1-stdenv-linux/setup: line 1301: cd: pkg/run_files: No such file or directory

@knedlsepp
Copy link
Member

knedlsepp commented Nov 28, 2019

Just saw that also. All the conditionals on the cuda-version were removed from the common.nix file. I'm sorry that I didn't review this PR before.
This should probably be reverted. @andir Could you push a revert and then we'll look into fixing it up again?

@andir
Copy link
Member Author

andir commented Nov 28, 2019

Thanks. I am sorry. I just pushed a revert: 464ff0a

Will look into the issue now and open another PR.

@andir
Copy link
Member Author

andir commented Nov 28, 2019

Looks like I lost a few changes during the rebase. I have an updated branch and will open a PR once the local builds are successful.

@knedlsepp
Copy link
Member

Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants