Skip to content

feat(system_monitor): add NVIDIA GPU monitoring support for Windows and Linux#63

Open
ParthMozarkar wants to merge 3 commits intomofa-org:mainfrom
ParthMozarkar:feature/gpu-monitoring-nvml
Open

feat(system_monitor): add NVIDIA GPU monitoring support for Windows and Linux#63
ParthMozarkar wants to merge 3 commits intomofa-org:mainfrom
ParthMozarkar:feature/gpu-monitoring-nvml

Conversation

@ParthMozarkar
Copy link
Copy Markdown

Closes #48

This PR adds GPU monitoring support for Windows and Linux systems with NVIDIA GPUs using NVML (NVIDIA Management Library) via the nvml-wrapper crate.

The implementation integrates with the existing system monitoring infrastructure and provides real-time GPU utilization and VRAM usage metrics while maintaining safe fallbacks for unsupported systems.

Features

  • GPU Utilization Monitoring
    Reports GPU load percentage (0–100%).

  • VRAM Usage Monitoring
    Tracks memory usage (used / total VRAM).

  • Multi-GPU Support
    Automatically detects multiple NVIDIA GPUs and reports averaged utilization across all detected devices.

  • Graceful Fallback Handling
    If NVML initialization fails (for example on systems without NVIDIA GPUs), GPU monitoring is safely disabled without crashing the application.

Implementation Details

  • Added a nvidia_gpu module in system_monitor.rs, cfg-gated for Linux and Windows.
  • Created a NvidiaGpuStats struct mirroring the existing MacOSGpuStats pattern.
  • Implemented a query_gpu_stats() function using the nvml-wrapper crate.
  • Stored the NVML instance in a static OnceLock so it initializes once and is reused across polling cycles.
  • Integrated GPU monitoring with the existing system monitor background polling loop.

Dependencies

Added a target-specific dependency:

nvml-wrapper = "0.10"

Enabled only for:

cfg(any(target_os = "linux", target_os = "windows"))

Additional Fix

  • Fixed mofa-dora-bridge dependency configuration in mofa-ui by disabling default-features.
  • This prevents macOS-only MLX dependencies from being pulled when building on Windows.

This PR extends the system monitor with GPU telemetry support for Windows and Linux while keeping the architecture consistent with the existing macOS GPU monitoring implementation.

This commit adds a new AI-powered UI generation tool to MoFA Studio.
It includes:
- New mofa-ui-generator app crate.
- Integration into the MoFA Studio shell with a dedicated sidebar tab.
- Preview and Code views for generated UI.
- Standardized MofaApp trait implementation.
…x (NVIDIA)

Integrate nvml-wrapper crate for NVIDIA GPU monitoring on Windows and Linux.

Features:
- GPU utilization monitoring (0-100%)
- VRAM usage monitoring (used/total)
- Multi-GPU detection with averaged utilization
- Graceful fallback for non-NVIDIA systems (NVML init failure is handled)
- Static OnceLock for NVML instance (initialized once, reused)

Implementation:
- Added nvidia_gpu module (cfg-gated for linux/windows)
- Created NvidiaGpuStats struct mirroring MacOSGpuStats
- Implemented query_nvidia_gpu_stats() using nvml-wrapper
- Integrated with existing system monitor background loop
- Added nvml-wrapper 0.10 as target-specific dependency
- Fixed mofa-dora-bridge default-features to avoid MLX on Windows

Closes mofa-org#48
@ParthMozarkar
Copy link
Copy Markdown
Author

could any check wiith this ??

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.

feat(system_monitor): Add GPU monitoring support for Windows and Linux (NVIDIA)

1 participant