Set up GPU drivers for N-series VMs running Linux

To take advantage of the GPU capabilities of Azure N-series VMs running a supported Linux distribution, you must install NVIDIA graphics drivers on each VM after deployment. Driver setup information is also available for Windows VMs.

Important

Currently, Linux GPU support is only available on Azure NC VMs running Ubuntu Server 16.04 LTS.

For N-series VM specs, storage capacities, and disk details, see Sizes for virtual machines. See also General considerations for N-series VMs.

Install NVIDIA CUDA drivers

Here are steps to install NVIDIA drivers on Linux NC VMs from the NVIDIA CUDA Toolkit 8.0. C and C++ developers can optionally install the full Toolkit to build GPU-accelerated applications. For more information, see the CUDA Installation Guide.

Note

Driver download links provided here are current at time of publication. For the latest drivers, visit the NVIDIA website.

To install CUDA Toolkit, make an SSH connection to each VM. To verify that the system has a CUDA-capable GPU, run the following command:

lspci | grep -i NVIDIA

You will see output similar to the following example (showing an NVIDIA Tesla K80 card):

lspci command output

Then run commands specific for your distribution.

Ubuntu 16.04 LTS

CUDA_REPO_PKG=cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

wget -O /tmp/${CUDA_REPO_PKG} http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} 

sudo dpkg -i /tmp/${CUDA_REPO_PKG}

rm -f /tmp/${CUDA_REPO_PKG}

sudo apt-get update

sudo apt-get install cuda-drivers

The installation can take several minutes.

To optionally install the complete CUDA toolkit, type:

sudo apt-get install cuda

Reboot the VM and proceed to verify the installation.

Verify driver installation

To query the GPU device state, SSH to the VM and run the nvidia-smi command-line utility installed with the driver.

NVIDIA device status

CUDA driver updates

We recommend that you periodically update CUDA drivers after deployment.

Ubuntu 16.04 LTS

sudo apt-get update

sudo apt-get upgrade -y

sudo apt-get dist-upgrade -y

sudo apt-get install cuda-drivers

After the update completes, restart the VM.

General considerations for N-series VMs

  • For availability of N-series VMs, see Products available by region.

  • N-series VMs can only be deployed in the Resource Manager deployment model.

  • When creating an N-series VM using the Azure portal, on the Basics blade, select a VM disk type of HDD. To choose an available N-series size, on the Size blade, click View all.

  • N-series VMs do not support VM disks that are backed by Azure premium storage.

  • If you want to deploy more than a few N-series VMs, consider a pay-as-you-go subscription or other purchase options. If you're using an Azure free account, you can use only a limited number of Azure compute cores.

  • You might need to increase the cores quota (per region) in your Azure subscription and the separate quota for NC or NV cores. To request a quota increase, open an online customer support request at no charge. Default limits may vary depending on your subscription category.

  • We don't recommend installing X server or other systems that use the nouveau driver on Ubuntu NC VMs. Before installing NVIDIA GPU drivers, you need to disable the nouveau driver.

  • If you want to capture an image of a Linux VM on which you installed NVIDIA drivers, see How to generalize and capture a Linux virtual machine.

Next steps