gpu_darwin.go 629 Bytes
Newer Older
1
2
//go:build darwin

3
package gpu
4

5
import "C"
6
import (
Daniel Hiltgen's avatar
Daniel Hiltgen committed
7
8
	"runtime"

9
10
11
12
13
14
	"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?
15
	return 0, nil
16
17
18

}

19
20
21
22
23
24
25
26
27
28
func GetGPUInfo() GpuInfo {
	// TODO - Metal vs. x86 macs...

	return GpuInfo{
		Driver:      "METAL",
		TotalMemory: 0,
		FreeMemory:  0,
	}
}

29
func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
30
31
32
33
34
35
	if runtime.GOARCH == "arm64" {
		return 1
	}

	// metal only supported on arm64
	return 0
36
}
37
38
39
40

func nativeInit() error {
	return nil
}