For local AI on Ubuntu 26.04 or 24.04 LTS, set up a compatible GPU driver and test your app before installing the NVIDIA CUDA or AMD ROCm development toolkit. If your app already uses the GPU, you can stop there. Install the toolkit for your GPU if your project needs to compile CUDA or HIP code.
NVIDIA driver and CUDA Toolkit
AMD GPU permissions and ROCm
Run a local AI GPU smoke test
Fix common GPU setup problems
Remove CUDA or ROCm safely
Remove the toolkit package you installed and keep the display driver. For example, choose one installed package name corresponding to your path: cuda-toolkit, cuda-toolkit-13-5, rocm, rocm-dev, or the exact amdrocm10.2 or amdrocm-core-dev10.2 variant package. Check the planned removal of dependencies separately and stop if APT proposes to remove a working driver or something another project uses.
Run only the simulation that matches your installation. The NVIDIA example uses CUDA 13.5 and the AMD example uses the ROCm 10.2 runtime for gfx1100. Substitute your exact installed package for another route.
If the preview looks right, repeat the matching command with sudo apt remove in place of apt -s remove. Then preview unused dependencies with apt -s autoremove before running sudo apt autoremove. For the Ubuntu archive paths, leave Universe and Multiverse enabled if other software uses them. For NVIDIA’s upstream path, remove cuda-keyring and any CUDA pin you added only if you no longer need that repository for the toolkit or the driver. For AMD’s upstream path, remove /etc/apt/sources.list.d/amdrocm-stable.sources and its dedicated key only if you added them for this setup and no other entry uses the key. Run sudo apt update after repository changes. Remove any toolkit-specific PATH line you added to your shell profile.
Frequently asked questions
Does nvidia-smi mean the CUDA Toolkit is installed?
No. It checks your NVIDIA driver and reports its CUDA capability. Run nvcc –version to see whether the CUDA compiler is installed and which version your shell finds.
Do I need ROCm to run a prebuilt AI app on AMD?
You need a supported GPU, kernel driver and device access. A compatible app can bundle its own ROCm runtime, so you may be able to run it without the system ROCm SDK.
Why does the AMD PyTorch test use cuda as the device name?
PyTorch exposes its HIP backend through the torch.cuda API. A populated torch.version.hip value and a successful GPU calculation confirm that the ROCm wheel is using your GPU.
