Skip to content

Commit 6391a3f

Browse files
nipung90facebook-github-bot
authored andcommitted
Call torchrec cpu tests from fbgemm test gha (#4424)
Summary: This diff kicks off the torchrec cpu unittests along with fbgemm's cpu tests when there is a pull request on fbgemm Differential Revision: D77598015
1 parent 0dbd1bc commit 6391a3f

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/fbgemm_gpu_ci_cpu.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,80 @@ jobs:
200200
env:
201201
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
202202
run: . $PRELUDE; publish_to_pypi $BUILD_ENV "$PYPI_TOKEN" *.whl
203+
204+
205+
# Run torchrec CPU tests
206+
torchrec_cpu_tests:
207+
if: ${{ github.repository_owner == 'pytorch' }}
208+
runs-on: ${{ matrix.host-machine.instance }}
209+
container:
210+
image: amazonlinux:2023
211+
options: --user root
212+
defaults:
213+
run:
214+
shell: bash
215+
env:
216+
PRELUDE: .github/scripts/setup_env.bash
217+
BUILD_ENV: build_binary
218+
BUILD_TARGET: ${{ matrix.build-target }}
219+
BUILD_VARIANT: cpu
220+
strategy:
221+
fail-fast: false
222+
matrix:
223+
host-machine: [
224+
{ arch: x86, instance: "linux.4xlarge", timeout: 20 },
225+
{ arch: arm, instance: "linux.arm64.2xlarge", timeout: 30 },
226+
]
227+
build-target: [ "default" ]
228+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
229+
compiler: [ "gcc", "clang" ]
230+
needs: build_artifact
231+
232+
steps:
233+
- name: Setup Build Container
234+
run: yum update -y; yum install -y binutils findutils git pciutils sudo wget which
235+
236+
- name: Checkout the Repository
237+
uses: actions/checkout@v4
238+
239+
- name: Download Wheel Artifact from GHA
240+
uses: actions/download-artifact@v4
241+
with:
242+
name: fbgemm_${{ matrix.build-target }}_${{ matrix.host-machine.arch }}_${{ matrix.compiler }}_py${{ matrix.python-version }}_cpu.whl
243+
244+
- name: Display System Info
245+
run: . $PRELUDE; print_system_info; print_ec2_info
246+
247+
- name: Display GPU Info
248+
run: . $PRELUDE; print_gpu_info
249+
250+
- name: Setup Miniconda
251+
run: . $PRELUDE; setup_miniconda $HOME/miniconda
252+
253+
- name: Create Conda Environment
254+
run: . $PRELUDE; create_conda_environment $BUILD_ENV ${{ matrix.python-version }}
255+
256+
- name: Install C/C++ Compilers for Updated LIBGCC
257+
run: . $PRELUDE; install_cxx_compiler $BUILD_ENV ${{ matrix.compiler }}
258+
259+
- name: Install PyTorch-CPU Nightly
260+
run: . $PRELUDE; install_pytorch_pip $BUILD_ENV ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.pytorch_channel_version) || 'nightly' }} cpu
261+
262+
- name: Collect PyTorch Environment Info
263+
if: ${{ success() || failure() }}
264+
run: if . $PRELUDE && which conda; then collect_pytorch_env_info $BUILD_ENV; fi
265+
266+
- name: Prepare FBGEMM_GPU Build
267+
run: . $PRELUDE; cd fbgemm_gpu; prepare_fbgemm_gpu_build $BUILD_ENV
268+
269+
- name: Install FBGEMM_GPU Wheel
270+
run: . $PRELUDE; install_fbgemm_gpu_wheel $BUILD_ENV *.whl
271+
272+
- name: Clone torchrec
273+
uses: actions/checkout@v4
274+
with:
275+
repository: pytorch/torchrec
276+
path: torchrec
277+
278+
- name: Run Pytorchrec CPU tests
279+
run: . $PRELUDE; cd torchrec/torchrec; ../../.github/scripts/test_torchrec.bash

0 commit comments

Comments
 (0)