Skip to content

Tier 2 (local): run the RUN_SERIAL deinterlace tests on their own cores beside the suite #2773

Closed

Description

@vpacher

Problem

In one Tier 2 container (the local gate's tier2-linux lane, or run.py on a developer host), ctest runs the five test_deinterlace_2x_field_order_<rate> tests with RUN_SERIAL. Each test runs alone, and all other ctest jobs are idle while it runs. The tests are real-time tests: under concurrent load, CI dropped fields (#1343, #1643), so the isolation is necessary.

On a large host, this barrier is most of the Tier 2 time. Measured on a 24-core host with OBS_CTEST_JOBS=16 (one mode):

Part Time
The five deinterlace tests, one after the other, alone 147 s
The other 587 tests (longest: test_slideshow_mem_cap, 95 s) about 95 s
ctest, total 242 s

For the two modes, this is 294 s of the 568 s of tier2-linux. CI does not have this problem: it runs the serial part on separate runners (#2071, #2072).

Measurement: own cores instead of RUN_SERIAL

The isolation that #1643 needs is CPU time, not an empty machine. I ran the serial part concurrently with the suite part, on separate CPUs (taskset), in the validate container with an existing build tree:

  • Suite part: ctest -j14 -E '^test_deinterlace_2x_field_order_' on CPUs 10-23.
  • Serial part, at the same time: the five rates concurrently, each in its own process with LP_NUM_THREADS=1 and its own xvfb-run, each on two CPUs (0-1, 2-3, ..., 8-9).
  • 10 iterations.

Results:

  • Deinterlace: 0 failures in 50 rate runs. The time of each rate (27.7 s to 33.3 s) is the same as when the rate runs alone.
  • The serial part takes about 31 s, against 147 s. One iteration (both parts) takes about 94 s, against 242 s for one mode today. The suite part is now the longest part.
  • Host temperature and an NDI/OBS workload on the same Proxmox host were not affected (0 skipped frames).

Note: my harness did not mount the checkout at /ro, so 33 suite tests that need source data failed in every iteration. They also fail alone in that harness, so this is not an effect of the load. A run through validate.sh will not have this problem.

Proposal

An opt-in in rust/tools/linux-validate/validate.sh, for example OBS_TIER2_SERIAL_CPUS=<cpu list>:

  1. When the variable is set and OBS_CTEST_PART and OBS_CTEST_SHARD are not set, each mode runs its two parts at the same time: the serial part on the given CPUs, the suite part on the remaining CPUs. select_part already gives the two test lists.
  2. When the variable is not set, nothing changes. CI does not set it, so CI and the serial runners of perf(ci): cut the Tier 2 critical path of merge-queue runs (11 min, measured 2026-10-24) #2072 do not change.
  3. run.py passes the variable into the container. The local gate can then set it on a large host.

Points to decide:

  • Pin each serial test to its own CPUs (as in the measurement), or run ctest -R <serial> -j5 on the whole serial CPU set. The first is what I measured.
  • The two ctest processes share the build tree. Testing/Temporary/CTestCostData.txt and LastTest.log must not be written by both. A possible solution: run one part with its own --test-dir-independent log and cost file, or merge the two cost files after the run.
  • Each part needs its own xvfb-run -a display.
  • A failure in one part must fail the mode, and both logs must stay complete.

Possible second step

In each case, about 550 ms are fixed sleeps: 300 ms after the frames are played and 250 ms to drain the output (check_field_order()). The burst cases already wait for rendered frames with wait_ticks() instead of a fixed time. The same change for the other cases would make each case about 25 % shorter, also on the CI serial runners. It needs its own repeated runs, because an incomplete drain can affect the next case. This is a separate change.

Related

🤖 Generated with Claude Code

Activity

  1. zackees commented on Oct 28, 2026

    @zackees
    Member

    Claiming: investigation

    Investigating the measurement in the report and shaping it into one opt-in PR (default behaviour unchanged).

    Plan:

    1. Confirm the two-part selection already on master (OBS_CTEST_PART, serial-tests.py) and that the serial part cannot be parallelised through ctest: each of the five tests carries the RUN_SERIAL property, which keeps them one-at-a-time even under -j. So the implementation follows the measurement — the serial part runs each test as its own process, pinned, with its own xvfb-run.
    2. RED: a stdlib ci/test_*.py that fails on master — it asserts validate.sh honours OBS_TIER2_SERIAL_CPUS and that a serial runner module exists and runs registry tests concurrently on separate CPUs.
    3. GREEN: rust/tools/linux-validate/serial-runner.py (reads the CTest registry, filters RUN_SERIAL, runs each command pinned to its own CPUs with LP_NUM_THREADS=1, prefixes and keeps each log, non-zero if any test fails), the validate.sh branch that runs the suite part and the serial part at the same time, and the run.py passthrough so the container sees the variable.
    4. Evidence: a run of the real five deinterlace tests through the new module inside the validate image against this checkout's build tree, plus the before/after wall time for one mode.

    Decisions:

    • Pinning. Each serial test on its own CPU pair, as measured (option 1 of the report). It is what was proven: 50/50 runs, per-rate time unchanged.
    • Shared build tree. The serial part does not use ctest at all, so CTestCostData.txt / LastTest.log have a single writer (the suite part). No merge step and no second --test-dir. The trade-off: the five serial tests lose their cost entries — they are pinned one per CPU pair anyway, so ctest's longest-first scheduling has nothing to order.
    • Displays. Every serial test gets its own xvfb-run -a (the measurement's shape), so the available display number stays the suite part's business.
    • Failure. Either part failing fails the mode; both logs are kept ($build.ctest-<mode>.log for the suite, $build.serial-<mode>.log for the serial part).
    • Default. Unset OBS_TIER2_SERIAL_CPUS changes nothing; CI does not set it, so the serial runners of perf(ci): cut the Tier 2 critical path of merge-queue runs (11 min, measured 2026-10-24) #2072 are untouched.
  2. added
    infra
    on Oct 28, 2026
  3. zackees commented on Oct 28, 2026

    @zackees
    Member

    /ready

    Triage: the measurements and the proposal are complete and the shape is one opt-in PR (plan in the claim above). Scope: OBS_TIER2_SERIAL_CPUS in validate.sh + run.py passthrough + a serial runner module, offline tests, default unchanged. Opt-in, ~48% off one mode locally (242 s -> ~94 s measured).

  4. added
    needs-investigation
    on Oct 28, 2026
  5. added
    ready
    and removed
    needs-investigation
    on Oct 28, 2026
  6. zackees commented on Oct 28, 2026

    @zackees
    Member

    Claiming: Tier 2 local: run the RUN_SERIAL part beside the suite on its own CPUs (OBS_TIER2_SERIAL_CPUS)

    Proceeding with the plan and decisions in the claim above. One PR from fix/2773-serial-cpus, RED first (offline tests), default unchanged.

  7. zackees commented on Oct 28, 2026

    @zackees
    Member

    Progress: PR #2779 (draft) has the RED and the GREEN.

    • RED 56a85edd8: ci/test_tier2_serial_cpus.py, seven of ten cases fail on master (no OBS_TIER2_SERIAL_CPUS, no serial runner).
    • GREEN 73c795cd1: rust/tools/linux-validate/serial-runner.py (run / suite-cpus / pin), the validate.sh concurrent branch (with a guard against combining it with OBS_CTEST_PART/OBS_CTEST_SHARD), the run.py passthrough, a README section, and ci/test_tier2_env.py reading the new test_env_pairs array.

    Decisions as claimed: per-test CPU pairs as measured; the serial part has no ctest of its own (so CTestCostData.txt keeps a single writer, and the five pinned tests lose cost entries that had nothing to order a one-per-pair schedule); one xvfb-run -a per test; either part failing fails the mode with both logs kept; untouched when unset.

    Measured here (16 cores, serial 0-9, suite 10-15) in the Tier 2 image against this checkout's build tree:

    • standalone: 5/5 passed, 31.6 s wall (the same five are 147 s one-after-another per the report);
    • concurrent with the suite part: serial 33.4 s, 5/5 passed while tree.ctest-OFF.log was still running the suite tests (10/585, each 17-19 s). The suite part on this 8-physical-core box is much slower than the reporter's 24-core measurement, so I stopped that run at 15 min instead of quoting a full-mode total.

    Local checks: the new and neighbouring ci/test_* sets pass (66 + 53 tests), ruff check clean. Waiting on PR CI.

  8. zackees commented on Oct 28, 2026

    @zackees
    Member

    PR #2779 is ready and queued for the merge queue (CI green: Format, Fast Gate, Tier 2 Linux build + tests OFF/ON + both serial shards, CI Gate).

    What landed vs the report:

    • OBS_TIER2_SERIAL_CPUS=<cpu list> is the opt-in in validate.sh, passed through by run.py; unset, the lane is unchanged and CI (which never sets it) keeps the perf(ci): cut the Tier 2 critical path of merge-queue runs (11 min, measured 2026-10-24) #2072 serial runners.
    • The serial part runs each test as its own process on its own CPU pair (pinned, LP_NUM_THREADS=1, own xvfb-run -a, own log). It deliberately does not use ctest: RUN_SERIAL keeps those tests one-at-a-time even under -j, and a second concurrent ctest would race the suite part's CTestCostData.txt. Consequence: the five pinned tests lose cost entries, which had nothing to order anyway.
    • Measured here (16-core, serial 0-9 / suite 10-15): 5/5 in 31.6 s standalone (147 s one-after-another per the report) and 33.4 s beside a running suite part.

    Still open, deliberately: the "possible second step" (replace the 550 ms fixed sleeps with wait_ticks()) is a separate change with its own repeat-run evidence, as the report says.

  9. zackees commented on Oct 28, 2026

    @zackees
    Member

    Closing: implemented by #2779 (merged 11:51Z as a direct follow-up of this issue).

    • OBS_TIER2_SERIAL_CPUS in rust/tools/linux-validate/validate.sh runs the RUN_SERIAL deinterlace part beside the suite part, each rate in its own process with LP_NUM_THREADS=1 and its own xvfb-run on its own CPU pair; unset, nothing changes, so CI is untouched.
    • rust/tools/linux-validate/serial-runner.py is the runner, run.py passes the variable into the container, and the README documents the knob.
    • Measured: 5/5 in 31.6 s wall standalone (147 s one after another), 33.4 s alongside the suite part.
    • Tests: ci/test_tier2_serial_cpus.py (10 cases) plus the tier2/run/env/fanout suites (66) and the ci/ proof suites (53) all green; ruff clean.

    Not changed, deliberately: RUN_SERIAL stays on the ctest side, so the default local gate and CI keep today's behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions