Setup completo driver e CUDA toolkit
I driver NVIDIA sono il prerequisito per qualsiasi utilizzo GPU su Linux: inferenza AI, transcoding, calcolo parallelo.
1. Prerequisiti
apt update && apt install -y build-essential linux-headers-$(uname -r)
2. Installare driver da repo NVIDIA
# Aggiungere repo CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb
apt update
# Installare driver
apt install -y nvidia-driver cuda-toolkit
3. Blacklist nouveau
echo "blacklist nouveau" > /etc/modprobe.d/blacklist-nouveau.conf
echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist-nouveau.conf
update-initramfs -u
reboot
4. Verifica
nvidia-smi
# Deve mostrare: driver version, CUDA version, GPU name, temperature, utilizzo
5. CUDA toolkit
# Verifica CUDA
nvcc --version
# Test compilazione
cat > test.cu <<EOF
#include <stdio.h>
__global__ void hello() { printf("Hello from GPU!\n"); }
int main() { hello<<<1,1>>>(); cudaDeviceSynchronize(); }
EOF
nvcc test.cu -o test && ./test
6. Persistenza driver
# nvidia-persistenced mantiene il driver caricato
systemctl enable --now nvidia-persistenced
Con i driver installati, la GPU è pronta per Ollama, vLLM, PyTorch o qualsiasi framework di AI.