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

jax: init at 0.2.19, jaxlib: init at 0.1.71 #134894

Merged
merged 7 commits into from
Sep 9, 2021

Conversation

samuela
Copy link
Member

@samuela samuela commented Aug 19, 2021

Motivation for this change

Packaging of the JAX (https://github.com/google/jax) library. JAX is a modern framework for differentiable programming. The jax package uses jaxlib as it's "backend". Currently only the CPU backend running on x86_64-linux is packaged.

TODO, unfinished items left to future PRs:

  • Fix jnp.array([1, 2, 3]).
  • Run the jax test suite.
  • GPU backend support
  • TPU backend support
  • Fix the build on macOS. Currently segfaults when running the test suite.

Useful resources:

Things done

Created derivations for the jax and jaxlib python packages.

  • 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 packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 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.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/help-packaging-jax/14613/1

@samuela
Copy link
Member Author

samuela commented Aug 20, 2021

On my (outdated) linux machine I'm getting:

>>> import jax
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/994kvxz1n7qch3zn8gfxi9wdd7nkzlm7-python3.9-jax-0.2.19/lib/python3.9/site-packages/jax/__init__.py", line 37, in <module>
    from . import config as _config_module
  File "/nix/store/994kvxz1n7qch3zn8gfxi9wdd7nkzlm7-python3.9-jax-0.2.19/lib/python3.9/site-packages/jax/config.py", line 18, in <module>
    from jax._src.config import config
  File "/nix/store/994kvxz1n7qch3zn8gfxi9wdd7nkzlm7-python3.9-jax-0.2.19/lib/python3.9/site-packages/jax/_src/config.py", line 27, in <module>
    from jax import lib
  File "/nix/store/994kvxz1n7qch3zn8gfxi9wdd7nkzlm7-python3.9-jax-0.2.19/lib/python3.9/site-packages/jax/lib/__init__.py", line 71, in <module>
    cpu_feature_guard.check_cpu_features()
RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.

So it may be worth considering building jaxlib from source but honestly that also sounds like a PITA.

@samuela
Copy link
Member Author

samuela commented Aug 20, 2021

Attempted to use autoPatchelfHook in the building of jaxlib in 59d6dd2. Not sure that it's working however: https://discourse.nixos.org/t/autopatchelfhook-not-patching-all-dependencies/14634/2.

@SuperSandro2000 Thanks for reviewing! I'll start incorporating your suggestions once I can get it to build and pass tests!

@samuela samuela marked this pull request as ready for review August 22, 2021 20:39
@samuela samuela changed the title jax: init at 0.2.19 jax: init at 0.2.19, jaxlib: init at 0.1.70 Aug 22, 2021
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/prs-ready-for-review/3032/582

@@ -0,0 +1,39 @@
{ buildPythonPackage, fetchFromGitHub, lib
# propagatedBuildInputs
Copy link
Member

Choose a reason for hiding this comment

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

Those comments are not required and they can get outdated quite fast.

pkgs/development/python-modules/jax/default.nix Outdated Show resolved Hide resolved
@samuela samuela changed the title jax: init at 0.2.19, jaxlib: init at 0.1.70 jax: init at 0.2.19, jaxlib: init at 0.1.71 Sep 8, 2021
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/prs-ready-for-review/3032/584

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 134894 run on x86_64-linux 1

2 packages built:
  • python39Packages.jax
  • python39Packages.jaxlib

@SuperSandro2000 SuperSandro2000 merged commit e1f9d5f into NixOS:master Sep 9, 2021
@samuela samuela deleted the samuela/jax branch September 9, 2021 18:07
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.

3 participants