"docs/vscode:/vscode.git/clone" did not exist on "e87893d38e165b8aad67b2a307988717570d5adf"
gpu_darwin.go 729 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
func GetGPUInfo() GpuInfo {
	// TODO - Metal vs. x86 macs...
21
	mem, _ := getCPUMem()
22
	return GpuInfo{
23
24
25
26
27
28
29
		Library: "default",
		memInfo: mem,
	}
}

func getCPUMem() (memInfo, error) {
	return memInfo{
30
31
		TotalMemory: 0,
		FreeMemory:  0,
32
	}, nil
33
34
}

35
func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
36
37
38
39
40
41
	if runtime.GOARCH == "arm64" {
		return 1
	}

	// metal only supported on arm64
	return 0
42
}
43
44
45
46

func nativeInit() error {
	return nil
}