gpu_darwin.go 631 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. return GpuInfo{
  16. Library: "default",
  17. TotalMemory: 0,
  18. FreeMemory: 0,
  19. }
  20. }
  21. func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
  22. if runtime.GOARCH == "arm64" {
  23. return 1
  24. }
  25. // metal only supported on arm64
  26. return 0
  27. }
  28. func nativeInit() error {
  29. return nil
  30. }