cudatoolkit8: 8.0.61 -> 8.0.88

This requires a refactor so that we support binary patches from NVIDIA.
This commit is contained in:
Nikolay Amiantov 2018-02-25 20:02:55 +03:00
parent 3179002f61
commit cac556be8d

@ -11,11 +11,12 @@ let
, name ? ""
, developerProgram ? false
, python ? python27
, runPatches ? []
}:
stdenv.mkDerivation rec {
name = "cudatoolkit-${version}";
inherit (args) version;
inherit version runPatches;
dontPatchELF = true;
dontStrip = true;
@ -48,35 +49,34 @@ let
rpath = "${stdenv.lib.makeLibraryPath runtimeDependencies}:${stdenv.cc.cc.lib}/lib64";
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
unpackPhase = ''
sh $src --keep --noexec
cd pkg/run_files
sh cuda-linux*.run --keep --noexec
sh cuda-samples*.run --keep --noexec
cd pkg
'';
mv pkg ../../$(basename $src)
cd ../..
rm -rf pkg
buildPhase = ''
chmod -R u+w .
while IFS= read -r -d ''$'\0' i; do
if ! isELF "$i"; then continue; fi
echo "patching $i..."
if [[ ! $i =~ \.so ]]; then
patchelf \
--set-interpreter "''$(cat $NIX_CC/nix-support/dynamic-linker)" $i
fi
if [[ $i =~ libcudart ]]; then
rpath2=
else
rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
fi
patchelf --set-rpath $rpath2 --force-rpath $i
done < <(find . -type f -print0)
for patch in $runPatches; do
sh $patch --keep --noexec
mv pkg $(basename $patch)
done
'';
installPhase = ''
mkdir $out
cd $(basename $src)
perl ./install-linux.pl --prefix="$out"
cd ..
for patch in $runPatches; do
cd $(basename $patch)
perl ./install_patch.pl --silent --accept-eula --installdir="$out"
cd ..
done
rm $out/tools/CUDA_Occupancy_Calculator.xls # FIXME: why?
@ -117,6 +117,23 @@ let
echo "NIX_CFLAGS_COMPILE+=' -D_FORCE_INLINES'" >> $out/nix-support/setup-hook
'';
preFixup = ''
while IFS= read -r -d ''$'\0' i; do
if ! isELF "$i"; then continue; fi
echo "patching $i..."
if [[ ! $i =~ \.so ]]; then
patchelf \
--set-interpreter "''$(cat $NIX_CC/nix-support/dynamic-linker)" $i
fi
if [[ $i =~ libcudart ]]; then
rpath2=
else
rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
fi
patchelf --set-rpath $rpath2 --force-rpath $i
done < <(find $out $lib $doc -type f -print0)
'';
passthru = {
cc = gcc;
majorVersion =
@ -163,9 +180,15 @@ in {
};
cudatoolkit8 = common {
version = "8.0.61";
version = "8.0.61.2";
url = "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run";
sha256 = "1i4xrsqbad283qffvysn88w2pmxzxbbby41lw0j1113z771akv4w";
runPatches = [
(fetchurl {
url = "https://developer.nvidia.com/compute/cuda/8.0/Prod2/patches/2/cuda_8.0.61.2_linux-run";
sha256 = "1iaz5rrsnsb1p99qiqvxn6j3ksc7ry8xlr397kqcjzxqbljbqn9d";
})
];
gcc = gcc5;
};