Using Jupyter Notebook with a GPU
Overview
RapidMiner AI Hub Helm chart allows you to deploy Jupyter Notebooks with customizable resource profiles.
Each profile specifies compute resources, node selection, and GPU allocation.
The profiles are defined in the values.yml
file and are configured to suit a range of workloads,
from CPU-only tasks to high-performance GPU tasks.
Notebook Profiles in values.yml
Default Notebook
A standard notebook with 2 CPUs and 3 GB memory suitable for general-purpose tasks.
The chart itself has the same node_selector value as this notebook as this notebook doesn't require a dedicated nodegroup.
node_selector:
rapidminer.com/workload-type: "aihub"
Single NVidia GPU Notebook
A notebook set up with a single NVIDIA GPU, 3.5 CPUs, and 28 GB memory, ideal for light GPU-based computations.
The configurations below are required for scheduling this type of nodebooks onto GPU nodes, that has the label
rapidminer.com/workload-type: "single-nvidia-gpu"
, the taintnvidia.com/gpu: "true"
and has 1 GPU card (for example g5.2xlarge type in AWS)
node_selector:
rapidminer.com/workload-type: "single-nvidia-gpu"
tolerations:
- key: "nvidia.com/gpu"
operator: "Equal"
value: "true"
effect: "NoSchedule"
extra_resource_limits:
nvidia.com/gpu: "1"
Four NVidia GPU Notebook
A high-performance notebook with four NVidia GPUs, 40 CPUs, and 170 GB memory, designed for heavy GPU-based computational workloads
The configurations below are required for scheduling this type of nodebooks onto GPU nodes, that has the label
rapidminer.com/workload-type: "four-nvidia-gpu"
, the taintnvidia.com/gpu: "true"
and has 4 GPU card (for example g5.12xlarge type in AWS)
node_selector:
rapidminer.com/workload-type: "four-nvidia-gpu"
tolerations:
- key: "nvidia.com/gpu"
operator: "Equal"
value: "true"
effect: "NoSchedule"
extra_resource_limits:
nvidia.com/gpu: "4"
Key Configuration Parameters
Node Selector
The node_selector
field ensures that notebooks can be scheduled on nodes with specific labels. For example:
node_selector:
rapidminer.com/workload-type: "single-nvidia-gpu"
Tolerations
By default, GPU nodes has taints that blocks other workloads to be scheduled on tainted nodes.
The tolerations
field shall be used to allow the scheduler to assign the GPU notebook to GPU nodes.
The following example assumes, that the node has the taint
nvidia.com/gpu: "true"
tolerations:
- key: "nvidia.com/gpu"
operator: "Equal"
value: "true"
effect: "NoSchedule"
GPU Requests
The extra_resource_limits
field specifies the number of GPUs allocated to the notebook.
extra_resource_limits:
nvidia.com/gpu: "1"
How to Configure Notebook Profiles
Profiles can be found formatted in the notebook-profiles-formatted.json file and using the following command it can be comressed to a single line text that can be used in the jupyterHub section in values.yml file.
jq -c . < notebook-profiles-formatted.json
The suggested best practice is to:
1. Edit the notebook-profiles-formatted.json
file and save it.
2. Run the compression command, copy it's output and paste it as a value of the profiles
property in the jupyterHub
section.
2. Apply the Helm chart and try to open the Jupyter notebook service from the landing page, you should see a profile selecor.
Notes
In this sample notebook profile setup we assumed, that the kubernetes cluster has at least two extra GPU nodegroups: - a type with a single nvidia gpu (g5.2xlarge) with the required labels and taints and - a type with four nvidia gpu (g5.12xlarge) with the required labels and taints
Please note that default taints and labels may vary at different cloud providers, but you can have your customized layout by tainting nodes and adding labels as required.
Please note that you can list the labels and taints of a node if you run the
kubectl describe <NODENAME>
command.Please refer to KubeSpawner documentation for additional details on profile customization.