2023-11-14 01:20:34 +00:00
|
|
|
//go:build darwin
|
|
|
|
|
2023-11-29 19:00:37 +00:00
|
|
|
package gpu
|
2023-11-14 01:20:34 +00:00
|
|
|
|
2023-11-29 19:00:37 +00:00
|
|
|
import "C"
|
2023-11-14 01:20:34 +00:00
|
|
|
import (
|
|
|
|
"github.com/jmorganca/ollama/api"
|
|
|
|
)
|
|
|
|
|
|
|
|
// CheckVRAM returns the free VRAM in bytes on Linux machines with NVIDIA GPUs
|
|
|
|
func CheckVRAM() (int64, error) {
|
|
|
|
// TODO - assume metal, and return free memory?
|
2023-11-29 19:00:37 +00:00
|
|
|
return 0, nil
|
2023-11-14 01:20:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-11-29 19:00:37 +00:00
|
|
|
func GetGPUInfo() GpuInfo {
|
|
|
|
// TODO - Metal vs. x86 macs...
|
|
|
|
|
|
|
|
return GpuInfo{
|
|
|
|
Driver: "METAL",
|
|
|
|
TotalMemory: 0,
|
|
|
|
FreeMemory: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-14 01:20:34 +00:00
|
|
|
func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
|
|
|
|
// default to enable metal on macOS
|
|
|
|
return 1
|
|
|
|
}
|
2023-11-29 19:00:37 +00:00
|
|
|
|
|
|
|
func nativeInit() error {
|
|
|
|
return nil
|
|
|
|
}
|