Overview: Configure a Jupyter notebook to use GPUs for AI/ML modeling
Prepare your Jupyter notebook server for using a GPU
Red Hat OpenShift Data Science is a managed cloud service for data scientists and developers of artificial intelligence (AI) applications. It provides a fully supported environment in which to rapidly develop, train, and test machine learning models in the public cloud before deploying them in production. OpenShift Data Science can be hosted in Red Hat OpenShift Dedicated or Red Hat OpenShift Service on AWS, which simplifies cloud operations for the developer.
In this learning path, you will walk through configuring a Jupyter notebook to use GPUs for AI/ML modeling. You will learn how to use PyTorch to examine GPU resources, then load and run a PyTorch model.
Start your Jupyter notebook server
Let's start by setting up options for your Jupyter notebook server. If you can’t remember how to launch JupyterHub, go back to the Launch JupyterHub learning path.
Select options for your notebook server
When you first gain access to JupyterHub, a configuration screen (Figure 1) gives you the opportunity to select a notebook image and configure its options, including the number of GPUs. You can customize the following options:
- Notebook image
- Deployment size
- Number of GPUs
- Environment variables
The following subsections list which prerequisites you need to choose for this activity.
You can choose from a number of predefined images. The JupyterLab instance that is created based on your choice has the associated libraries and packages that you need to do your work.
Available notebook images include:
- Minimal Python
- Standard Data Science
For this learning path, choose the PyTorch notebook image.
You can choose different deployment sizes based on the type of data analysis and machine learning code you are working on. Each deployment size is pre-configured with specific CPU and memory resources.
For this learning path, select the Small deployment size.
Number of GPUs
Depending on the GPU Machine pool added to your cluster, you may be able to select one or more GPUs. For this learning path, you need one GPU.
The environment variables section is useful for injecting dynamic information that you don't want to save in your notebook. This learning path does not use any environment variables.
If you are satisfied with your notebook server selections, click the Start Server button to start the notebook server.
A dialogue box saying Starting Server will appear. After the Success message appears (Figure 2), you will shortly be transferred to your JupyterLab instance.
If this procedure is successful, you have started your Jupyter notebook server.