Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
37926eb9
Unverified
Commit
37926eb9
authored
Jul 29, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jul 29, 2024
Browse files
Merge pull request #5927 from dhiltgen/high_cpu_count
Ensure amd gpu nodes are numerically sorted
parents
3d4634fd
7c2a157c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
gpu/amd_linux.go
gpu/amd_linux.go
+15
-0
No files found.
gpu/amd_linux.go
View file @
37926eb9
...
...
@@ -10,6 +10,7 @@ import (
"path/filepath"
"regexp"
"slices"
"sort"
"strconv"
"strings"
...
...
@@ -82,6 +83,20 @@ func AMDGetGPUInfo() []RocmGPUInfo {
// The amdgpu driver always exposes the host CPU(s) first, but we have to skip them and subtract
// from the other IDs to get alignment with the HIP libraries expectations (zero is the first GPU, not the CPU)
matches
,
_
:=
filepath
.
Glob
(
GPUPropertiesFileGlob
)
sort
.
Slice
(
matches
,
func
(
i
,
j
int
)
bool
{
// /sys/class/kfd/kfd/topology/nodes/<number>/properties
a
,
err
:=
strconv
.
ParseInt
(
filepath
.
Base
(
filepath
.
Dir
(
matches
[
i
])),
10
,
64
)
if
err
!=
nil
{
slog
.
Debug
(
"parse err"
,
"error"
,
err
,
"match"
,
matches
[
i
])
return
false
}
b
,
err
:=
strconv
.
ParseInt
(
filepath
.
Base
(
filepath
.
Dir
(
matches
[
j
])),
10
,
64
)
if
err
!=
nil
{
slog
.
Debug
(
"parse err"
,
"error"
,
err
,
"match"
,
matches
[
i
])
return
false
}
return
a
<
b
})
cpuCount
:=
0
for
_
,
match
:=
range
matches
{
slog
.
Debug
(
"evaluating amdgpu node "
+
match
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment