Notebooks
A
Azure
Azure Ml With Nvidia Rapids

Azure Ml With Nvidia Rapids

azure-mldata-sciencenotebookRAPIDSmachine-learningcontribazure-machine-learningdeep-learningazuremlazure-ml-notebooksazure

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

Impressions

NVIDIA RAPIDS in Azure Machine Learning

The RAPIDS suite of software libraries from NVIDIA enables the execution of end-to-end data science and analytics pipelines entirely on GPUs. In many machine learning projects, a significant portion of the model training time is spent in setting up the data; this stage of the process is known as Extraction, Transformation and Loading, or ETL. By using the DataFrame API for ETL and GPU-capable ML algorithms in RAPIDS, data preparation and training models can be done in GPU-accelerated end-to-end pipelines without incurring serialization costs between the pipeline stages. This notebook demonstrates how to use NVIDIA RAPIDS to prepare data and train model in Azure.

In this notebook, we will do the following:

  • Create an Azure Machine Learning Workspace
  • Create an AMLCompute target
  • Use a script to process our data and train a model
  • Obtain the data required to run this sample
  • Create an AML run configuration to launch a machine learning job
  • Run the script to prepare data for training and train the model

Prerequisites:

  • An Azure subscription to create a Machine Learning Workspace
  • Familiarity with the Azure ML SDK (refer to notebook samples)
  • A Jupyter notebook environment with Azure Machine Learning SDK installed. Refer to instructions to setup the environment

Verify if Azure ML SDK is installed

[ ]
[ ]

Create Azure ML Workspace

The following step is optional if you already have a workspace. If you want to use an existing workspace, then skip this workspace creation step and move on to the next step to load the workspace.

Important: in the code cell below, be sure to set the correct values for the subscription_id, resource_group, workspace_name, region before executing this code cell.

[ ]

Load existing Workspace

[ ]

Create AML Compute Target

Because NVIDIA RAPIDS requires P40 or V100 GPUs, the user needs to specify compute targets from one of NC_v3, NC_v2, ND or ND_v2 virtual machine types in Azure; these are the families of virtual machines in Azure that are provisioned with these GPUs.

Pick one of the supported VM SKUs based on the number of GPUs you want to use for ETL and training in RAPIDS.

The script in this notebook is implemented for single-machine scenarios. An example supporting multiple nodes will be published later.

[ ]

Script to process data and train model

[ ]

Data required to run this sample

This sample uses Fannie Mae's Single-Family Loan Performance Data. Once you obtain access to the data, you will need to make this data available in an Azure Machine Learning Datastore, for use in this sample. The following code shows how to do that.

Downloading Data

[ ]
[ ]

Uploading Data to Workspace

[ ]

Create AML run configuration to launch a machine learning job

RunConfiguration is used to submit jobs to Azure Machine Learning service. When creating RunConfiguration for a job, users can either

  1. specify a Docker image with prebuilt conda environment and use it without any modifications to run the job, or
  2. specify a Docker image as the base image and conda or pip packages as dependnecies to let AML build a new Docker image with a conda environment containing specified dependencies to use in the job

The second option is the recommended option in AML. The following steps have code for both options. You can pick the one that is more appropriate for your requirements.

Specify prebuilt conda environment

The following code shows how to install RAPIDS using conda. The rapids.yml file contains the list of packages necessary to run this tutorial. NOTE: Initial build of the image might take up to 20 minutes as the service needs to build and cache the new image; once the image is built the subequent runs use the cached image and the overhead is minimal.

[ ]

Using Docker

Alternatively, you can specify RAPIDS Docker image.

[ ]

Wrapper function to submit Azure Machine Learning experiment

[ ]

Submit experiment (ETL & training on GPU)

[ ]

Submit experiment (ETL on GPU, training on CPU)

To observe performance difference between GPU-accelerated RAPIDS based training with CPU-only training, set 'cpu_predictor' predictor to 'True' and rerun the experiment

[ ]

Delete cluster

[ ]