Skip to content

Add low-overhead GPU progress heartbeat monitoring - #1243

Open
lzy-edu wants to merge 9 commits into
flagos-ai:mainfrom
lzy-edu:agent/add-gpu-heartbeat-monitoring
Open

Add low-overhead GPU progress heartbeat monitoring#1243
lzy-edu wants to merge 9 commits into
flagos-ai:mainfrom
lzy-edu:agent/add-gpu-heartbeat-monitoring

Conversation

@lzy-edu

@lzy-edu lzy-edu commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Category

Train

PR Types

New Features

PR Description

This PR adds a standalone, low-overhead GPU heartbeat monitoring capability for distributed training.

The main changes include:

  • Record per-rank GPU progress heartbeats from existing Megatron fault-tolerance integration points.
  • Run heartbeat recording on the CPU side without CUDA synchronization.
  • Collect low-frequency, node-local GPU health information through nvidia-smi.
  • Correlate each training rank with its assigned GPU.
  • Integrate heartbeat lifecycle management into the training runner and SSH launcher.
  • Write heartbeat status and findings as machine-readable JSONL logs.
  • Add unit tests and two-worker integration scenarios.

The heartbeat distinguishes between:

  • Rank process liveness.
  • GPU training progress.
  • Low-frequency GPU hardware health status.

Usage

Enable heartbeat under experiment.runner in the training configuration:

experiment:
  runner:
    no_shared_fs: false
    heartbeat:
      enabled: true
      publish_interval_s: 5
      process_timeout_s: 30
      progress_timeout_s: 300
      checkpoint_timeout_s: 1800
      hardware_health:
        enabled: true
        interval_s: 60

After enabling the heartbeat, start the FlagScale training task with the existing launch command. No additional build step or separate monitoring command is required.

The runner automatically:

  • Starts a lightweight heartbeat publisher for each training rank.
  • Starts an optional GPU health collector on each node.
  • Starts the heartbeat monitor on node 0.
  • Stops the related monitoring processes when training finishes.

Results

Heartbeat monitoring results are written to:

<log_dir>/heartbeat/<run_id>/
├── status.json
├── findings.jsonl
├── rank_<rank>*pid*<pid>.heartbeat.jsonl
└── gpu_health_node_<node_rank>.json

The expected behavior is:

  • During normal training, each rank is reported as alive, and its GPU training progress is reported as progressing. No timeout finding is generated.
  • After training completes normally, each rank is reported as exited, and its GPU progress is reported as completed.
  • If a rank process or its heartbeat thread becomes unresponsive, a rank_process_heartbeat_timeout finding is recorded.
  • If a rank process remains alive but its training progress stops advancing, a gpu_progress_timeout finding is recorded.
  • When hardware health collection is enabled, the health status of the GPU assigned to the affected rank is included as supporting evidence.

For example, when a rank remains alive but its training progress stalls, findings.jsonl contains a record similar to:

{
  "finding_type": "gpu_progress_timeout",
  "rank": 1,
  "process_liveness": "alive",
  "gpu_progress": "stalled",
  "reason": "rank_alive_but_gpu_progress_not_advancing"
}

These results make it possible to distinguish a rank process that has become unresponsive from a live rank whose GPU training progress has stalled, while also correlating the issue with optional GPU hardware health information.

tengqm and others added 2 commits July 18, 2026 19:16
…#1240)

Add standard Apache 2.0 copyright header (Copyright 2026 FlagOS
Contributors) to all source files.

- **703 files** stamped with Apache 2.0 headers
- **80 files** with upstream copyright (HuggingFace, Physical
Intelligence, NVIDIA) — left untouched
- **104 files** with other licenses (51 MPL, 41 proprietary, 10 MIT, 2
BSD) — third-party/upstream code
- **31 files** skipped by rule — binary, JSON, etc.

This PR was written in part with the assistance of generative AI.
lzy-edu and others added 6 commits July 21, 2026 17:31
…. 2026/7/21 (flagos-ai#1244)

<!--
 Copyright 2026 FlagOS Contributors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->

### PR Category
<!-- One of [ Train | Inference | Compress | Serve | RL | Core |
Hardware | CICD | Tools | Others ] -->
[CICD]
### PR Types
<!-- One of [ User Experience | New Features | Bug Fixes | Improvements
| Performance | Breaking Change| Deprecations | Test Case | Docs |
Others ] -->
Test Case
### PR Description
<!-- Describe what you’ve done -->
update  golden value of functional_test hetero_train and train.
### PR Category
<!-- One of [ Train | Inference | Compress | Serve | RL | Core |
Hardware | CICD | Tools | Others ] -->
Train
### PR Types
<!-- One of [ User Experience | New Features | Bug Fixes | Improvements
| Performance | Breaking Change| Deprecations | Test Case | Docs |
Others ] -->
Others
### PR Description
<!-- Describe what you’ve done -->
Update qwen3vl for the current `Megatron-LM-FL` and add functional
tests.
…#1242)

These data files are compared against test outputs line-by-line and
cannot contain license headers — adding them broke CI functional tests
(e.g., inference/qwen3/4b_tp2).

## Files fixed (7)

| File | 
|---|
| inference/deepseek_r1_distill_qwen/results_gold/7b_tp2 |
| inference/deepseek_r1_distill_qwen_flaggems/results_gold/7b_tp2 |
| inference/qwen3/results_gold/4b_tp2 |
| inference/qwen3/results_gold/4b_tp2_ascend |
| inference/qwen3_flaggems/results_gold/4b_tp2 |
| inference/robobrain2/results_gold/7b_tp2 |
| inference/robobrain2_flaggems/results_gold/7b_tp2 |

The one JSON gold file (`rl/qwen2_5/results_gold/0_5b.json`) was not
affected — JSON doesn't support comments so the header was never added
there.

Closes flagos-ai#1241's inference test failure.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: zhaoyingli <86812880+zhaoyinglia@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants