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
pythonPackages.chainer: init at 3.2.0 #33123
Conversation
}: | ||
|
||
with pkgs; | ||
with python.pkgs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using python.pkgs
, it is preferred to list the python dependencies as arguments to the derivation.
name = "cudatoolkit-${cudatoolkit.majorVersion}-nccl-${version}"; | ||
version = "1.3.4-1"; | ||
|
||
src = fetchurl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchFromGitHub
should be used instead https://nixos.org/nixpkgs/manual/#sec-sources
@@ -0,0 +1,43 @@ | |||
{ stdenv, pkgs, fetchurl, cudatoolkit }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependencies should be listed explicitly, instead of using pkgs
.
NVIDIA Collective Communications Library. | ||
Multi-GPU and multi-node collective communication primitives. | ||
''; | ||
homepage = "https://developer.nvidia.com/nccl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When possible, unquoted URLs are preferred.
|
||
CUDA_PATH = "${cudatoolkit}"; | ||
CFLAGS = "-I ${cudnn}/include -I ${nccl}/include"; | ||
LDFLAGS = "-L ${cudnn}/lib -L ${nccl}/lib"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these three lines necessary? It builds fine for me without them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to cupy's official install guide document, we need set environment values when cupy will be installed with cuda, cudnn, nccl.
https://docs-cupy.chainer.org/en/stable/install.html#install-cupy-with-cuda
https://docs-cupy.chainer.org/en/stable/install.html#install-cupy-with-cudnn-and-nccl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand the note correctly, it should not be necessary. Nix will add ${cudatoolkit}/bin/nvcc
to PATH
, as well as set the appropriate CFLAGS
and LDFLAGS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The official document prefers to use pip installing and set envs with 'export'.
I'm worrying those environment values are needed in python phase.
I think Nix will not add CFLAGS and LDFLAGS to python.
Actually, those checks are in python.
https://github.com/cupy/cupy/blob/06e84b561aeba2d4abc5342fe5a7c1da894a436b/install/build.py#L33
https://github.com/cupy/cupy/blob/df93794d685560ac6f44b23528e81eb501e7871c/cupy_setup_build.py#L250
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nix sets those variables in python since it is based on mkDerivation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry.
You are right, those settings are unnecessary.
I delete those.
I found out CUDA_PATH
is unnecessary when PATH
has ${cudatoolkit}/bin
.
And I attempted building after delete those environment variables settings, and
chainer could find cudnn.
>>> import chainer
>>> chainer.cuda.available
True
>>> chainer.cuda.cudnn_enabled
True
>>>
src = fetchFromGitHub { | ||
owner = "NVIDIA"; | ||
repo = "nccl"; | ||
rev = "649f04d07711440ec2699ce7ec1af4ab71d6dbf9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use rev = "v${version}";
cudatoolkit | ||
]; | ||
|
||
BUILDDIR = "./"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed, the default build/
directory should be fine.
BUILDDIR = "./"; | ||
PREFIX = "$out"; | ||
CUDA_HOME = "${cudatoolkit}"; | ||
CUDA_LIB = "${cudatoolkit.lib}/lib"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three variables should be in makeFlags
:
makeFlags = [
"PREFIX=$(out)"
"CUDA_HOME=${cudatoolkit}"
"CUDA_LIB=${cudatoolkit.lib}/lib"
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
]; | ||
|
||
BUILDDIR = "./"; | ||
PREFIX = "$out"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will set the PREFIX
variable to literal $out
string. The out
variable needs to be interpolated somewhere, either by shell using preInstall = ''export PREFIX="$out"'';
, or by make as suggested below. Correctly setting the variable will also allow you to get rid of the postInstall
section.
@GrahamcOfBorg build nccl python2Packages.chainer python2Packages.cupy python3Packages.chainer python3Packages.cupy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure for system: aarch64-linux
Package ‘cudatoolkit-8.0.61’ in /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/pkgs/development/compilers/cudatoolkit/default.nix:128 has an unfree license (‘unfree’), refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure for system: x86_64-darwin
Package ‘cudatoolkit-8.0.61’ in /Users/graham/nix-borg/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-zoidberg/pkgs/development/compilers/cudatoolkit/default.nix:128 has an unfree license (‘unfree’), refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure for system: x86_64-linux
Package ‘cudatoolkit-8.0.61’ in /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-zoidberg/pkgs/development/compilers/cudatoolkit/default.nix:128 has an unfree license (‘unfree’), refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
LGTM, could you please squash the fix-up commits? |
}: | ||
|
||
buildPythonPackage rec { | ||
name = "${pname}-${version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
can be removed from buildPython*
expressions
bf7b139
to
06c0ebc
Compare
06c0ebc
to
7ccceea
Compare
Thanks for your work. |
cupy: init at 2.2.0
nccl: init at 1.3.4
filelock: init at 2.0.13
fastrlock: init at 0.3
Motivation for this change
Adding the chainer and related packages.
The chainer is a python framework for writing neural networks codes.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)