"vscode:/vscode.git/clone" did not exist on "2d5e066c8cb2f54f398243dcb922e615ac94a509"
gpu_test.go 820 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
package gpu

import (
	"runtime"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestBasicGetGPUInfo(t *testing.T) {
	info := GetGPUInfo()
Daniel Hiltgen's avatar
Daniel Hiltgen committed
12
13
14
15
16
	assert.Greater(t, len(info), 0)
	assert.Contains(t, "cuda rocm cpu metal", info[0].Library)
	if info[0].Library != "cpu" {
		assert.Greater(t, info[0].TotalMemory, uint64(0))
		assert.Greater(t, info[0].FreeMemory, uint64(0))
17
18
19
	}
}

20
func TestCPUMemInfo(t *testing.T) {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
21
	info, err := GetCPUMem()
22
23
24
25
26
27
28
29
30
31
32
33
	assert.NoError(t, err)
	switch runtime.GOOS {
	case "darwin":
		t.Skip("CPU memory not populated on darwin")
	case "linux", "windows":
		assert.Greater(t, info.TotalMemory, uint64(0))
		assert.Greater(t, info.FreeMemory, uint64(0))
	default:
		return
	}
}

34
// TODO - add some logic to figure out card type through other means and actually verify we got back what we expected