OpenGL And DirectX On Azure Virtual Machines
Azure Virtual Machines by default don’t come with GPU capabilities, making them mostly useless for processes that require a GPU in anyway. I recently ran into this issue when publishing my 3D modelling application that uses ParaView for image rendering from my local development environment to my Azure VM. The classic ‘but it worked on my PC’-line soon followed.
Luckily Azure has expanded their VM range to now also include special VM series that are optimized for graphical processing. Azure’s N-Series Virtual Machines are the first Azure Virtual Machines that come with NVIDIA Tesla GPU’s and with that provide support for DirectX and OpenGL.
The N-Series Virtual Machines
The N-Series are divided into several subseries, for instance the NC, NC, ND, NCS and NVC-Series. Each subseries offers different CPU and GPU combinations for different computing scenarios.
There are still some drawbacks to using these Virtual Machines, primarily the fact that at the time of writing they don’t support Premium (SSD) storage or Premium Storage Caching. So, we will have to do with Standard HDD or Standard SSD storage. Region availability is another issue for this newer VM series, as with other specialized compute products, availability is not as widely supported as the, lets say ‘bread and butter’ VMs. You can find the availability of these, and other series here.
Then there is the issue of cost, in my case I required the NV-Series which meant the smallest possible VM size is 6 vCPUs with 56GB of RAM, coming in at just over 1000 EURO a month. For production purposes this is doable considering I would probably end up scaling to these specifications anyway, but for my secondary development environment this is quite a pricy setup.
Some tips on deploying N-Services VMs
Initially I tried to resize my original (DS2v2-Series) VM to the NV-Series I needed, and this worked fine (make sure to stop/deallocate your VM first before resizing, otherwise the NV-Series might not show up in the available VMs-list), but because my original VM was set up using Premium SSD storage, after the resize the VM became unreachable. If your original VM was created with a Premium SSD OS-Disk, you will be forced to start from scratch and just create a completely new NV-Series VM.
Secondly you will need to manually install the NVIDIA drivers. I tried to do this via the Azure Portal and install the NVIDIA GPU Driver Extension, but this somehow kept failing and I had to go find the .exe’s to install them myself via RDP. You can find the drivers for Windows here: NVIDIA GPU Drivers For Windows. In my case I had to install both the CUDA and GRID drivers. I am running Windows Server 2019 Datacenter and the Windows Server 2016 drivers worked fine.