4.4 Enable GPU Compute Capabilities in a Notebook through the Python Interpreter
This topic demonstrates how to enable GPU compute capabilities in a notebook through the Python interpreter. It also shows how to get information about the current GPU on which the notebook is running, and other details.
Prerequisites:
- Paid Autonomous Database Serverless database instances.
- The GPU feature is enabled for Oracle Autonomous
Data Warehouse Serverless or Oracle Autonomous Transaction
Processing Serverless instances with 16 or more ECPUs
specified for the OML application. For cost details, refer
to the Oracle PaaS and IaaS Universal Credits Service
Descriptions document available on the Oracle Cloud Services
contracts page.
Note:
The GPU feature is not supported for Notebooks Classic. - While basic NVIDIA libraries are included with the
base environment, you are expected to create a custom Conda
environment with the GPU-enabled 3rd party libraries
required for your project. Only GPU-enabled packages will
benefit from GPUs in Python paragraphs.
Note:
By default, pre-installed and pre-configured NVIDIA libraries are provided to the GPU interpreter container in the host VM. However, third-party Python packages that use GPUs typically require specific versions of NVIDIA CUDA libraries as dependencies, which may override the included libraries. - Third-party GPU-enabled Python packages. In this
example, we use
pytorch
.
Note:
There is an expected delay in starting a notebook with GPU compute capabilities due to reserving and starting the GPU resources, which may take a few minutes.Generating embeddings using transformer models can be done in Python memory
using OML Notebooks' Python interpreter. Using GPUs, transformer models,
e.g., for generating sentence and image embeddings, can process larger
volume data more quickly and efficiently.
To use the GPU compute capability in OML Notebooks:
- Create a Conda environment with the desired third-party GPU-enabled Python packages (ADMIN role required).
- Download and activate the Conda environment in OML Notebooks to use the GPU compute capabilities (OML_DEVELOPER role required).
- In OML Notebooks, select the notebook type gpu from the Update Notebook Type drop-down menu in the notebook editor (OML_DEVELOPER role required). This setting is persisted in the notebook until you change it to another type.
To enable GPU compute capabilities in a notebook, and to view information
on GPU: