> For the complete documentation index, see [llms.txt](https://docs.qblocks.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qblocks.cloud/q-blocks-how-to-guide/upgrade-cuda-to-v12.2.md).

# Upgrade CUDA to v12.2

This guide helps you upgrade your Q Blocks GPU instance CUDA version to 12.2.

{% hint style="warning" %}
CUDA 12 requires Nvidia Driver 535 or higher.&#x20;

Please confirm that by running command `nvidia-smi` in your Q Blocks instance.
{% endhint %}

**Uninstall any existing CUDA**

```bash
sudo apt-get --purge remove -y '*cublas*' 'cuda*' 'nsight*' 
```

```bash
sudo apt-get --purge remove -y '*nvidia*' 
```

```bash
sudo rm -rf /usr/local/cuda*
```

```bash
sudo apt -y autoremove
```

**Install CUDA v12.2**

```bash
CUDAVERSION=12.2
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run
chmod +x cuda_12.2.2_535.104.05_linux.run
sudo ./cuda_12.2.2_535.104.05_linux.run --toolkit --silent
```

**Set CUDA path**

```bash
echo 'export PATH=/usr/local/cuda-$CUDAVERSION/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-$CUDAVERSION/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
```

**Confirm if CUDA is visible**

```bash
# Confirm if cuda is visible:
nvcc -V
```
