uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
66
pkgs/development/python-modules/torchvision/bin.nix
Normal file
66
pkgs/development/python-modules/torchvision/bin.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, fetchurl
|
||||
, isPy37
|
||||
, isPy38
|
||||
, isPy39
|
||||
, isPy310
|
||||
, patchelf
|
||||
, pillow
|
||||
, python
|
||||
, pytorch-bin
|
||||
}:
|
||||
|
||||
let
|
||||
pyVerNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
|
||||
srcs = import ./binary-hashes.nix version;
|
||||
unsupported = throw "Unsupported system";
|
||||
version = "0.12.0";
|
||||
in buildPythonPackage {
|
||||
inherit version;
|
||||
|
||||
pname = "torchvision";
|
||||
|
||||
format = "wheel";
|
||||
|
||||
src = fetchurl srcs."${stdenv.system}-${pyVerNoDot}" or unsupported;
|
||||
|
||||
disabled = !(isPy37 || isPy38 || isPy39 || isPy310);
|
||||
|
||||
nativeBuildInputs = [
|
||||
patchelf
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pillow
|
||||
pytorch-bin
|
||||
];
|
||||
|
||||
# The wheel-binary is not stripped to avoid the error of `ImportError: libtorch_cuda_cpp.so: ELF load command address/offset not properly aligned.`.
|
||||
dontStrip = true;
|
||||
|
||||
pythonImportsCheck = [ "torchvision" ];
|
||||
|
||||
postFixup = let
|
||||
rpath = lib.makeLibraryPath [ stdenv.cc.cc.lib ];
|
||||
in ''
|
||||
# Note: after patchelf'ing, libcudart can still not be found. However, this should
|
||||
# not be an issue, because PyTorch is loaded before torchvision and brings
|
||||
# in the necessary symbols.
|
||||
patchelf --set-rpath "${rpath}:${pytorch-bin}/${python.sitePackages}/torch/lib:" \
|
||||
"$out/${python.sitePackages}/torchvision/_C.so"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "PyTorch vision library";
|
||||
homepage = "https://pytorch.org/";
|
||||
changelog = "https://github.com/pytorch/vision/releases/tag/v${version}";
|
||||
# Includes CUDA and Intel MKL, but redistributions of the binary are not limited.
|
||||
# https://docs.nvidia.com/cuda/eula/index.html
|
||||
# https://www.intel.com/content/www/us/en/developer/articles/license/onemkl-license-faq.html
|
||||
license = licenses.bsd3;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ junjihashimoto ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
# Warning: use the same CUDA version as pytorch-bin.
|
||||
#
|
||||
# Precompiled wheels can be found at:
|
||||
# https://download.pytorch.org/whl/torch_stable.html
|
||||
|
||||
# To add a new version, run "prefetch.sh 'new-version'" to paste the generated file as follows.
|
||||
|
||||
version : builtins.getAttr version {
|
||||
"0.12.0" = {
|
||||
x86_64-linux-37 = {
|
||||
name = "torchvision-0.12.0-cp37-cp37m-linux_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/cu113/torchvision-0.12.0%2Bcu113-cp37-cp37m-linux_x86_64.whl";
|
||||
hash = "sha256-i/qktZT+5HQYQjtTHtxOV751DcsP9AHMsSV9/svsGzA=";
|
||||
};
|
||||
x86_64-linux-38 = {
|
||||
name = "torchvision-0.12.0-cp38-cp38-linux_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/cu113/torchvision-0.12.0%2Bcu113-cp38-cp38-linux_x86_64.whl";
|
||||
hash = "sha256-NxM+jFsOwvAZmeWRFvbQ422a+xx/j1i9DD3ImW+DVBk=";
|
||||
};
|
||||
x86_64-linux-39 = {
|
||||
name = "torchvision-0.12.0-cp39-cp39-linux_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/cu113/torchvision-0.12.0%2Bcu113-cp39-cp39-linux_x86_64.whl";
|
||||
hash = "sha256-bGO5q+KEnv7SexmbbUWaIbsBcIxyDbL8pevZQbLwDbg=";
|
||||
};
|
||||
x86_64-linux-310 = {
|
||||
name = "torchvision-0.12.0-cp310-cp310-linux_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/cu113/torchvision-0.12.0%2Bcu113-cp310-cp310-linux_x86_64.whl";
|
||||
hash = "sha256-ocsGOHa967HcZGV+1omD/xMHufmoi166Yg2Hr+SEhfE=";
|
||||
};
|
||||
x86_64-darwin-37 = {
|
||||
name = "torchvision-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl";
|
||||
hash = "sha256-GJM7xZf0VjmTJJcZqWqV28fTN0yQ+7MNPafVGPOv60I=";
|
||||
};
|
||||
x86_64-darwin-38 = {
|
||||
name = "torchvision-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl";
|
||||
hash = "sha256-DWAuCb1Fc2/y55aOjduw7s6Vb/ltcVSLGxtIeP33S9g=";
|
||||
};
|
||||
x86_64-darwin-39 = {
|
||||
name = "torchvision-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl";
|
||||
hash = "sha256-RMye+ZLS4qtjsIg/fezrwiRNupO3JUe6EfV6yEUvbq0=";
|
||||
};
|
||||
x86_64-darwin-310 = {
|
||||
name = "torchvision-0.12.0-cp310-cp310-macosx_10_9_x86_64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp310-cp310-macosx_10_9_x86_64.whl";
|
||||
hash = "sha256-aTZW5nkLarIeSm6H6BwpgrrZ5FW16yThS7ZyOC7GEw8=";
|
||||
};
|
||||
aarch64-darwin-38 = {
|
||||
name = "torchvision-0.12.0-cp38-cp38-macosx_11_0_arm64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp38-cp38-macosx_11_0_arm64.whl";
|
||||
hash = "sha256-n0JCD38LKc09YXdt8xV4JyV6DPFrLAJ3bcFslquxJW0=";
|
||||
};
|
||||
aarch64-darwin-39 = {
|
||||
name = "torchvision-0.12.0-cp39-cp39-macosx_11_0_arm64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp39-cp39-macosx_11_0_arm64.whl";
|
||||
hash = "sha256-adgvR7Z7rW3cu4eDO6WVCmwnG6l7quTAlVYQBxvwNPU=";
|
||||
};
|
||||
aarch64-darwin-310 = {
|
||||
name = "torchvision-0.12.0-cp310-cp310-macosx_11_0_arm64.whl";
|
||||
url = "https://download.pytorch.org/whl/torchvision-0.12.0-cp310-cp310-macosx_11_0_arm64.whl";
|
||||
hash = "sha256-oL5FAcoLobGVZEySQ/SaHEmiblKn83kkxCOdC/XsvY0=";
|
||||
};
|
||||
};
|
||||
}
|
||||
68
pkgs/development/python-modules/torchvision/default.nix
Normal file
68
pkgs/development/python-modules/torchvision/default.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ lib
|
||||
, symlinkJoin
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, ninja
|
||||
, which
|
||||
, libjpeg_turbo
|
||||
, libpng
|
||||
, numpy
|
||||
, scipy
|
||||
, pillow
|
||||
, pytorch
|
||||
, pytest
|
||||
, cudaSupport ? pytorch.cudaSupport or false # by default uses the value from pytorch
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pytorch.cudaPackages) cudatoolkit cudnn;
|
||||
|
||||
cudatoolkit_joined = symlinkJoin {
|
||||
name = "${cudatoolkit.name}-unsplit";
|
||||
paths = [ cudatoolkit.out cudatoolkit.lib ];
|
||||
};
|
||||
cudaArchStr = lib.optionalString cudaSupport lib.strings.concatStringsSep ";" pytorch.cudaArchList;
|
||||
in buildPythonPackage rec {
|
||||
pname = "torchvision";
|
||||
version = "0.11.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pytorch";
|
||||
repo = "vision";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-nJV0Jr6Uc+ALodAiekM6YpM6IbmIb4w+Jlc3bJRqayI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ libpng ninja which ]
|
||||
++ lib.optionals cudaSupport [ cudatoolkit_joined ];
|
||||
|
||||
TORCHVISION_INCLUDE = "${libjpeg_turbo.dev}/include/";
|
||||
TORCHVISION_LIBRARY = "${libjpeg_turbo}/lib/";
|
||||
|
||||
buildInputs = [ libjpeg_turbo libpng ]
|
||||
++ lib.optionals cudaSupport [ cudnn ];
|
||||
|
||||
propagatedBuildInputs = [ numpy pillow pytorch scipy ];
|
||||
|
||||
preBuild = lib.optionalString cudaSupport ''
|
||||
export TORCH_CUDA_ARCH_LIST="${cudaArchStr}"
|
||||
export FORCE_CUDA=1
|
||||
'';
|
||||
|
||||
# tries to download many datasets for tests
|
||||
doCheck = false;
|
||||
|
||||
checkPhase = ''
|
||||
HOME=$TMPDIR py.test test --ignore=test/test_datasets_download.py
|
||||
'';
|
||||
|
||||
checkInputs = [ pytest ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "PyTorch vision library";
|
||||
homepage = "https://pytorch.org/";
|
||||
license = licenses.bsd3;
|
||||
platforms = with platforms; linux ++ lib.optionals (!cudaSupport) darwin;
|
||||
maintainers = with maintainers; [ ericsagnes ];
|
||||
};
|
||||
}
|
||||
46
pkgs/development/python-modules/torchvision/prefetch.sh
Executable file
46
pkgs/development/python-modules/torchvision/prefetch.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix-prefetch-scripts
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
version=$1
|
||||
|
||||
linux_bucket="https://download.pytorch.org/whl/cu113"
|
||||
darwin_bucket="https://download.pytorch.org/whl"
|
||||
|
||||
url_and_key_list=(
|
||||
"x86_64-linux-37 $linux_bucket/torchvision-${version}%2Bcu113-cp37-cp37m-linux_x86_64.whl torchvision-${version}-cp37-cp37m-linux_x86_64.whl"
|
||||
"x86_64-linux-38 $linux_bucket/torchvision-${version}%2Bcu113-cp38-cp38-linux_x86_64.whl torchvision-${version}-cp38-cp38-linux_x86_64.whl"
|
||||
"x86_64-linux-39 $linux_bucket/torchvision-${version}%2Bcu113-cp39-cp39-linux_x86_64.whl torchvision-${version}-cp39-cp39-linux_x86_64.whl"
|
||||
"x86_64-linux-310 $linux_bucket/torchvision-${version}%2Bcu113-cp310-cp310-linux_x86_64.whl torchvision-${version}-cp310-cp310-linux_x86_64.whl"
|
||||
"x86_64-darwin-37 $darwin_bucket/torchvision-${version}-cp37-cp37m-macosx_10_9_x86_64.whl torchvision-${version}-cp37-cp37m-macosx_10_9_x86_64.whl"
|
||||
"x86_64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_10_9_x86_64.whl torchvision-${version}-cp38-cp38-macosx_10_9_x86_64.whl"
|
||||
"x86_64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_10_9_x86_64.whl torchvision-${version}-cp39-cp39-macosx_10_9_x86_64.whl"
|
||||
"x86_64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_10_9_x86_64.whl torchvision-${version}-cp310-cp310-macosx_10_9_x86_64.whl"
|
||||
"aarch64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl"
|
||||
"aarch64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl"
|
||||
"aarch64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl"
|
||||
)
|
||||
|
||||
hashfile="binary-hashes-$version.nix"
|
||||
echo " \"$version\" = {" >> $hashfile
|
||||
|
||||
for url_and_key in "${url_and_key_list[@]}"; do
|
||||
key=$(echo "$url_and_key" | cut -d' ' -f1)
|
||||
url=$(echo "$url_and_key" | cut -d' ' -f2)
|
||||
name=$(echo "$url_and_key" | cut -d' ' -f3)
|
||||
|
||||
echo "prefetching ${url}..."
|
||||
hash=$(nix hash to-sri --type sha256 `nix-prefetch-url "$url" --name "$name"`)
|
||||
|
||||
echo " $key = {" >> $hashfile
|
||||
echo " name = \"$name\";" >> $hashfile
|
||||
echo " url = \"$url\";" >> $hashfile
|
||||
echo " hash = \"$hash\";" >> $hashfile
|
||||
echo " };" >> $hashfile
|
||||
|
||||
echo
|
||||
done
|
||||
|
||||
echo " };" >> $hashfile
|
||||
echo "done."
|
||||
Loading…
Add table
Add a link
Reference in a new issue