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

TheanoWithCuda: cudnn shouldn't be optional #26263

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

twhitehead
Copy link
Contributor

Motivation for this change

The propagatedBuildInputs contained optional (cudnn != null) [ cudnn ]. As optional wraps its arguement in a list (optionals is intended for lists not optional) this changes propagatedBuildInputs into a nested list.

For the package itself, this appears to have no effect. The nested list is flattened and it produces the exact same derivation. When used with withPackages, however, nested values do not get flattened. Instead they are just silently dropped.

Before this change

fgrep -q cudnn  $(nix-instantiate -E '(import ./. {}).python27Packages.TheanoWithCuda' && echo present || echo not present
present
fgrep -q cudnn  $(nix-instantiate -E '(import ./. {}).python27.withPackages (ppkgs: [ppkgs.TheanoWithCuda])') && echo present || echo not present
not present

After this change

fgrep -q cudnn  $(nix-instantiate -E '(import ./. {}).python27Packages.TheanoWithCuda' && echo present || echo not present
present
fgrep -q cudnn  $(nix-instantiate -E '(import ./. {}).python27.withPackages (ppkgs: [ppkgs.TheanoWithCuda])') && echo present || echo not present
present
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@twhitehead, thanks for your PR! By analyzing the history of the files in this pull request, we identified @artuuge and @FRidh to be potential reviewers.

@@ -56,7 +56,7 @@ buildPythonPackage rec {
pycuda
cudatoolkit
libgpuarray
] ++ (stdenv.lib.optional (cudnn != null) [ cudnn ]);
] ++ (stdenv.lib.optional (cudnn != null) cudnn);
Copy link
Member

Choose a reason for hiding this comment

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

Why would cudnn be optional? I think there's no reason and it should simply be added to the list, unconditionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why it would have been optional. From the blame history it seems that is just how @artuuge wrote it in the original commit. I can certainly adjust the pull to just include it unconditionally.

* python27.withPackages drops nested propagatedBuildInputs
* not clear why cudnn was optional to begin with
@twhitehead
Copy link
Contributor Author

@FRidh I've updated it to just include cudnn unconditionally now. I was pretty trivial, so I haven't personally tested it yet. Presumably the Travis CI system will do that.

@FRidh FRidh changed the title TheanoWithCuda: cudnn isn't added to python environment due to use of optional with a list TheanoWithCuda: cudnn shouldn't be optional Jun 2, 2017
@FRidh FRidh merged commit 474be6f into NixOS:master Jun 2, 2017
@twhitehead twhitehead deleted the theano-cuda-cudnn branch June 14, 2017 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants