Installing the NVIDIA GPU Driver and CUDA Toolkit on a P1 BMS¶
Scenarios¶
After a GPU-accelerated P1 BMS (using the physical.p1.large flavor) is created, the NVIDIA GPU driver and CUDA Toolkit must be installed on it for computing acceleration.
Prerequisites¶
An EIP has been bound to the BMS.
You have obtained the required driver installation packages.
¶ OS
Driver
How to Obtain
CentOS 7.4
NVIDIA GPU driver installation package: NVIDIA-Linux-x86_64-375.66.run
https://www.nvidia.com/download/driverResults.aspx/118955/en-us
CUDA Toolkit installation package: cuda_8.0.61_375.26_linux.run
https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
CentOS 7.4¶
Log in to the target BMS and run the following command to switch to user root:
su root
(Optional) If the gcc, gcc-c++, make, and kernel-devel dependency packages do not exist, run the following commands to install the gcc, gcc-c++, make, and kernel-devel tools:
yum install gcc
yum install gcc-c++
yum install make
yum install kernel-devel-`uname -r`
(Optional) Add the Nouveau driver to the blacklist.
If the Nouveau driver has been installed and loaded, perform the following operations to add the Nouveau driver to the blacklist to avoid conflicts:
Add blacklist nouveau to the end of the /etc/modprobe.d/blacklist.conf file.
Run the following commands to back up and reconstruct initramfs:
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
Run the reboot command to restart the BMS.
(Optional) If the X service is running, run the systemctl set-default multi-user.target command and restart the BMS to enter multi-user mode.
(Optional) Install the NVIDIA GPU driver.
If you selected a specified version of NVIDIA GPU driver rather than a version contained in the CUDA Toolkit, perform this step.
Download NVIDIA GPU driver installation package NVIDIA-Linux-x86_64-xxx.yy.run from https://www.nvidia.com/Download/index.aspx?lang=en, and upload this package to the /tmp directory on the BMS.
Run the following command to install the NVIDIA GPU driver:
sh ./NVIDIA-Linux-x86_64-xxx.yy.run
Run the following command to delete the installation package:
rm -f NVIDIA-Linux-x86_64-xxx.yy.run
Install the CUDA Toolkit.
Download CUDA Toolkit installation package cuda_a.b.cc_xxx.yy_linux.run from https://developer.nvidia.com/cuda-downloads, and upload this package to the /tmp directory on the BMS.
Run the following command to change the permission to the installation package:
chmod +x cuda_a.b.cc_xxx.yy_linux.run
Run the following command to install the CUDA Toolkit:
./cuda_a.b.cc_xxx.yy_linux.run -toolkit -samples -silent -override --tmpdir=/tmp/
Run the following command to delete the installation package:
rm -f cuda_a.b.cc_xxx.yy_linux.run
Run the following commands to check whether the installation is successful:
cd /usr/local/cuda/samples/1_Utilities/deviceQueryDrv/
make
./deviceQueryDrv
If the command output contains "Result = PASS", the CUDA Toolkit and the NVIDIA GPU driver have been installed successfully.