#! /bin/bash ## This script install NVIDIA CUDA driver in a CENTOS Linux standalone machine via a local rpm file ## Assume the rpm is aldeady downloaded in the same directory ## Run as su ## Preliminary checking lspci | grep -i nvidia ## Download the latest rpm version suited for your system at https://developer.nvidia.com/cuda-downloads, e.g., Linux -> x86_64 -> CentOS -> 7 -> rpm(local) ## e.g., for cuda 9.2, ## wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-rhel7-9-2-local-9.2.148-1.x86_64 # mv cuda-repo-rhel7-9-2-local-9.2.148-1.x86_64 cuda-repo-rhel7-9-2-local-9.2.148-1.x86_64.rpm rpm -i cuda-repo-rhel7-9-2-local-9.2.148-1.x86_64.rpm yum clean all yum install -y cuda ## Follow and accept all prompts. The installation process will take up some while, around 10 mins or longer. ## After installation, make sure that the CUDA paths are linked in ~/.bashrc echo ' ' >> ~/.bashrc echo '# Added by CUDA installation ' >> ~/.bashrc echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc echo ' ' >> ~/.bashrc #To verify that the installation works, source ~/.bashrc nvcc -V # run a more comprehensive test cd /usr/local/cuda/samples/ #(or the directory where the samples/ are instructed to install during the cuda installation process) make # this will make a whole lot of executables in /usr/local/cuda/samples/bin/x86_64/linux/release ## To test the cuda installation, cd /usr/local/cuda/samples/bin/x86_64/linux/release ./deviceQuery ./bandwidthTest ## In case ./deviceQuery and ./bandwidthTest return failure output, you may just reboot the system and run the test again. The tests should passed after rebooting.