From ab1eeee4d13de835eeb7324de922fc84899f8505 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 16 Jan 2020 11:14:21 +0100 Subject: [PATCH] cuda 10.2: install Needs nvidia driver 440. --- cuda-10.2.89-0.build.sh | 110 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 cuda-10.2.89-0.build.sh diff --git a/cuda-10.2.89-0.build.sh b/cuda-10.2.89-0.build.sh new file mode 100755 index 0000000..e975fc7 --- /dev/null +++ b/cuda-10.2.89-0.build.sh @@ -0,0 +1,110 @@ +#! /bin/bash + +# COOKIE=$(mcookie); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 1; exec bash /dev/shm/runme-$COOKIE.sh + +PKG=cuda +MAJOR=10.2 +MINOR=89 +VERSION=$MAJOR.$MINOR +BUILD=0 +DRIVERVERSION=440.33.01 + +# https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz +CUDNNVER=7.6.5.32 +CUDNNFILE=cudnn-$MAJOR-linux-x64-v$CUDNNVER.tgz + +PREFIX=/pkg/$PKG-$VERSION-$BUILD +if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi + +set -e +umask 022 + +# be carefull on machines with 8Gig and less +BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp +test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR +mkdir -p $BUILD_TMPDIR/home +export TMPDIR=$BUILD_TMPDIR +export HOME=$BUILD_TMPDIR/home + +exec $PREFIX/profile <<-EOF + PATH=$PREFIX/bin:\$PATH + export LD_LIBRARY_PATH=$PREFIX/lib64\${LD_LIBARRY_PATH:+:\$LD_LIBARRY_PATH} + export CUDA_PATH=$PREFIX +EOF +. $PREFIX/profile + +cd $PREFIX +OLD_STUFF=$(echo $(ls | grep -vw -e build -e profile)) +test -n "$OLD_STUFF" && rm -r $OLD_STUFF +BUILDDIR=$PREFIX/build + +mkdir -p $BUILDDIR +cd $BUILDDIR + +INSTALLFILE=cuda_${VERSION}_${DRIVERVERSION}_linux.run +URL=https://developer.nvidia.com/compute/cuda/$MAJOR/Prod/local_installers/$INSTALLFILE + +# in case it was downloaded before +if [ ! -e $INSTALLFILE -a -e /package/cuda/src/$INSTALLFILE ]; then + cp -vp /package/cuda/src/$INSTALLFILE $INSTALLFILE +fi + +if [ ! -e $INSTALLFILE ]; then + wget $URL +fi + +rm -rf cuda_tmp +mkdir -p cuda_tmp +bash $INSTALLFILE --extract=$BUILDDIR/cuda_tmp --nox11 + +cd cuda_tmp + +### reorganize the tree a bit ### +cd cuda-toolkit + +# dump javabased nsight profiler +rm -rf nsight-compute-* nsight-systems-* libnsight nsightee_plugins + +# stuff all the 'extras' into 'share', but keep +# nvvm (nvidia virtual machine, see bin/nvcc.profile) +mv doc extras libnvvp nvml tools share + +# 'elevate' libs and includes +rm include lib64 +mv targets/x86_64-linux/* . +mv lib lib64 +rm -r targets + +# this one is required but a bit incorrect if it comes to the lib suffix +sed -i -e '/LD_LIBRARY_PATH/ s/lib:/lib$(_TARGET_SIZE_):/' bin/nvcc.profile + +### return ### +cd $BUILDDIR/cuda_tmp + +# obviously a name change was overlooked +sed -i -e '/^SAMPLES_SRC/ s,samples,../cuda-samples,' cuda-samples/bin/cuda-install-samples-10.2.sh + +# we don't need this distro aware handler for finding glut & co +for D in $(find -name findgllib.mk -exec dirname {} \;) ; do + test -e $D/Makefile && sed -i -e '/findgllib.mk/ s/include/# include/' $D/Makefile +done + +# install and merge cublas (which is pretty redundant) +mv cuda-toolkit/* $PREFIX +cp -au cublas/* $PREFIX +rm -r cublas/* +mv cuda-samples $PREFIX/share + +# cudNN +cd $BUILDDIR +test -e $CUDNNFILE || cp /package/cuda/src/$CUDNNFILE . +mkdir -p cudnn +cd cudnn +tar xvf ../$CUDNNFILE +cp cuda/include/cudnn.h $PREFIX/include/ +cp cuda/lib64/libcudnn* $PREFIX/lib64/ + +exit