Skip to content

dlib: improve AVX configuration - #56786

Merged
Ma27 merged 2 commits into
NixOS:masterfrom
Ma27:dlib-avx-fixes
Mar 30, 2019
Merged

Ma27 merged 2 commits into
NixOS:masterfrom
Ma27:dlib-avx-fixes

Conversation

@Ma27

@Ma27 Ma27 commented Mar 3, 2019 •

Copy link
Copy Markdown
Member
Motivation for this change

This change aims to improve the overall situation of how AVX is used to compile DLib and its Python bindings. This PR consists of the following commits:

  • 9732c44: Adds avxSupport (true by default) to the dlib builds. If older hardware is used, DLib can be compiled without AVX.

  • 6fec5aa: Bump face_recognition to 1.2.3 and disable the check phase for now to avoid breakage on Hydra builders without AVX support. After changes, maintainers should run checkPhase locally in a nix-shell.

Please have a look at the full commit messages for more information.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Ma27
Ma27 requested a review from FRidh as a code owner March 3, 2019 14:05
@GrahamcOfBorg GrahamcOfBorg added 6.topic: python Python is a high-level, general-purpose programming language. 8.has: documentation This PR adds or changes documentation labels Mar 3, 2019
@FRidh

FRidh commented Mar 3, 2019

Copy link
Copy Markdown
Member

I don't think it's worth bothering with a having an option, since one can use overrideAttrs to modify configureFlags.

@GrahamcOfBorg GrahamcOfBorg added 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. labels Mar 3, 2019
@Ma27

Ma27 commented Mar 3, 2019

Copy link
Copy Markdown
Member Author

I don't think it's worth bothering with a having an option, since one can use overrideAttrs to modify configureFlags.

I'd prefer an explicit option though: this problem seems to be fairly common (even Hydra builders are affected), if somebody experiences such a problem, he can simply turn on the build option without knowing about details like which CMake flag to set or how to add further flags to setup.py when building python packages with Nix. IMHO we are responsible for this as maintainers.

Ma27 added 2 commits March 3, 2019 15:35
Especially older hardware doesn't support AVX instructions. DLib is
still functional there, but significantly slower[1].

By setting `avxInstructions` to false, DLib will be compiled without
this feature.

[1] http://dlib.net/compile.html
There's no git tag for 1.2.3, hence we need to pin to the corresponding
revision because we build from a git source.

After recent breakage on Hydra[1], the tests were disabled. Although
some build machines don't support AVX, we shouldn't use a DLib without
AVX as the builder's result is also used on modern machines with AVX
support. Before merging changes, maintainers should run the check phase
locally in a `nix-shell`.

[1] https://hydra.nixos.org/build/89533530
@Ma27

Ma27 commented Mar 7, 2019

Copy link
Copy Markdown
Member Author

@FRidh anything else to add from your side?
@volth thanks! I'll look into this that afternoon :)

@Ma27

Ma27 commented Mar 9, 2019

Copy link
Copy Markdown
Member Author

@FRidh anything else to add? I'd love to see this merged :)

@Ma27

Ma27 commented Mar 16, 2019

Copy link
Copy Markdown
Member Author

Ping @FRidh, I'd love to get this merged. It's not perfect, but let's merge this for now and wait for better platform feature detection. Unless I hear anything else from you, I'd merge and backport next Friday.

@Ma27

Ma27 commented Mar 30, 2019

Copy link
Copy Markdown
Member Author

Merging for now. Until we have a proper hardware feature detection implemented, this should be the best solution for now as it ensures that the package is buildable on all Hydra builders and you don't need to build it locally if i.e. a KVM is used to build dlib by Hydra.

I didn't get any further objections during the last two weeks, so this should be fine. As soon as a better detection mechanism is implemented, I'll fix dlib accordingly.

@Ma27
Ma27 merged commit 4cd107f into NixOS:master Mar 30, 2019
@Ma27
Ma27 deleted the dlib-avx-fixes branch March 30, 2019 18:20
@Ma27

Ma27 commented Mar 30, 2019

Copy link
Copy Markdown
Member Author

To ensure that nobody faces this problem on 19.03, I backported this as 6f55b04 and f32f452.

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

Labels

6.topic: python Python is a high-level, general-purpose programming language. 8.has: documentation This PR adds or changes documentation 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants