Vertex AI#

RAPIDS 可以部署在 Vertex AI Workbench 上。

创建新的笔记本实例#

  1. 在 Google Cloud UI 中,导航至 Vertex AI -> 笔记本 -> Workbench

  2. 选择 实例 并选择 + 新建

  3. 详细信息 部分为实例命名。

  4. 勾选“附加 1 个 NVIDIA T4 GPU”选项。

  5. 定制完机器的其他方面后,点击 创建

提示

如果您想选择不同的 GPU 或其他硬件选项,可以点击底部的“高级选项”,然后在“机器类型”部分进行更改。

安装 RAPIDS#

实例启动后,选择 打开 JUPYTER LAB 并在笔记本顶部安装您希望使用的 RAPIDS 库。

警告

目前无法在默认环境中通过 pip 安装 RAPIDS(详情见此),暂时您必须创建一个新的 conda 环境。

截至 2025 年 1 月的 Vertex AI 版本,Vertex AI 当前预装了 CUDA Toolkit 11 系统软件包。默认的 Python 环境也包含 cupy-cuda12x 软件包。这意味着无法通过 pip 安装像 cudf 这样的 RAPIDS 软件包,因为 cudf-cu12 将与 CUDA Toolkit 版本冲突,而 cudf-cu11 将与 cupy 版本冲突。

您可以通过运行 ls -ld /usr/local/cuda* 来查找当前系统的 CUDA Toolkit 版本。

您可以创建一个新的 RAPIDS conda 环境并将其注册到 ipykernel 中,以便在 Jupyter Lab 中使用。在 Jupyter 中打开新的终端并运行以下命令。

# Create a new environment
conda create -y -n rapids \
    -c rapidsai -c conda-forge -c nvidia \
    rapids=25.04 python=3.12 cuda-version=12.8 \
    ipykernel

# Activate the environment
conda activate rapids

# Register the environment with Jupyter
python -m ipykernel install --prefix "${DL_ANACONDA_HOME}/envs/rapids" --name rapids --display-name rapids

然后刷新 Jupyter Lab 页面并打开启动器。您会看到一个新的“rapids”内核可用。

Screenshot of the Jupyter Lab launcher showing the RAPIDS kernel

提示

如果您没有看到新内核,请稍等片刻,再次刷新页面,它可能需要一些时间才能显示出来。

测试 RAPIDS#

现在您应该能够打开笔记本并使用 RAPIDS 了。

例如,我们可以导入和使用像 cudf 这样的 RAPIDS 库。

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

相关示例#

用十亿行挑战赛衡量性能

tools/dask-cuda data-format/csv library/cudf library/cupy library/dask library/pandas cloud/aws/ec2 cloud/aws/sagemaker cloud/azure/azure-vm cloud/azure/ml cloud/gcp/compute-engine cloud/gcp/vertex-ai

用十亿行挑战赛衡量性能