title: CUDA
breadcrumbs:
- title: Software Engineering
- title: Frameworks
---
{% include header.md %}
NVIDIA CUDA (Compute Unified Device Architecture) Toolkit, for programming CUDA-capable GPUs.
Resources
Installation
Linux
The toolkit on Linux can be installed in different ways:
- Through an an existing package in your distro's repos (simplest and most compatible, but may be outdated).
- Through a downloaded package manager package (up to date but may be incompatible with your installed NVIDIA driver).
- Through a runfile (same as previous but more cross-distro and harder to manage).
Note that the toolkit requires a matching NVIDIA driver to be installed.
Ubuntu (package from main repos):
- Update your NVIDIA driver.
- Typically through the "Driver Manager" on Ubuntu-based distros, which installs it through the package manager.
- Check which version you have installed with
dpkg -l | grep nvidia-driver
.
- Install the CUDA toolkit:
apt install nvidia-cuda-toolkit
Ubuntu (downloaded package or runfile):
See NVIDIA CUDA Installation Guide for Linux (NVIDIA).
Running
- Gathering system/GPU information with
nvidia-smi
:
- Show overview:
nvidia-smi
- Show topology matrix:
nvidia-smi topo --matrix
- Show topology info:
nvidia-smi topo <option>
- Show NVLink info:
nvidia-smi nvlink --status -i 0
(for GPU #0)
- Monitor device stats:
nvidia-smi dmon
- To specify which devices are available to the CUDA application and in which order, set the
CUDA_VISIBLE_DEVICES
env var to a comma-separated list of device IDs.
{% include footer.md %}