<@ULVA73B9P> How do I setup my flow run that uses ...
# marvin-ai
j
@Marvin How do I setup my flow run that uses a GPC cloud run work pool to use GPUs
m
thought for 223.0 seconds
You can’t use GPUs with a GCP Cloud Run work pool. That’s a Cloud Run platform limitation, not a Prefect setting. Prefect’s Cloud Run work pool supports things like CPU, memory, timeout, region, etc., but not GPU attachment. If you need GPUs on GCP with Prefect, the right option is usually a Vertex AI work pool instead. What to do instead 1. Create a Vertex AI work pool
Copy code
bash
prefect work-pool create my-vertex-pool --type vertex-ai
2. Set GPU-related
job_variables
on the deployment
Copy code
yaml
deployments:
  - name: my-gpu-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-vertex-pool
      job_variables:
        region: us-central1
        image: <http://gcr.io/my-project/my-image:latest|gcr.io/my-project/my-image:latest>
        machine_type: n1-standard-4
        accelerator_type: NVIDIA_TESLA_T4
        accelerator_count: 1
Important notes - Your container image needs the right CUDA / ML libraries if your code expects GPU access. - The exact GPU types available depend on GCP/Vertex AI regional availability. - In Prefect 3, these GPU settings come from the
prefect-gcp
Vertex AI worker integration. Relevant docs / references - Prefect GCP Vertex AI worker API reference - GCP Vertex AI MachineSpec reference If you want, I can also show you: - a full
prefect.yaml
example for Vertex AI with GPU, or - how to migrate an existing Cloud Run deployment to Vertex AI.
j
Yes
@Marvin Do I have to use the vertex-ai work pool? Is there no way to use GPUs with my existing cloud run v2 work pool?
m
thought for 8.7 seconds
Short answer: yes, you need a different work pool type if you want GPUs on GCP. There’s no supported way to add GPUs to an existing Cloud Run v2 work pool, because Google Cloud Run itself does not offer GPU resources for the jobs/services Prefect uses there. So for Prefect on GCP: - Cloud Run v2 work pool → no GPUs - Vertex AI work pool → GPUs supported - Kubernetes work pool / worker on GKE → GPUs possible if your cluster/node pools have GPU nodes - VM-based approaches → also possible, but less managed So if you want to stay in GCP and use Prefect-managed infrastructure options, your main GPU-capable choices are: 1. Vertex AI work pool — easiest managed GCP path for GPU jobs 2. Kubernetes/GKE — best if you already run GPU workloads on Kubernetes If helpful, I can help you compare: - Vertex AI vs GKE for Prefect GPU workloads, or - convert your current Cloud Run deployment config into a Vertex AI one.