gpu_darwin.go 729 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //go:build darwin
  2. package gpu
  3. import "C"
  4. import (
  5. "runtime"
  6. "github.com/jmorganca/ollama/api"
  7. )
  8. // CheckVRAM returns the free VRAM in bytes on Linux machines with NVIDIA GPUs
  9. func CheckVRAM() (int64, error) {
  10. // TODO - assume metal, and return free memory?
  11. return 0, nil
  12. }
  13. func GetGPUInfo() GpuInfo {
  14. // TODO - Metal vs. x86 macs...
  15. mem, _ := getCPUMem()
  16. return GpuInfo{
  17. Library: "default",
  18. memInfo: mem,
  19. }
  20. }
  21. func getCPUMem() (memInfo, error) {
  22. return memInfo{
  23. TotalMemory: 0,
  24. FreeMemory: 0,
  25. }, nil
  26. }
  27. func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
  28. if runtime.GOARCH == "arm64" {
  29. return 1
  30. }
  31. // metal only supported on arm64
  32. return 0
  33. }
  34. func nativeInit() error {
  35. return nil
  36. }