Skip to content

Commit

Permalink
Fix the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit-arora-dev committed Mar 21, 2024
1 parent d14144a commit 1f63c26
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/dcgmexporter/system_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,21 +465,23 @@ func CreateCoreGroupsFromSystemInfo(sysInfo SystemInfo) ([]dcgm.GroupHandle, []f
continue
}

for i, core := range cpu.Cores {
var groupCoreCount int
for _, core := range cpu.Cores {
if !IsCoreWatched(core, cpu.EntityId, sysInfo) {
continue
}

// Create per-cpu core groups or after max number of CPU cores have been added to current group
if i%dcgm.DCGM_GROUP_MAX_ENTITIES == 0 {
if groupCoreCount%dcgm.DCGM_GROUP_MAX_ENTITIES == 0 {
groupID, err = dcgm.CreateGroup(fmt.Sprintf("gpu-collector-group-%d", rand.Uint64()))
if err != nil {
return nil, cleanups, err
}

groups = append(groups, groupID)
}

groupCoreCount++

err = dcgm.AddEntityToGroup(groupID, dcgm.FE_CPU_CORE, core)

if err != nil {
Expand Down

0 comments on commit 1f63c26

Please sign in to comment.