Manage GPUs via Discrete Device Assignment (preview)

Applies to: Azure Stack HCI, version 23H2

This article describes how to manage GPU DDA with Arc virtual machines (VMs). For GPU DDA management on AKS enabled by Azure Arc, see Use GPUs for compute-intensive workloads.

Discrete Device Assignment (DDA) allows you to dedicate a physical graphical processing unit (GPU) to your workload. In a DDA deployment, virtualized workloads run on the native driver and typically have full access to the GPU's functionality. DDA offers the highest level of app compatibility and potential performance.

Important

This feature is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Prerequisites

Before you begin, satisfy the following prerequisites:

  • Follow the set up instructions found at Prepare for GPUs for Azure Stack HCI to prepare your Azure Stack HCI cluster and Arc VMs and to ensure that your GPUs are prepared for DDA.

Attach a GPU during Arc VM creation

Follow the steps outlined in Create Arc virtual machines on Azure Stack HCI and utilize the additional hardware profile details to add GPU to your create process.

az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --storage-path-id $storagePathId --gpus GpuDDA

Attach a GPU after Arc VM creation

Use the following CLI command to attach the GPU:

az stack-hci-vm gpu attach --resource-group "test-rg" --custom-location "test-location" --vm-name "test-vm" --gpus GpuDDA

After attaching the GPU, the output shows the full VM details. You can confirm the GPUs were attached by reviewing the hardware profile virtualMachineGPUs section - the output looks like this:

"properties":{
	"hardwareProfile":{
		"virtualMachineGPUs":[
			{
				"assignmentType": "GpuDDA",
				"gpuName": "NVIDIA A2",
				"partitionSizeMb": null
			}
         ],

For details on the GPU attach command, see az stack-hci-vm gpu.

Detach a GPU

Use the following CLI command to detach the GPU:

az stack-hci-vm gpu detach --resource-group "test-rg" --custom-location "test-location" --vm-name "test-vm"

After detaching the GPU, the output shows the full VM details. You can confirm the GPUs were detached by reviewing the hardware profile virtualMachineGPUs section - the output looks like this:

"properties":{
	"hardwareProfile":{
		"virtualMachineGPUs":[],

For details on the GPU attach command, see az stack-hci-vm gpu.

Next steps