--- title: CUDA breadcrumbs: - title: High-Performance Computing (HPC) --- {% include header.md %} Introduced by NVIDIA in 2006. While GPU compute was hackishly possible before CUDA through the fixed graphics pipeline, CUDA and CUDA-capable GPUs provided more somewhat more generalized GPU architecture and a programming model for GPU compute. ### Related Pages {:.no_toc} - [HIP](/hpc/hip/) ## TODO - The _compute capability_ describes the generation and supported features of a GPU. **TODO** More info about `-code`, `-arch` etc. - SM processing blocks/partitions same as warp schedulers? - SM processing block datapaths. - PTX. ## Resources - [NVIDIA: CUDA GPUs](https://developer.nvidia.com/cuda-gpus) - [NVIDIA: CUDA Programming Guide](https://docs.nvidia.com/cuda/cuda-c-programming-guide/) ## Setup ### Resources - [NVIDIA: CUDA Installation Guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) - [NVIDIA: CUDA Installation Guide for Windows](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html) - [NVIDIA: CUDA Toolkit Download](https://developer.nvidia.com/cuda-downloads) ### Linux Installation The toolkit on Linux can be installed in different ways: - Through an an existing package in your distro's repos (simplest and most compatible with other packages, 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). If an NVIDIA driver is already installed, it must match the CUDA version. Downloads: [CUDA Toolkit Download (NVIDIA)](https://developer.nvidia.com/cuda-downloads) #### Ubuntu w/ NVIDIA's CUDA Repo 1. Follow the steps to add the NVIDIA CUDA repo: [CUDA Toolkit Download (NVIDIA)](https://developer.nvidia.com/cuda-downloads) - Use the "deb (network)" method, which will show instructions for adding the repo. - But don't install `cuda` yet. 1. (Optional) Remove anything NVIDIA or CUDA from the system to avoid conflicts: `apt purge --autoremove 'cuda' 'cuda-' 'nvidia-*' 'libnvidia-*'` - Warning: May break your PC. There may be better ways to do this. - This is sometimes required to fix broken CUDA updates etc. 1. Install CUDA from the new repo (includes the NVIDIA driver): `apt install cuda` 1. Setup PATH: `echo 'export PATH=$PATH:/usr/local/cuda/bin' | sudo tee -a /etc/profile.d/cuda.sh` ### Docker Containers Docker containers may run NVIDIA applications using the NVIDIA runtime for Docker. See [Docker](/virt/docker/). ### DCGM - Official NVIDIA solution for monitoring GPU hardware and performance. - The DCGM exporter for Prometheus may be used for monitoring NVIDIA GPUs. It's standalone and doesn't require any other DCGM software to be installed. ## Usage - Gathering system/GPU information with `nvidia-smi`: - Show overview: `nvidia-smi` - Show topology info: `nvidia-smi topo