gpu_darwin.go 655 B

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