|
| 1 | +name: QA CPP Unittest |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - add_qa_teat251230 |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.actor }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + qa-l0-cppunittes: |
| 17 | + runs-on: self-hosted |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + shell: bash |
| 21 | + container: |
| 22 | + image: localhost:5000/flagscale:cuda12.8.1-cudnn9.10.2-torch2.9.1-py3.10-transformerengine_fl |
| 23 | + ports: |
| 24 | + - 80:80 |
| 25 | + options: >- |
| 26 | + --gpus all |
| 27 | + --shm-size=500g |
| 28 | + --privileged |
| 29 | + --ipc=host |
| 30 | + --ulimit memlock=-1 |
| 31 | + --ulimit stack=67108864 |
| 32 | + --ulimit nofile=65535:65535 |
| 33 | + --user root |
| 34 | +
|
| 35 | + steps: |
| 36 | + - name: Checkout Code |
| 37 | + uses: actions/checkout@v6.0.1 |
| 38 | + with: |
| 39 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 40 | + ref: ${{ github.event.pull_request.head.ref }} |
| 41 | + ssh-strict: true |
| 42 | + ssh-user: git |
| 43 | + persist-credentials: true |
| 44 | + clean: true |
| 45 | + sparse-checkout-cone-mode: true |
| 46 | + fetch-tags: false |
| 47 | + show-progress: true |
| 48 | + lfs: false |
| 49 | + submodules: recursive |
| 50 | + set-safe-directory: true |
| 51 | + |
| 52 | + - name: Pre-Check Environment |
| 53 | + timeout-minutes: 5 |
| 54 | + run: | |
| 55 | + set -euo pipefail |
| 56 | + echo "===== System Info =====" |
| 57 | + uname -a |
| 58 | + python3 --version || (echo "❌ python3 not found"; exit 1) |
| 59 | + pip3 --version || (echo "❌ pip3 not found"; exit 1) |
| 60 | +
|
| 61 | + echo "===== GPU Info =====" |
| 62 | + if command -v nvidia-smi &>/dev/null; then |
| 63 | + nvidia-smi --query-gpu=index,name,memory.total,utilization.gpu --format=csv |
| 64 | + else |
| 65 | + echo "⚠️ GPU check skipped. nvidia-smi is not available in the current environment." |
| 66 | + exit 1 |
| 67 | + fi |
| 68 | +
|
| 69 | + nvcc --version || echo "⚠️ nvcc not found (non-fatal for python-only install)" |
| 70 | +
|
| 71 | + echo "===== Disk Space =====" |
| 72 | + df -h |
| 73 | +
|
| 74 | + echo "===== Available memory =====" |
| 75 | + free -h |
| 76 | +
|
| 77 | + - name: Install dependencies and build transformer_engine |
| 78 | + timeout-minutes: 30 |
| 79 | + run: | |
| 80 | + echo "\n=============== Install transformer_engine ===============" |
| 81 | + pip install --no-build-isolation -vvv . --no-deps |
| 82 | + cp -rf transformer_engine/plugins/ /usr/local/lib/python3.10/dist-packages/transformer_engine/plugins/ |
| 83 | +
|
| 84 | + - name: Verify installation |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + python3 tests/pytorch/test_sanity_import.py |
| 88 | +
|
| 89 | + - name: GPU Usage Check / Verification |
| 90 | + run: | |
| 91 | + source .github/workflows/scripts/gpu_check.sh |
| 92 | + wait_for_gpu |
| 93 | + |
| 94 | + - name: L0 CPP Unittest |
| 95 | + id: L0_cppunittest |
| 96 | + continue-on-error: true |
| 97 | + timeout-minutes: 10 |
| 98 | + env: |
| 99 | + TE_PATH: . |
| 100 | + run: | |
| 101 | + TE_LIB_PATH=$(pip3 show transformer-engine | grep -E "Location:|Editable project location:" | tail -n 1 | awk '{print $NF}') |
| 102 | + TE_CPP_LIB_PATH="${TE_LIB_PATH}/transformer_engine" |
| 103 | + export CMAKE_PREFIX_PATH="${TE_CPP_LIB_PATH}:${CMAKE_PREFIX_PATH}" |
| 104 | + export LD_LIBRARY_PATH="${TE_CPP_LIB_PATH}:${LD_LIBRARY_PATH}" |
| 105 | + NUM_PHYSICAL_CORES=$(nproc) |
| 106 | + NUM_PARALLEL_JOBS=4 |
| 107 | +
|
| 108 | + cd $TE_PATH/tests/cpp |
| 109 | + cmake -GNinja -Bbuild . -DTE_LIB_PATH="${TE_CPP_LIB_PATH}" |
| 110 | + cmake --build build |
| 111 | + export OMP_NUM_THREADS=$((NUM_PHYSICAL_CORES / NUM_PARALLEL_JOBS)) |
| 112 | + ctest --test-dir build -j$NUM_PARALLEL_JOBS |
0 commit comments