-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Needs nvidia driver 440.
- Loading branch information
Showing
1 changed file
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 </dev/null | ||
|
||
mkdir -p $PREFIX | ||
cat >$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 |