Use instance by type
GPU instance usage
To use a GPU type instance, you must install the appropriate driver. You can create an instance using a GPU-specific OS image with drivers installed, or you can create an instance with a base image and then download and install the public drivers separately.
Here's how to use GPU by installing GPU driver for each operating system.
- Linux
Follow these instructions to set up GPU drivers on Linux-based systems, specifically for Ubuntu 20.04 and NVIDIA A100 GPUs provided by KakaoCloud.
Step 1. Install NVIDIA driver
Install NVIDIA drivers. Recommended drivers and CUDA versions are as follows:
GPU type | NVIDIA version | CUDA version |
---|---|---|
NVIDIA A100 | 450.80.02 and above | CUDA Toolkit 11.1 or higher |
- For details on downloading NVIDIA drivers, please refer to NVIDIA official site > Driver Downloads.
- For details on installing and configuring NVIDIA drivers, refer to NVIDIA Official Site > NVIDIA Driver Installation Quickstart Guide wish.
-
Run the command to check whether there is an NVIDIA device on the instance where you want to install the NVIDIA driver.
NVIDIA device search command$ lspci | grep -i NVIDIA
-
Check which driver versions can be installed.
-
If the installed driver is not the latest version, execute the update by executing the
apt update -y
command. -
When the message
Command ‘ubuntu-drivers’ not found
appears, enter thesudo apt install ubuntu-drivers-common
command to install ubuntu-drivers-common.Command to check driver version to install$ ubuntu-drivers devices
Example of checking driver version$ ubuntu-drivers devices
**==** /sys/devices/pci0000:00/0000:00:04.0 **==**
modalias: pci:v000010DEd000020B0sv000010DEsd0000134Fbc03sc02i00
vendor: NVIDIA Corporation
driver: nvidia-driver-515-server - distro non-free
driver: nvidia-driver-470 - distro non-free
driver: nvidia-driver-470-server - distro non-free
driver: nvidia-driver-510-server - distro non-free
driver: nvidia-driver-510 - distro non-free
driver: nvidia-driver-450-server - distro non-free
driver: nvidia-driver-515 - distro non-free recommended
driver: xserver-xorg-video-nouveau - distro free builtin
-
-
Select an installable driver and proceed with installation.
Installing Driver$ sudo apt install nvidia-driver-470
-
Reboot.
Reboot command$ sudo reboot
-
Check the installed driver information.
Command to check installed driver information$ nvidia-smi
Example of checking installed driver information$ nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.141.03 Driver Version: 470.141.03 CUDA Version: 11.4 |
|-------------------------------+----------------------+-----------------------|
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+=======================|
| 0 NVIDIA A100 80G... Off | 00000000:00:05.0 Off | 0 |
| N/A 33C P0 41W / 300W | 35MiB / 80994MiB | 0% Default |
| | | Disabled |
|-------------------------------+----------------------+-----------------------|
| 1 NVIDIA A100 80G... Off | 00000000:00:06.0 Off | 0 |
| N/A 34C P0 43W / 300W | 35MiB / 80994MiB | 0% Default |
| | | Disabled |
+-------------------------------+----------------------+-----------------------+
Step 2. Install NVIDIA CUDA toolkit
Install NVIDIA CUDA Toolkit.
-
When reinstalling the CUDA Toolkit, prepare the following installation environment. However, for new installations, proceed from the step 2.
a. Delete existing CUDA-related settings.
CUDA configuration deletion command$ sudo rm -rf /usr/local/cuda*
b. If you have the following existing settings in
~/.bashrc
or/etc/profile
, delete them.Delete existing settingsexport PATH=$PATH:/usr/local/cuda-11.4/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.4/lib64
export CUDADIR=/usr/local/cuda-11.4c. After deleting all existing settings, run the
nvcc -V
command to confirm that the command is not running.nvcc -V command execution result$ nvcc -V
Command 'nvcc' not found, but can be installed with: sudo apt install nvidia-cuda-toolkit -
Select the CUDA Toolkit version to install from NVIDIA Official Site > CUDA Toolkit Archive. When selecting a version, you can see the Base Installer command at the bottom.
Select CUDA Toolkit version and check Base Installer command
-
Run the Base Installer command (first line) to download the CUDA Toolkit installation file.
Example of file download command for CUDA Toolkit installation$ wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux.run
Result of executing file download command for Toolkit installation of Base Installer
-
Execute the Base Installer command (second line) to run the CUDA Toolkit installation file.
-
It takes more than 1 minute to run the CUDA Toolkit installation file.
File execution command for CUDA Toolkit installation$ sudo sh cuda_11.4.0_470.42.01_linux.run
-
-
Press the arrow keys to select Continue and press Enter.
Select Continue
-
Type
accept
and press Enter.Enter accept
-
Press Space to uncheck Driver, select Install, and press Enter.
- If there is an existing configuration, the message
Existing installation of CUDA Toolkit 11.x found
will appear. If applicable, select Upgrade all and press Enter.
Select Install
- If there is an existing configuration, the message
-
If the CUDA Toolkit has been installed properly, you can see the following screen.
CUDA Toolkit installation complete
-
Run the following command to add CUDA Toolkit-related environment variables.
Command for adding environment variables related to CUDA Toolkit$ sudo sh -c "echo 'export PATH=$PATH:/usr/local/cuda-11.4/bin' >> /etc/profile"
$ sudo sh -c "echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.4/lib64' >> /etc/profile"
$ sudo sh -c "echo 'export CUDADIR=/usr/local/cuda-11.4' >> /etc/profile"
$ source /etc/profile -
Run the
nvcc -V
command to check the installed CUDA Toolkit.CUDA Toolkit installation confirmation result