Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, explicamos como executar o pipeline do Dataflow com o tipo de GPU NVIDIA® L4.
O tipo de GPU L4 é útil para executar pipelines de inferência de machine learning.
Requisitos
Use a versão 2.46 ou posterior do SDK do Apache Beam. Recomendamos o Apache Beam 2.50 ou
mais recente.
É preciso ter uma cota de GPU L4 (NVIDIA_L4_GPUS) na região em que o job é executado.
Para mais informações, consulte as cotas de GPU.
O tipo de GPU L4 está disponível apenas com o tipo de máquina otimizado para acelerador G2.
Para mais informações, consulte
A série de máquinas G2.
Os pipelines que usam o tipo de GPU L4 estão sujeitos às
limitações padrão da G2.
O tipo de GPU NVIDIA L4 usa o driver NVIDIA versão 525.0 ou mais recente e o
kit de ferramentas CUDA
versão 12.0 ou mais recente. Todo código usado no pipeline precisa ser compatível com a versão do driver da NVIDIA e do kit de ferramentas CUDA. Por exemplo, se você usar o PyTorch, será necessário usar a versão 23.01 ou posterior.
GPU_COUNT: o número de GPUs a serem usadas. Cada tipo de máquina G2 tem um número fixo de GPUs NVIDIA L4. Para encontrar o número correto de GPUs para
seu tipo de máquina, consulte a coluna Contagem de GPUs na tabela
Tipos de máquina padrão G2.
O exemplo de Dockerfile a seguir contém dependências
compatíveis para um pipeline que usa o tipo de GPU NVIDIA L4.
RUN apt-get -y update
RUN apt-get install [system packages]
# Install the SDK.
RUN pip install --no-cache-dir apache-beam[gcp]==2.51.0
# Install the machine learning dependencies.
RUN pip install --no-cache-dir tensorflow[and-cuda]
RUN pip install xgboost
RUN pip install transformers accelerate
(etc…..)
# Verify that the image doesn't have conflicting dependencies.
RUN pip check
# Copy files from official SDK image, including the script and dependencies.
COPY --from=apache/beam_python3.10_sdk:2.51.0 /opt/apache/beam /opt/apache/beam
# Set the entrypoint to Apache Beam SDK launcher.
ENTRYPOINT ["/opt/apache/beam/boot"]
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-02 UTC."],[[["\u003cp\u003eDataflow jobs using GPUs, like the NVIDIA L4, will incur charges as specified on the Dataflow pricing page and must use Dataflow Runner v2.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the NVIDIA L4 GPU type, Dataflow pipelines must use Apache Beam SDK version 2.46 or later, with 2.50 or later being recommended, and have the necessary L4 GPU quota.\u003c/p\u003e\n"],["\u003cp\u003eThe L4 GPU type is exclusive to the G2 accelerator-optimized machine type, and pipelines using it are subject to G2 standard limitations, which requires specification of the machine type and GPU count in pipeline options.\u003c/p\u003e\n"],["\u003cp\u003ePipelines using the NVIDIA L4 GPU type must be compatible with NVIDIA driver version 525.0 or later and CUDA toolkit version 12.0 or later, which can be ensured by using a custom container to manage dependencies.\u003c/p\u003e\n"],["\u003cp\u003eThe NVIDIA L4 GPU type is ideal for running machine learning inference pipelines on Dataflow, and a dockerfile is provided for users to implement it.\u003c/p\u003e\n"]]],[],null,["# Use the NVIDIA® L4 GPU type\n\n\u003cbr /\u003e\n\n| **Note:** The following considerations apply to this GA offering:\n|\n| - Jobs that use GPUs incur charges as specified in the Dataflow [pricing page](/dataflow/pricing).\n| - To use GPUs, your Dataflow job must use [Dataflow Runner v2](/dataflow/docs/runner-v2).\n\n\u003cbr /\u003e\n\nThe page explains how to run your Dataflow pipeline with the NVIDIA® L4 GPU type.\nThe L4 GPU type is useful for running machine learning inference pipelines.\n\nRequirements\n------------\n\n- Use the Apache Beam SDK version 2.46 or later. Apache Beam 2.50 or later is recommended.\n- You need L4 GPU quota (`NVIDIA_L4_GPUS`) in the region that your job runs in. For more information, see [GPU quotas](/compute/resource-usage#gpu_quota).\n- The L4 GPU type is available only with the G2 accelerator-optimized machine type. For more information, see [The G2 machine series](/compute/docs/accelerator-optimized-machines#g2-vms). Pipelines that use the L4 GPU type are subject to the [G2 standard limitations](/compute/docs/accelerator-optimized-machines#g2_standard_limitations).\n- The NVIDIA L4 GPU type uses the NVIDIA driver version 525.0 or later and the [CUDA toolkit](https://developer.nvidia.com/cuda-toolkit) version 12.0 or later. Any code that you use in your pipeline must be compatible with the NVIDIA driver version and CUDA toolkit version. For example, if you use PyTorch, you need to use PyTorch version 23.01 or later.\n\nRun pipelines with the NVIDIA® L4 GPU type\n------------------------------------------\n\nTo use the NVIDIA L4 GPU type, you need to include the following\n[pipeline options](/dataflow/docs/reference/pipeline-options) and\n[service options](/dataflow/docs/reference/service-options)\nin your pipeline code. \n\n### Java\n\n --workerMachineType=\u003cvar translate=\"no\"\u003eG2_MACHINE_TYPE\u003c/var\u003e\n --dataflowServiceOptions=\"worker_accelerator=type:nvidia-l4;count:\u003cvar translate=\"no\"\u003eGPU_COUNT\u003c/var\u003e;install-nvidia-driver\"\n\n### Python\n\n --machine_type=\u003cvar translate=\"no\"\u003eG2_MACHINE_TYPE\u003c/var\u003e\n --dataflow_service_options=\"worker_accelerator=type:nvidia-l4;count:\u003cvar translate=\"no\"\u003eGPU_COUNT\u003c/var\u003e;install-nvidia-driver\"\n\n### Go\n\n --worker_machine_type=\u003cvar translate=\"no\"\u003eG2_MACHINE_TYPE\u003c/var\u003e\n --dataflow_service_options=\"worker_accelerator=type:nvidia-l4;count:\u003cvar translate=\"no\"\u003eGPU_COUNT\u003c/var\u003e;install-nvidia-driver\"\n\nReplace the following values:\n\n- \u003cvar translate=\"no\"\u003eG2_MACHINE_TYPE\u003c/var\u003e: the [G2 machine type](/compute/docs/accelerator-optimized-machines#g2-standard-vms) to use\n- \u003cvar translate=\"no\"\u003eGPU_COUNT\u003c/var\u003e: The number of GPUs to use. Each G2 machine type has a fixed number of NVIDIA L4 GPUs. To find the correct number of GPUs for your machine type, see the **GPU count** column in the [G2 standard machine types](/compute/docs/accelerator-optimized-machines#g2-standard-vms) table.\n\nFor more information about running pipelines with\nGPUs, see [Run a pipeline with GPUs](/dataflow/docs/gpu/use-gpus).\n\nManage dependencies\n-------------------\n\nTo manage dependencies, use a custom container.\nFor more information, see\n[Use custom containers in Dataflow](/dataflow/docs/guides/using-custom-containers).\n\nThe following Dockerfile example contains compatible\ndependencies for a pipeline that uses the NVIDIA L4 GPU type. \n\n RUN apt-get -y update\n RUN apt-get install [system packages]\n\n # Install the SDK.\n RUN pip install --no-cache-dir apache-beam[gcp]==2.51.0\n # Install the machine learning dependencies.\n RUN pip install --no-cache-dir tensorflow[and-cuda]\n RUN pip install xgboost\n RUN pip install transformers accelerate\n (etc.....)\n # Verify that the image doesn't have conflicting dependencies.\n RUN pip check\n\n # Copy files from official SDK image, including the script and dependencies.\n COPY --from=apache/beam_python3.10_sdk:2.51.0 /opt/apache/beam /opt/apache/beam\n\n # Set the entrypoint to Apache Beam SDK launcher.\n ENTRYPOINT [\"/opt/apache/beam/boot\"]\n\nWhat's next\n-----------\n\n- Read about [best practices for working with Dataflow GPUs](/dataflow/docs/gpu/develop-with-gpus).\n- [Run a pipeline with GPUs](/dataflow/docs/gpu/use-gpus).\n- Learn more about [Dataflow ML](/dataflow/docs/machine-learning)."]]