如何使用 GCP 上的 nvidia-ngc-public 计算映像虚拟机自动安装 NVIDIA 驱动程序?

问题描述 投票:0回答:1

我正在尝试使用此处找到的映像将虚拟机部署到启用了 GPU 的 GCP 计算引擎。我已成功从公开可用的 NVIDIA 映像(例如来自

nvidia-gpu-cloud-image-2022061
项目的
nvidia-ngc-public
)创建虚拟机来创建虚拟机,但虚拟机在启动时强制提示安装驱动程序。因此,我必须通过 SSH 进入虚拟机,通过在安装驱动程序提示时回答“y”来手动安装 GPU 驱动程序。然后它将安装驱动程序。

我的问题是,我需要自动化此 GPU 驱动程序安装过程,以便我可以干净、确定地(固定驱动程序版本)使用通过 CI/CD 管道安装的驱动程序创建这些映像。实现这种自动化的最佳方法是什么?如果可能的话,我想避免创建自己的基础映像并安装所有驱动程序/依赖项。

我使用以下命令使用此映像创建了一个虚拟机:

gcloud compute instances create $INSTANCE_NAME --project=$PROJECT --zone=$ZONE --machine-type=n1-standard-16 \--maintenance-policy=TERMINATE --network-interface=network-tier=PREMIUM, subnet=default --service-account=my-service-account@$PROJECT.iam.gserviceaccount.com --scopes=https://www.googleapis.com/auth/cloud-platform --accelerator=count=1,type=nvidia-tesla-t4 --image=nvidia-gpu-cloud-image-2022061 --image-project=nvidia-ngc-public --boot-disk-size=200 --boot-disk-type=pd-standard --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any --no-restart-on-failure

然后我通过 SSH 连接到虚拟机并对提示回答“是”。

然后我使用

gcloud compute images create --source-disk $INSTANCE_NAME
保存了图像以供将来使用。

我怎样才能干净地实现自动化?

google-cloud-platform gpu virtual-machine nvidia google-cloud-compute-engine
1个回答
0
投票

您可以使用脚本来自动化安装过程。要查看这些脚本,请参阅 GitHub 存储库:https://github.com/GoogleCloudPlatform/compute-gpu-installation

© www.soinside.com 2019 - 2024. All rights reserved.