Azure Virtual Machine#

Create Virtual Machine#

Create a new Azure Virtual Machine with GPUs, the NVIDIA Driver and the NVIDIA Container Runtime.

NVIDIA maintains a Virtual Machine Image (VMI) that pre-installs NVIDIA drivers and container runtimes, we recommend using this image as the starting point.

  1. Select the latest NVIDIA GPU-Optimized VMI version from the drop down list, then select Get It Now.

  2. If already logged in on Azure, select continue clicking Create.

  3. In Create a virtual machine interface, fill in required information for the vm. Select a GPU enabled VM size.

Note that not all regions support availability zones with GPU VMs.

When the GPU VM size is not selectable with notice: The size is not available in zone x. No zones are supported. It means the GPU VM does not support availability zone. Try other availability options.

azure-gpuvm-availability-zone-error

Click Review+Create to start the virtual machine.

Prepare the following environment variables.

Name

Description

Example

AZ_VMNAME

Name for VM

RapidsAI-V100

AZ_RESOURCEGROUP

Resource group of VM

rapidsai-deployment

AZ_LOCATION

Region of VM

westus2

AZ_IMAGE

URN of image

nvidia:ngc_azure_17_11:ngc-base-version-22_06_0-gen2:22.06.0

AZ_SIZE

VM Size

Standard_NC6s_v3

AZ_USERNAME

User name of VM

rapidsai

AZ_SSH_KEY

public ssh key

~/.ssh/id_rsa.pub

az vm create \
        --name ${AZ_VMNAME} \
        --resource-group ${AZ_RESOURCEGROUP} \
        --image ${AZ_IMAGE} \
        --location ${AZ_LOCATION} \
        --size ${AZ_SIZE} \
        --admin-username ${AZ_USERNAME} \
        --ssh-key-value ${AZ_SSH_KEY}

Note

Use az vm image list --publisher Nvidia --all --output table to inspect URNs of official NVIDIA images on Azure.

Note

See this link for supported ssh keys on Azure.

Create Network Security Group#

Next we need to allow network traffic to the VM so we can access Jupyter and Dask.

  1. Select Networking in the left panel.

  2. Select Add inbound port rule.

  3. Set Destination port ranges to 8888,8787. Keep rest unchanged. Select Add.

Name

Description

Example

AZ_NSGNAME

NSG name for the VM

${AZ_VMNAME}NSG

AZ_NSGRULENAME

Name for NSG rule

Allow-Dask-Jupyter-ports

az network nsg rule create \
    -g ${AZ_RESOURCEGROUP} \
    --nsg-name ${AZ_NSGNAME} \
    -n ${AZ_NSGRULENAME} \
    --priority 1050 \
    --destination-port-ranges 8888 8787

Install RAPIDS#

Next, we can SSH into our VM to install RAPIDS. SSH instructions can be found by selecting Connect in the left panel.

There are a selection of methods you can use to install RAPIDS which you can see via the RAPIDS release selector.

For this example we are going to run the RAPIDS Docker container so we need to know the name of the most recent container. On the release selector choose Docker in the Method column.

Then copy the commands shown:

docker pull rapidsai/rapidsai-core:22.12-cuda11.5-runtime-ubuntu20.04-py3.9
docker run --gpus all --rm -it \
    --shm-size=1g --ulimit memlock=-1 \
    -p 8888:8888 -p 8787:8787 -p 8786:8786 \
    rapidsai/rapidsai-core:22.12-cuda11.5-runtime-ubuntu20.04-py3.9

Test RAPIDS#

In the terminal we can open ipython and check that we can import and use RAPIDS libraries like cudf.

In [1]: import cudf
In [2]: df = cudf.datasets.timeseries()
In [3]: df.head()
Out[3]:
                       id     name         x         y
timestamp
2000-01-01 00:00:00  1020    Kevin  0.091536  0.664482
2000-01-01 00:00:01   974    Frank  0.683788 -0.467281
2000-01-01 00:00:02  1000  Charlie  0.419740 -0.796866
2000-01-01 00:00:03  1019    Edith  0.488411  0.731661
2000-01-01 00:00:04   998    Quinn  0.651381 -0.525398

You can also access Jupyter via <VM ip>:8888 in the browser. Visit cudf/10-min.ipynb and execute the cells to try things out.

When running a Dask cluster you can also visit <VM ip>:8787 to monitor the Dask cluster status.