Repository navigation
feat(telemetry): report host and per-server memory usage - #3584
Conversation
|
🌿 Preview your docs: https://nvidia-preview-ananthsub-memory-profiling.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
27b37d7 to
acf7d05
Compare
acf7d05 to
b628e4c
Compare
|
Related to #3155. Implements the server memory-footprint portion through process-tree RSS/PSS metrics; per-worker runtime, GC, event-loop, and request-cycle telemetry remain out of scope. |
iguehring-nvidia
left a comment
There was a problem hiding this comment.
Thx much! Two minor things:
-
The switch is only reachable through
YAML. telemetry.memory_profiling.enabledis a nested field and is not in_ENV_FIELD_MAP, soconfigure_telemetry_envnever translates it and_start_memory_profilernever reads a variable for it. For a job submitted with gym eval submit, Gym's telemetry is switched on entirely through the driver's environment (NEMO_GYM_OTEL_ENABLED, _SPAN_GROUPS, _LOGS_ENABLED, …), so memory profiling would stay off unless every benchmark config carries the block. Could you add a flattened mapping, e.g. memory_profiling.enabled → NEMO_GYM_OTEL_MEMORY_PROFILING_ENABLED (and the interval), following the existing Gym-owned flags in _ENV_FIELD_MAP? Then #3619 can turn it on with one line and every orchestrated run gets it. -
Pointing out some overlap with @oyilmaz-nvidia 's PR #2935. That PR also adds nemo_gym/telemetry/memory.py, with a different design: psutil sampling inside each server at span close, emitting host-wide gym.host.memory_* and a per-process gym.process_tree.memory_used_mib.
Signed-off-by: Ananth Subramaniam <[email protected]>
b628e4c to
1212a08
Compare
|
@iguehring-nvidia Thanks — addressed both points in 1212a08.
|
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35930553349 |
What changed
Add centralized, opt-in memory profiling to NeMo Gym's existing Lens/OpenTelemetry integration. One periodic orchestrator sampler reports:
Users can enable the profiler through YAML or environment variables. Environment-only enablement supports
gym eval submitand other orchestrated runs without editing benchmark configs:Disabled runs create no sampler thread and perform no memory reads. Detached/reparented processes and remote Ray actors are explicitly outside per-server accounting; host metrics still expose their contribution to node pressure.
Related to #3155. This implements the centralized memory portion; runtime GC, event-loop, and request-cycle telemetry remain out of scope.
Relationship to #2935
PR #2935 also introduces host and process-tree memory reads, sampled inline when spans close. This focused PR centralizes that memory contract behind one periodic sampler so idle periods remain visible and request completion does not trigger repeated process-tree walks. It adds PSS, logical-server identity, process count, available memory, and sampled peaks. The broader correlation/concurrency work in #2935 can consume these latest readings for span attributes when rebased, while dropping its overlapping memory module.
Local runtime evidence
gym.server.memory.sampled_peakretained 206 MB.Validation
uv run pytest tests/unit_tests/telemetry/ tests/unit_tests/test_cli.py tests/unit_tests/test_server_utils.py -q— 354 passed.uv run pytest tests/unit_tests/telemetry/test_memory.py --cov=nemo_gym.telemetry.memory --cov-report=term-missing --cov-fail-under=0 -q— 15 passed, 98.20% profiler coverage.uv run pre-commit run --all-files— passed.cd fern && npm run check— 0 errors, 1 existing warning.uv run gym dev teston the prior upstream base — 5,667 passed and 2 unrelated CLI output-wrapping assertions failed locally; both reproduced in isolation because Rich wraps long temporary paths despite the tests settingCOLUMNS=1000.Rollout evidence
N/A for model rollout behavior: this change affects application telemetry only and does not alter agents, verifiers, datasets, rewards, or model requests. The real multi-worker and high-concurrency HTTP smoke tests above exercise the changed runtime path directly.
Compatibility
Telemetry and memory profiling remain disabled by default. Server PSS requires Linux
smaps_rollup; when unavailable, Gym emits RSS fromstatmand omits PSS. Host usage is calculated as total minus available. Sampled peaks can miss allocations shorter than the configured interval and are documented as sampled rather than exact cgroup lifetime peaks.