Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Created August 13, 2019 16:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ilyaevseev/bbe85d1bf231e3f443498a8c6e3d3020 to your computer and use it in GitHub Desktop.
Save ilyaevseev/bbe85d1bf231e3f443498a8c6e3d3020 to your computer and use it in GitHub Desktop.
Try to automate CUDA dependencies installation for https://cdnnow.ru/blog/ffmpeg-cuda/
#!/bin/sh
yum -y install epel-release
yum -y install curl
rpm -q docker-release >/dev/null 2>&1 ||
yum install -y http://repo.docker.ru/pub/linux/centos/7/noarch/docker-release-1-1.el7.noarch.rpm
yum -y install ffmpeg-cuda
MAJOR="$(ldd /bin/ffmpeg-cuda | awk 'match($1, /^libnppicc\.so\.([0-9]*)/, m) { print m[1]; exit; }')"
MINOR="$(ldd /bin/ffmpeg-cuda | awk 'match($1, /^libnppicc\.so\.([0-9]*)\.([0-9]*)$/, m) { print m[2]; exit; }')"
rpm -q cuda-repo-rhel7 >/dev/null 2>&1 &&
test -n "$MINOR" || {
REPOBASE="https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64"
REPOPKG="$(curl -sS $REPOBASE/ | egrep -o "cuda-repo-rhel7-$MAJOR.$MINOR[^']*.rpm" | tail -1)"
MINOR="${REPOPKG#*.}"
MINOR="${MINOR%%.*}"
yum install -y "$REPOBASE/$REPOPKG"
}
yum install -y cuda-drivers "cuda-runtime-$MAJOR-$MINOR"
## END ##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment