Skip to content

opencv: misc CUDA-related updates and fixes; add enableLto#221370

Merged
samuela merged 2 commits intoNixOS:stagingfrom
ConnorBaker:feat/opencv-use-cudaPackages-staging-reland
Mar 30, 2023
Merged

opencv: misc CUDA-related updates and fixes; add enableLto#221370
samuela merged 2 commits intoNixOS:stagingfrom
ConnorBaker:feat/opencv-use-cudaPackages-staging-reland

Conversation

@ConnorBaker
Copy link
Contributor

@ConnorBaker ConnorBaker commented Mar 15, 2023

Description of changes

This is a re-land of #218044, but against staging instead of master.

  • use cudaPackages instead of cudatoolkit (reduces download/closure size)
  • set C/C++ compiler when building with CUDA to ensure NVCC has an appropriate backing compiler
  • add flag to build with CUDNN (disabled by default due to increase in closure size)
  • add flag to build with LTO (enabled by default)
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.05 Release Notes (or backporting 22.11 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.

- use cudaPackages instead of cudatoolkit (reduces download/closure size)
- set C/C++ compiler when building with CUDA to ensure NVCC has an appropriate backing compiler
- add flag to build with CUDNN (disabled by default due to increase in closure size)
- add flag to build with LTO (enabled by default)
@ConnorBaker ConnorBaker self-assigned this Mar 15, 2023
@ConnorBaker ConnorBaker added 6.topic: closure size The final size of a derivation, including its dependencies 6.topic: cuda Parallel computing platform and API labels Mar 15, 2023
@ofborg ofborg bot requested a review from basvandijk March 15, 2023 22:11
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Mar 15, 2023
@ConnorBaker
Copy link
Contributor Author

ConnorBaker commented Mar 16, 2023

Running nixpkgs-review is taking a long time and seems to be stuck building one of the last six derivations. Here's the log so far: https://gist.github.com/ConnorBaker/bb6ae8dc865672e27e3b233defca5ffa

And the failures (all of which seem unrelated):

Failed derivations

@ConnorBaker ConnorBaker marked this pull request as ready for review March 16, 2023 02:21
@ConnorBaker
Copy link
Contributor Author

Hi all,

Are there any blockers preventing this from being merged?

@samuela
Copy link
Member

samuela commented Mar 27, 2023

LGTM, @basvandijk @SomeoneSerge thoughts?

# Only clang supports thin LTO, so we must either be using clang through the stdenv,
stdenv.cc.isClang ||
# or through the backend stdenv.
(enableCuda && backendStdenv.cc.isClang)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we currently can't test this as we hard-wire cuda to gcc. H'm

@samuela samuela merged commit 2cc30d5 into NixOS:staging Mar 30, 2023
@samuela
Copy link
Member

samuela commented Mar 30, 2023

In the interest of keeping PRs moving along, I went ahead and merged! Thanks so much @ConnorBaker !

@ConnorBaker ConnorBaker deleted the feat/opencv-use-cudaPackages-staging-reland branch March 30, 2023 12:05
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-46/26872/1

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

Labels

6.topic: closure size The final size of a derivation, including its dependencies 6.topic: cuda Parallel computing platform and API 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants