MCPcopy
hub / github.com/mudler/LocalAI / CPUCapabilities

Function CPUCapabilities

pkg/xsysinfo/cpu.go:12–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func CPUCapabilities() ([]string, error) {
13 cpu, err := ghw.CPU()
14 if err != nil {
15 return nil, err
16 }
17
18 caps := map[string]struct{}{}
19
20 for _, proc := range cpu.Processors {
21 for _, c := range proc.Capabilities {
22
23 caps[c] = struct{}{}
24 }
25
26 }
27
28 ret := slices.Collect(maps.Keys(caps))
29
30 // order
31 sort.Strings(ret)
32 return ret, nil
33}
34
35func HasCPUCaps(ids ...cpuid.FeatureID) bool {
36 return cpuid.CPU.Supports(ids...)

Callers 1

NewFunction · 0.92

Calls 1

KeysMethod · 0.80

Tested by

no test coverage detected