Configure GPU for Cloud Run jobs

You can use GPU with your Cloud Run jobs for AI and other compute-intensive workloads. When it comes to training, GPU excels at handling resource-heavy LLM tasks like inference, video processing, and background graphics jobs. Google provides NVIDIA RTX PRO 6000 Blackwell GPU with 96 GB of GPU memory (VRAM) for a full GPU or 48 GB of GPU memory (VRAM) for a fractional (0.5) GPU, and NVIDIA L4 GPU with 24 GB of GPU memory (VRAM). GPU memory is separate from instance memory.

When using an LLM, be sure to also see Best practices: Cloud Run jobs with GPU.

GPU on Cloud Run is fully managed, with no extra drivers or libraries required. Cloud Run GPU offers on-demand availability with no reservations needed, similar to the way on-demand CPU and on-demand memory work in Cloud Run.

Cloud Run container instances with an NVIDIA RTX PRO 6000 Blackwell Blackwell or L4 GPU start in about 5 seconds. Your container can use the GPU as soon as the startup finishes.

You can configure up to one GPU per Cloud Run container instance. If you use sidecar containers, the GPU can only be attached to one container.

Supported GPU types

Cloud Run supports two GPU types:

  • NVIDIA RTX PRO 6000 Blackwell GPU:

    • Full GPU with the current NVIDIA driver version is 580.x.x (13.0). This GPU requires a minimum of 20 CPU and 80 GiB of memory.
    • Fractional GPU with the current NVIDIA driver version is 580.x.x (13.0), type: GRID. Fractional GPU (0.5 GPU, 48 GB VRAM) requires 10, 12, 14, or 16 CPU and at least 40 GiB of memory (up to 4 GiB per CPU).
  • L4 GPU with the current NVIDIA driver version: 580.x.x (13.0). For L4 GPU, you must use a minimum of 4 CPU and 16 GiB of memory. Fractional GPU is not supported on L4 GPU.

Fractional GPU

Fractional GPU lets you to reduce your GPU allocation for models that don't require a full GPU, while still benefiting from the GPU's advanced architecture and performance. With a fractional GPU, you can have a more cost effective solution for inference workloads that don't need the full capabilities of a full-sized NVIDIA RTX PRO 6000 Blackwell GPU. See Known issues for fractional GPU limitations.

Supported regions

The following regions are supported by the NVIDIA RTX PRO 6000 Blackwell GPU:

  • asia-southeast1 (Singapore).
  • asia-south2 (Delhi, India).
  • europe-west4 (Netherlands) leaf icon Low CO2
  • us-central1 (Iowa) leaf icon Low CO2

Fractional NVIDIA RTX PRO 6000 Blackwell GPU (Preview) are available in the following regions:

The following regions are supported by the L4 GPU:

  • asia-southeast1 (Singapore)
  • asia-south1 (Mumbai) . This region is available by invitation only. Contact your Google Account team if you are interested in this region.
  • europe-west1 (Belgium) leaf icon Low CO2
  • europe-west4 (Netherlands) leaf icon Low CO2
  • us-central1 (Iowa) leaf icon Low CO2 . Additional resource scaling in this region might require a quota increase request. Contact your Google Account team if you are interested in this region.
  • us-east4 (Northern Virginia) . Additional resource scaling in this region might require a quota increase request. Contact your Google Account team if you are interested in this region.

Pricing impact

See Cloud Run pricing for GPU pricing details. Note the following requirements and considerations:

  • GPU for jobs follow No zonal redundancy pricing.
  • The CPU and memory configurations of your resource impact pricing.
  • GPU is billed for the entire duration of the instance lifecycle.

GPU non-zonal redundancy

The Cloud Run jobs feature provides non-zonal redundancy support only for GPU-enabled instances. With non-zonal redundancy enabled, Cloud Run attempts failover for GPU-enabled jobs on a best-effort basis. Cloud Run routes job executions to other zones only if sufficient GPU capacity is available at that moment. This option does not guarantee reserved capacity for failover scenarios but results in a lower cost per GPU second.

See configure a Cloud Run job with GPU for details on enabling non-zonal redundancy.

Request a quota increase

Quota for Cloud Run nvidia-rtx-pro-6000 GPU is granted in milliGPUs. A full (1) nvidia-rtx-pro-6000 GPU consumes 1,000 milliGPUs of quota, and a fractional (0.5) nvidia-rtx-pro-6000 GPU consumes 500 milliGPUs of quota. Projects using nvidia-rtx-pro-6000 GPU in a region for the first time will be automatically granted 3,000 milliGPU quota (zonal redundancy off) when the first deployment is created. This is equivalent to 3 full GPUs or 6 fractional (0.5) GPUs. Projects using Cloud Run nvidia-l4 GPU in a region for the first time are automatically granted 3 GPU quota (zonal redundancy off) when the first deployment is created.

Note that this automatic quota grant is subject to availability depending on your CPU and memory capacity. This limits the count of GPUs that might be active across all of the project's services, jobs, and worker pools at any given time.

If you need additional Cloud Run GPUs for jobs, request a quota increase.

Before you begin

The following list describes requirements and limitations when using GPU in Cloud Run:

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. Enable the Cloud Run API, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  7. Consult Best practices: Cloud Run jobs with GPU for optimizing performance when using Cloud Run jobs with GPU.
  8. Ensure your job meets the minimum memory and CPU requirements based on the type of GPU you are using.

Required roles

To get the permissions that you need to configure Cloud Run jobs, ask your administrator to grant you the following IAM roles on jobs:

  • Cloud Run Developer (roles/run.developer) - the Cloud Run job
  • Service Account User (roles/iam.serviceAccountUser) - the service identity

For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions. If your Cloud Run job interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide. For more information about granting roles, see deployment permissions and manage access.

Configure a Cloud Run job to use GPU

You can configure a Cloud Run job to use GPU using the Google Cloud console, the gcloud CLI, or YAML:

Console

  1. In the Google Cloud console, go to the Cloud Run page:

    Go to Cloud Run

  2. Select Jobs from the Cloud Run navigation menu:

    1. If you are creating a new job, click Deploy container to fill out the initial job settings page.

    2. If you are configuring an existing job, select the job, then click View and edit job configuration.

  3. Click Containers, Connections, Security to expand the job properties page.

  4. Click the Containers tab.

  5. Configure memory and CPU following the requirements in Supported GPU types.

  6. Select the GPU checkbox.

  7. Select the GPU type and Number of GPUs.

  8. Click Create or Update.

gcloud

To enable non-zonal redundancy, you must specify --no-gpu-zonal-redundancy. This is required for using GPU with jobs.

To create a job with GPU enabled, use the gcloud run jobs create command:

    gcloud run jobs create JOB \
      --image=IMAGE_URL \
      --gpu=GPU_NUMBER \
      --gpu-type=GPU_TYPE \
      --no-gpu-zonal-redundancy

Replace the following:

  • JOB: the name of your Cloud Run job.
  • IMAGE_URL: a reference to the container image—for example, us-docker.pkg.dev/cloudrun/container/job:latest.
  • GPU_NUMBER: the number of GPU to attach (1 for a full GPU, or 0.5 for a fractional GPU).
  • GPU_TYPE: the GPU type. For NVIDIA RTX PRO 6000 Blackwell GPU, enter nvidia-rtx-pro-6000. For L4 GPU, enter value nvidia-l4 (nvidia-L4 lowercase L, not numeric value fourteen).

To update the GPU configuration for a job, use the gcloud run jobs update command:

    gcloud run jobs update JOB \
      --image IMAGE_URL \
      --cpu CPU \
      --memory MEMORY \
      --gpu GPU_NUMBER \
      --gpu-type GPU_TYPE \
      --parallelism PARALLELISM \
      --no-gpu-zonal-redundancy

Replace the following:

  • JOB: the name of your Cloud Run job.
  • IMAGE_URL: a reference to the container image—for example, us-docker.pkg.dev/cloudrun/container/job:latest.
  • CPU: the number of CPUs. Ensure this meets the minimum requirements.
  • MEMORY: the amount of memory. Ensure this meets the minimum requirements.
  • GPU_NUMBER: the number of GPU to attach (1 for a full GPU, or 0.5 for a fractional GPU).
  • GPU_TYPE: the GPU type. For NVIDIA RTX PRO 6000 Blackwell GPU, enter nvidia-rtx-pro-6000. For L4 GPU, enter value nvidia-l4 (nvidia-L4 lowercase L, not numeric value fourteen).
  • PARALLELISM: an integer value less than the lowest value of the applicable quota limits you allocated for your project.

YAML

You must set the annotation run.googleapis.com/gpu-zonal-redundancy-disabled: to true. This enables non-zonal redundancy, which is required for GPU for jobs.

  1. If you are creating a new job, skip this step. If you are updating an existing job, download its YAML configuration:

    gcloud run jobs describe JOB --format export > job.yaml
  2. Update the nvidia.com/gpu attribute, annotations: run.googleapis.com/launch-stage for launch stage, and nodeSelector:
    run.googleapis.com/accelerator
    :

    apiVersion: run.googleapis.com/v1
    kind: Job
    metadata:
      name: JOB
      labels:
        cloud.googleapis.com/location: REGION
    spec:
      template:
        metadata:
          annotations:
            run.googleapis.com/gpu-zonal-redundancy-disabled: 'true'
        spec:
          template:
            spec:
              containers:
              - image: IMAGE_URL
                limits:
                  cpu: 'CPU'
                  memory: 'MEMORY'
                  nvidia.com/gpu: 'GPU_NUMBER'
              nodeSelector:
                run.googleapis.com/accelerator: GPU_TYPE

    Replace the following:

    • JOB: the name of your Cloud Run job.
    • REGION: the region where you want to deploy your job.
    • IMAGE_URL: a reference to the container image—for example, us-docker.pkg.dev/cloudrun/container/job:latest
    • CPU: the number of CPUs. Ensure this meets the minimum requirements.
    • MEMORY: the amount of memory. Ensure this meets the minimum requirements.
    • GPU_NUMBER: the number of GPU to attach (1 for a full GPU, or 0.5 for a fractional GPU).
    • GPU_TYPE: the GPU type. NVIDIA RTX PRO 6000 Blackwell GPU, enter nvidia-rtx-pro-6000. For L4 GPU, enter value nvidia-l4 (nvidia-L4 lowercase L, not numeric value fourteen).
  3. Create or update the job using the following command:

    gcloud run jobs replace job.yaml

    The gcloud run jobs replace command defaults to using job.yaml file if present.

View GPU settings

To view the current GPU settings for your Cloud Run job, use the Google Cloud console or the Google Cloud CLI:

Console

  1. In the Google Cloud console, go to the Cloud Run jobs page:

    Go to Cloud Run jobs

  2. Click the job to open the Job details page.

  3. Click View and edit job configuration.

  4. Locate the GPU setting in the configuration details.

gcloud

  1. Run the following command:

    gcloud run jobs describe JOB
  2. Locate the GPU setting in the returned configuration.

Detach GPU resources from a job

You can detach GPU resources from a job using the Google Cloud console, Google Cloud CLI or YAML.

Console

  1. In the Google Cloud console, go to the Cloud Run Jobs page:

    Go to Cloud Run

  2. In the jobs list, click a job to open that job's details.

  3. Click View and edit job configuration.

  4. Click Containers, Connections, Security to expand the job properties page.

  5. Click the Container tab.

  6. Clear the GPU checkbox.

  7. Click Update.

gcloud

To detach GPU resources from your Cloud Run job, set the number of GPU to 0 using the gcloud run jobs update command:

  gcloud run jobs update JOB --gpu 0
  

Replace JOB with the name of your Cloud Run job.

YAML

  1. If you are creating a new job, skip this step. If you are updating an existing job, download its YAML configuration:

    gcloud run jobs describe JOB --format export > job.yaml
  2. Delete the nvidia.com/gpu:, the run.googleapis.com/gpu-zonal-redundancy-disabled: 'true', and the nodeSelector: run.googleapis.com/accelerator: GPU_TYPE lines.

  3. Create or update the job using the following command:

    gcloud run jobs replace job.yaml

    The gcloud run jobs replace command defaults to using job.yaml file if present.

Driver libraries

By default, all of the NVIDIA RTX PRO 6000 Blackwell GPU and NVIDIA L4 GPU driver libraries are mounted under /usr/local/nvidia/lib64. Cloud Run automatically appends this path to the LD_LIBRARY_PATH environment variable (i.e. ${LD_LIBRARY_PATH}:/usr/local/nvidia/lib64) of the container with the GPU. This allows the dynamic linker to find the NVIDIA driver libraries. The linker searches and resolves paths in the order you list in the LD_LIBRARY_PATH environment variable. Any values you specify in this variable take precedence over the default Cloud Run driver libraries path /usr/local/nvidia/lib64.

If you want to use a CUDA version greater than 13.0, the easiest way is to depend on a newer NVIDIA base image with forward compatibility packages already installed. Another option is to manually install the NVIDIA forward compatibility packages and add them to LD_LIBRARY_PATH. Consult NVIDIA's compatibility matrix to determine which CUDA versions are forward compatible with the provided NVIDIA driver version.

About GPU and parallelism

If you are running parallel tasks in a job execution, determine and set parallelism value to less than the GPU quota without zonal redundancy allocated for your project. To request for a quota increase, see How to increase quota. GPU tasks start as quickly as possible and go up to a maximum that varies depending on how much GPU quota you allocated for the project and the region selected. Cloud Run deployments fail if you set parallelism to more than the GPU quota limit.

A full (1) nvidia-rtx-pro-6000 GPU consumes 1,000 milliGPUs of quota, and a fractional (0.5) nvidia-rtx-pro-6000 GPU consumes 500 milliGPUs of quota. To calculate the GPU quota your job uses per execution, multiply the number of GPU per job task with the parallelism value. For example, if you have a GPU quota of 10, and deploy your Cloud Run job with --gpu=1, --parallelism=10, then your job consumes all 10 GPU quota. Alternatively, if you deploy with --gpu=1, --parallelism=20, then deployments fail.

For more information, see Best practices: Cloud Run jobs with GPU.

What's next