Set up GPU drivers for N-series VMs

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. This article is also available for Windows VMs.

For N-series VM specs, storage capacities, and disk details, see Sizes for virtual machines.

Supported GPU drivers

Note

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

NVIDIA Tesla drivers for NC VMs

Tesla driver installation on Ubuntu 16.04 LTS

  1. Make an SSH connection to the Azure N-series VM.

  2. 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

  3. Download the .run file for the driver for your distribution. The following example command downloads the Ubuntu 16.04 LTS Tesla driver to the /tmp directory:

     wget -O /tmp/NVIDIA-Linux-x86_64-367.48.run https://go.microsoft.com/fwlink/?linkid=836899
    
  4. If you need to install gcc and make on your system (required for the Tesla drivers), type the following:

     sudo apt-get update
    
     sudo apt install gcc
    
     sudo apt install make
    
  5. Change to the directory containing the driver installer and run commands similar to the following:

     chmod +x NVIDIA-Linux-x86_64-367.48.run
    
     sudo sh ./NVIDIA-Linux-x86_64-367.48.run
    

Verify driver installation

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

NVIDIA device status

Optional installation of NVIDIA CUDA Toolkit on Ubuntu 16.04 LTS

You can optionally install NVIDIA CUDA Toolkit 8.0 on NC VMs running Ubuntu 16.04 LTS. In addition to GPU drivers, the Toolkit provides a comprehensive development environment for C and C++ developers building GPU-accelerated applications.

To install the CUDA Toolkit, run commands similar to the following:

CUDA_REPO_PKG=cuda-repo-ubuntu1604_8.0.44-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.

Next steps