Skip to content

Instantly share code, notes, and snippets.

@fwyzard
Last active October 16, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwyzard/8fe3428c2cb1e90b706419c3f9b1e3aa to your computer and use it in GitHub Desktop.
Save fwyzard/8fe3428c2cb1e90b706419c3f9b1e3aa to your computer and use it in GitHub Desktop.
Install CUDA and repacke the NVIDIA kernel modules

RHEL 7

download the CUDA RPMs:

ssh -f -N -o ControlMaster=auto -D 1080 cmsusr.cms 
export ALL_PROXY=socks5://localhost:1080
curl http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-rhel7-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm -o cuda-repo-rhel7-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm

unpack the individual RPMs under /var/cuda-repo-10-1-local-10.1.243-418.87.00/:

sudo rpm -i cuda-repo-rhel7-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm

install the packages:

sudo yum clean all
sudo yum -y install kernel-devel rpm-build
sudo yum -y install nvidia-driver-latest-dkms
sudo yum -y install cuda

Note that this will also build the kernel modules:

/lib/modules/3.10.0-957.1.3.el7.x86_64/extra/nvidia-drm.ko.xz
/lib/modules/3.10.0-957.1.3.el7.x86_64/extra/nvidia.ko.xz
/lib/modules/3.10.0-957.1.3.el7.x86_64/extra/nvidia-modeset.ko.xz
/lib/modules/3.10.0-957.1.3.el7.x86_64/extra/nvidia-uvm.ko.xz

repackage the kernel modules

Rather than building the kernel modules on every machine, we can build them once, and package them in an RPM that provides the same capabilities as nvidia-driver-latest-dkms-418.87.00-1.el7.x86_64.rpm:

~fwyzard/cuda/package_nvidia_modules.sh

This will work for a single kernel at a time (so the kernel should be among the dependencies ?), but it might be good enough for the production environment.

installing the repackaged modules

# install the precompiled kernel drivers
sudo cp ~fwyzard/cuda/nvidia-driver-latest-3.10.0-957.1.3.el7.x86_64-418.87.00-1.el7.x86_64.rpm /var/cuda-repo-10-1-local-10.1.243-418.87.00/
sudo createrepo --update /var/cuda-repo-10-1-local-10.1.243-418.87.00/
sudo yum install nvidia-driver-latest-3.10.0-957.1.3.el7.x86_64-418.87.00

# prevent GCC from being installed as a dependency of NVCC
sudo rpm -i ~fwyzard/cuda/gcc-c++-dummy-4.8.5-1.el7.x86_64.rpm

# install CUDA
sudo yum install cuda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment