nvidia_windows.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //go:build windows
  2. // +build windows
  3. package nvidia
  4. import (
  5. "errors"
  6. "fmt"
  7. )
  8. // GPUDevice represents an NVIDIA GPU device
  9. type GPUDevice struct {
  10. Index int
  11. Handle interface{} // Placeholder for Windows
  12. Name string
  13. PCIBusID string
  14. Memory uint64 // Total memory in bytes
  15. UUID string
  16. }
  17. // GPUMetrics contains current GPU metrics
  18. type GPUMetrics struct {
  19. PowerDraw float64 // Watts
  20. PerformanceLevel string // P0, P8, etc.
  21. MemoryUsage float64 // Percentage
  22. GPUUtilization int // Percentage
  23. MemoryUtilization int // Percentage
  24. Temperature int // Celsius
  25. }
  26. // Init initializes the NVML library
  27. func Init() error {
  28. return errors.New("NVML is not supported on Windows build. Please use Linux build for production")
  29. }
  30. // Shutdown shuts down the NVML library
  31. func Shutdown() error {
  32. return nil
  33. }
  34. // GetGPUDevices returns all available GPU devices
  35. func GetGPUDevices() ([]GPUDevice, error) {
  36. return nil, errors.New("NVML is not supported on Windows build. Please use Linux build for production")
  37. }
  38. // GetGPUMetrics retrieves current metrics for a GPU device
  39. func GetGPUMetrics(device GPUDevice) (GPUMetrics, error) {
  40. return GPUMetrics{}, errors.New("NVML is not supported on Windows build. Please use Linux build for production")
  41. }
  42. // GetDeviceID generates a unique device identifier for MQTT topics
  43. func GetDeviceID(device GPUDevice) string {
  44. return "mock_device_id"
  45. }
  46. // GetShortPCIBusID formats PCI Bus ID from 00000000:04:00.0 to 00:04:00.0 (Windows stub)
  47. func GetShortPCIBusID(pciBusID string) string {
  48. return pciBusID
  49. }
  50. // GetDeviceDisplayName generates a display name in the format: {HOSTNAME} {PCI ID} - NVIDIA {MODEL} {VRAM}
  51. func GetDeviceDisplayName(device GPUDevice, hostname string) string {
  52. return fmt.Sprintf("%s 00:01:00.0 - NVIDIA Mock GPU 0GB", hostname)
  53. }
  54. // GetNVMLVersion returns the NVML version information (Windows stub)
  55. func GetNVMLVersion() (string, error) {
  56. return "", errors.New("NVML is not supported on Windows build. Please use Linux build for production")
  57. }
  58. // GetDriverVersion returns the NVIDIA driver version (Windows stub)
  59. func GetDriverVersion() (string, error) {
  60. return "", errors.New("NVML is not supported on Windows build. Please use Linux build for production")
  61. }
  62. // IsDeviceAvailable checks if a GPU device is still available and responsive (Windows stub)
  63. func IsDeviceAvailable(device GPUDevice) bool {
  64. return false
  65. }