getNVIDIAIntegratedGPUMemory detects NVIDIA unified-memory integrated GPUs (Jetson, DGX Spark/GB10, Thor) and reports system RAM figures as VRAM. Used as a fallback when nvidia-smi is missing or failing.
()
| 887 | // (Jetson, DGX Spark/GB10, Thor) and reports system RAM figures as VRAM. |
| 888 | // Used as a fallback when nvidia-smi is missing or failing. |
| 889 | func getNVIDIAIntegratedGPUMemory() []GPUMemoryInfo { |
| 890 | if !isNVIDIAIntegratedGPU() { |
| 891 | return nil |
| 892 | } |
| 893 | |
| 894 | name := nvidiaIntegratedGPUName() |
| 895 | |
| 896 | ramInfo, err := GetSystemRAMInfo() |
| 897 | if err != nil { |
| 898 | xlog.Debug("NVIDIA integrated GPU detected but failed to get system RAM", "error", err, "device", name) |
| 899 | return []GPUMemoryInfo{{ |
| 900 | Index: 0, |
| 901 | Name: name, |
| 902 | Vendor: VendorNVIDIA, |
| 903 | }} |
| 904 | } |
| 905 | |
| 906 | usagePercent := 0.0 |
| 907 | if ramInfo.Total > 0 { |
| 908 | usagePercent = float64(ramInfo.Used) / float64(ramInfo.Total) * 100 |
| 909 | } |
| 910 | |
| 911 | xlog.Debug("NVIDIA integrated GPU detected (unified memory)", "device", name, "total_ram", ramInfo.Total) |
| 912 | return []GPUMemoryInfo{{ |
| 913 | Index: 0, |
| 914 | Name: name, |
| 915 | Vendor: VendorNVIDIA, |
| 916 | TotalVRAM: ramInfo.Total, |
| 917 | UsedVRAM: ramInfo.Used, |
| 918 | FreeVRAM: ramInfo.Free, |
| 919 | UsagePercent: usagePercent, |
| 920 | }} |
| 921 | } |
| 922 | |
| 923 | // GetResourceInfo returns GPU info if available, otherwise system RAM info |
| 924 | func GetResourceInfo() ResourceInfo { |
no test coverage detected