|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# This file runs unit tests with Pathways backend. |
| 16 | + |
| 17 | +name: Run Pathways Tests |
| 18 | + |
| 19 | +on: |
| 20 | + workflow_call: |
| 21 | + inputs: |
| 22 | + device_type: |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + device_name: |
| 26 | + required: true |
| 27 | + type: string |
| 28 | + image_type: |
| 29 | + required: false |
| 30 | + type: string |
| 31 | + pytest_marker: |
| 32 | + required: true |
| 33 | + type: string |
| 34 | + pytest_addopts: |
| 35 | + required: false |
| 36 | + type: string |
| 37 | + default: '' |
| 38 | + is_scheduled_run: |
| 39 | + required: true |
| 40 | + type: string |
| 41 | + xla_python_client_mem_fraction: |
| 42 | + required: true |
| 43 | + type: string |
| 44 | + tf_force_gpu_allow_growth: |
| 45 | + required: true |
| 46 | + type: string |
| 47 | + container_resource_option: |
| 48 | + required: true |
| 49 | + type: string |
| 50 | + cloud_runner: |
| 51 | + required: false |
| 52 | + type: string |
| 53 | + |
| 54 | +jobs: |
| 55 | + run: |
| 56 | + runs-on: ${{ inputs.cloud_runner != '' && inputs.cloud_runner || fromJson(format('["self-hosted", "{0}", "{1}"]', inputs.device_type, inputs.device_name)) }} |
| 57 | + container: |
| 58 | + image: gcr.io/tpu-prod-env-multipod/maxtext_${{ github.run_id }}:${{ inputs.image_type != '' && inputs.image_type || inputs.device_type }} |
| 59 | + volumes: |
| 60 | + - ${{ github.workspace }}:/tmp |
| 61 | + env: |
| 62 | + XLA_PYTHON_CLIENT_MEM_FRACTION: ${{ inputs.xla_python_client_mem_fraction }} |
| 63 | + TF_FORCE_GPU_ALLOW_GROWTH: ${{ inputs.tf_force_gpu_allow_growth }} |
| 64 | + IFRT_PROXY_USE_INSECURE_GRPC_CREDENTIALS: true |
| 65 | + JAX_PLATFORMS: "proxy" |
| 66 | + JAX_BACKEND_TARGET: "grpc://localhost:29000" |
| 67 | + options: ${{ inputs.container_resource_option }} |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + - name: Run |
| 71 | + run: | |
| 72 | + if [ "${{ inputs.is_scheduled_run }}" = "true" ]; then |
| 73 | + FINAL_PYTEST_MARKER="${{ inputs.pytest_marker }}" |
| 74 | + else |
| 75 | + FINAL_PYTEST_MARKER="${{ inputs.pytest_marker }} and not scheduled_only" |
| 76 | + fi |
| 77 | + python3 -m pip install -e . --no-dependencies && |
| 78 | + python3 -m pip uninstall -y libtpu && |
| 79 | + # TODO(b/454659463): Enable test_default_hlo_match after volume mount is supported. |
| 80 | + python3 -m pytest ${{ inputs.pytest_addopts }} -v -m "${FINAL_PYTEST_MARKER}" -k "not test_default_hlo_match" --durations=0 |
| 81 | + |
| 82 | + services: |
| 83 | + resource_manager: |
| 84 | + image: us-docker.pkg.dev/cloud-tpu-v2-images/pathways/server:latest |
| 85 | + ports: |
| 86 | + - "29001:29001" |
| 87 | + - "29002:29002" |
| 88 | + options: |
| 89 | + --entrypoint=[/usr/pathways/run/cloud_pathways_server_sanitized, --server_port=29001, --node_type=resource_manager, --instance_count=1, --instance_type=tpuv4:2x2x1, --gcs_scratch_location=gs://cloud-pathways-staging/tmp] |
| 90 | + env: |
| 91 | + TPU_SKIP_MDS_QUERY: true |
| 92 | + |
| 93 | + worker: |
| 94 | + image: us-docker.pkg.dev/cloud-tpu-v2-images/pathways/server:latest |
| 95 | + ports: |
| 96 | + - "29005:29005" |
| 97 | + - "29006:29006" |
| 98 | + - "8471:8471" |
| 99 | + - "8080:8080" |
| 100 | + options: |
| 101 | + --entrypoint=[/usr/pathways/run/cloud_pathways_server_sanitized, --server_port=29005, --resource_manager_address=localhost:29001, --gcs_scratch_location=gs://cloud-pathways-staging/tmp] |
| 102 | + --tpu=4 |
| 103 | + |
| 104 | + proxy: |
| 105 | + image: us-docker.pkg.dev/cloud-tpu-v2-images/pathways/proxy_server:latest |
| 106 | + volumes: |
| 107 | + - ${{ github.workspace }}:/tmp |
| 108 | + ports: |
| 109 | + - "29000:29000" |
| 110 | + env: |
| 111 | + IFRT_PROXY_USE_INSECURE_GRPC_CREDENTIALS: true |
| 112 | + XLA_FLAGS: "--xla_dump_to=/tmp/aot_test_dump --xla_dump_hlo_as_text --xla_dump_hlo_module_re=jit_train_step" |
| 113 | + options: |
| 114 | + --entrypoint=[/usr/pathways/run/cloud_proxy_server_sanitized, --server_port=29000, --resource_manager_address=localhost:29001, --gcs_scratch_location=gs://cloud-pathways-staging/tmp, --xla_tpu_scoped_vmem_limit_kib=65536, --xla_tpu_spmd_rng_bit_generator_unsafe=true] |
0 commit comments