-
Notifications
You must be signed in to change notification settings - Fork 232
[proto/rqd/rust_rqd/cuebot/rest_gateway/cueadmin/cuegui] Feat(GPU): Production-grade, cross-platform GPU support - vendor-aware scheduling, per-device telemetry, isolation, and docs #2036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ramonfigueiredo
wants to merge
3
commits into
AcademySoftwareFoundation:master
Choose a base branch
from
ramonfigueiredo:feature/robust-gpu-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[proto/rqd/rust_rqd/cuebot/rest_gateway/cueadmin/cuegui] Feat(GPU): Production-grade, cross-platform GPU support - vendor-aware scheduling, per-device telemetry, isolation, and docs #2036
ramonfigueiredo
wants to merge
3
commits into
AcademySoftwareFoundation:master
from
ramonfigueiredo:feature/robust-gpu-support
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…per-device tracking Implement Phase 1 of comprehensive GPU support enhancement: - Issue: [GPU/Proto/RQD/Cuebot/RESTGateway/CueAdmin/CueGUI] OpenCue GPU Support - Comprehensive Audit and Implementation Plan - AcademySoftwareFoundation#2035 Protobuf schema extensions: - Add `GpuDevice` message with `vendor`, `model`, `memory`, `PCI bus`, `driver version`, and `CUDA`/`Metal` version fields to `host.proto` - Add `GpuUsage` message for per-device utilization tracking (`util %`, `memory used`) - Extend `Host` and `NestedHost` messages with `gpu_devices` repeated field - Extend `RenderHost` with `gpu_devices` for detailed GPU inventory reporting - Extend `RunningFrameInfo` with `gpu_usage` for per-frame GPU metrics - Add GPU constraint fields to Layer: `gpu_vendor`, `gpu_models_allowed`, `min_gpu_memory_bytes` for scheduler filtering - Add `gpu_usage` to `Frame` and `UpdatedFrame` messages for accounting RQD GPU discovery implementation: - Implement `GpuDiscovery` abstract base class for pluggable GPU backends - Implement `NvidiaGpuDiscovery` with `NVML` (`pynvml`) support and `nvidia-smi` fallback for detailed NVIDIA GPU metadata collection - Implement `AppleMetalGpuDiscovery` for macOS Apple Silicon GPU detection via `system_profiler` JSON parsing - Update Machine class with platform-specific GPU discovery initialization (Linux - NVIDIA, Darwin - Apple Metal, Windows - NVIDIA) - Populate `gpu_devices` in `RenderHost` for all platforms (`Linux`, `macOS`, `Windows`) GPU isolation and monitoring: - Set `CUDA_VISIBLE_DEVICES` and `NVIDIA_VISIBLE_DEVICES` environment variables in `rqcore.py` for proper GPU isolation in launched frames - Collect per-device GPU utilization in `__updateGpuAndLlu()` using new `getGpuUtilization()` method - Add `gpuUsage` list to `RunningFrame` class for tracking per-frame GPU metrics - Extend `runningFrameInfo()` to include `gpu_usage` in `RunningFrameInfo` proto Update VERSION.in Dependencies: - Add pynvml > = 11.5.0 to `rqd/pyproject.toml` for `NVML` GPU querying All changes maintain backward compatibility via optional/repeated proto fields. Legacy `num_gpus` and `gpu_memory` fields preserved for existing clients.
d698c39 to
ae28d59
Compare
Implement cross-platform GPU discovery and monitoring infrastructure for Rust RQD, mirroring the Python RQD architecture to enable robust GPU support across both implementations.
1) New module: `system/gpu.rs`
- Add `GpuDiscovery` trait defining abstract GPU discovery interface with `detect_devices()` and `get_utilization()` methods
- Implement `NvidiaGpuDiscovery` with NVML support (via optional `nvml-wrapper` crate) and `nvidia-smi` fallback for detailed NVIDIA GPU metadata collection
- Implement `AppleMetalGpuDiscovery` for macOS Apple Silicon GPU detection via `system_profiler` JSON parsing
- Add `create_gpu_discovery()` factory function for platform-specific backend selection (Linux - NVIDIA, macOS - Apple - Metal, Windows - NVIDIA)
2) `system/manager.rs`:
- Import `GpuDevice` and `GpuUsage` from `opencue_proto::host`
- Extend `MachineGpuStats` with `gpu_devices`: `Vec<GpuDevice>` for detailed GPU inventory alongside legacy `count`/`memory` fields
- Extend `ProcessStats` with `gpu_usage`: `Vec<GpuUsage>` for `per-device` utilization tracking in running frames
- Update `ProcessStats::default()` and `ProcessStats::update()` to handle new `gpu_usage` field
3) `system/mod.rs`:
- Expose gpu module with pub mod gpu
4) `Cargo.toml`:
- Add optional `nvml` feature flag for NVML support
- Add `nvml-wrapper = { version = "0.10", optional = true }` dependency
Architecture:
- Trait-based abstraction matches Python class hierarchy for consistency
- Optional NVML dependency via Cargo features allows compilation without NVIDIA-specific dependencies
- Cross-platform design supports Linux (NVIDIA), macOS (Apple Metal), and Windows (NVIDIA) from the start
- Backward compatible: retains legacy GPU fields in `MachineGpuStats`
- Reuses `opencue_proto::host::{GpuDevice, GpuUsage}` proto messages directly
Build with NVML: `cargo build --release --features nvml`
Build without NVML: `cargo build --release (fallback to nvidia-smi)`
Remaining integration work tracked in RUST_GPU_IMPLEMENTATION_SUMMARY.md:
- Integrate GPU discovery into `MachineMonitor`
- Populate `gpu_devices` in `RenderHost` reports
- Add `CUDA_VISIBLE_DEVICES`/`NVIDIA_VISIBLE_DEVICES` environment variables
- Collect per-frame GPU utilization during stats collection
be760b3 to
6d3e8cc
Compare
Collaborator
|
Great work so far. My only comment is that pynvml dependency should be optional. |
Collaborator
|
Besides the protobuf errors: |
Co-authored-by: Diego Tavares <[email protected]> Signed-off-by: Ramon Figueiredo <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link the Issue(s) this Pull Request is related to.
Summarize your change.
PHASE 1:
A) Protobuf
Protobuf schema extensions:
GpuDevicemessage withvendor,model,memory,PCI bus,driver version, andCUDA/Metalversion fields tohost.protoGpuUsagemessage for per-device utilization tracking (util %,memory used)HostandNestedHostmessages withgpu_devicesrepeated fieldRenderHostwithgpu_devicesfor detailed GPU inventory reportingRunningFrameInfowithgpu_usagefor per-frame GPU metricsgpu_vendor,gpu_models_allowed,min_gpu_memory_bytesfor scheduler filteringgpu_usagetoFrameandUpdatedFramemessages for accountingB) Python RQD
[rqd/rust_rqd/proto] Add robust GPU support with cross-platform discovery and per-device tracking
RQD GPU discovery implementation:
GpuDiscoveryabstract base class for pluggable GPU backendsNvidiaGpuDiscoverywithNVML(pynvml) support andnvidia-smifallback for detailed NVIDIA GPU metadata collectionAppleMetalGpuDiscoveryfor macOS Apple Silicon GPU detection viasystem_profilerJSON parsinggpu_devicesinRenderHostfor all platforms (Linux,macOS,Windows)GPU isolation and monitoring:
CUDA_VISIBLE_DEVICESandNVIDIA_VISIBLE_DEVICESenvironment variables inrqcore.pyfor proper GPU isolation in launched frames__updateGpuAndLlu()using newgetGpuUtilization()methodgpuUsagelist toRunningFrameclass for tracking per-frame GPU metricsrunningFrameInfo()to includegpu_usageinRunningFrameInfoprotoDependencies:
rqd/pyproject.tomlforNVMLGPU queryingAll changes maintain backward compatibility via optional/repeated proto fields.
Legacy
num_gpusandgpu_memoryfields preserved for existing clients.B) Rust RQD
[rust_rqd] Add GPU discovery infrastructure to Rust RQD
Implement cross-platform GPU discovery and monitoring infrastructure for Rust RQD, mirroring the Python RQD architecture to enable robust GPU support across both implementations.
system/gpu.rsGpuDiscoverytrait defining abstract GPU discovery interface withdetect_devices()andget_utilization()methodsNvidiaGpuDiscoverywith NVML support (via optionalnvml-wrappercrate) andnvidia-smifallback for detailed NVIDIA GPU metadata collectionAppleMetalGpuDiscoveryfor macOS Apple Silicon GPU detection viasystem_profilerJSON parsingcreate_gpu_discovery()factory function for platform-specific backend selection (Linux - NVIDIA, macOS - Apple - Metal, Windows - NVIDIA)system/manager.rs:GpuDeviceandGpuUsagefromopencue_proto::hostMachineGpuStatswithgpu_devices:Vec<GpuDevice>for detailed GPU inventory alongside legacycount/memoryfieldsProcessStatswithgpu_usage:Vec<GpuUsage>forper-deviceutilization tracking in running framesProcessStats::default()andProcessStats::update()to handle newgpu_usagefieldsystem/mod.rs:Cargo.toml:nvmlfeature flag for NVML supportnvml-wrapper = { version = "0.10", optional = true }dependencyArchitecture:
MachineGpuStatsopencue_proto::host::{GpuDevice, GpuUsage}proto messages directlyBuild with NVML:
cargo build --release --features nvmlBuild without NVML:
cargo build --release (fallback to nvidia-smi)Remaining integration work tracked in RUST_GPU_IMPLEMENTATION_SUMMARY.md:
MachineMonitorgpu_devicesinRenderHostreportsCUDA_VISIBLE_DEVICES/NVIDIA_VISIBLE_DEVICESenvironment variables