Skip to content

Commit

Permalink
perftune.py: work in progress scylladb#2
Browse files Browse the repository at this point in the history
  • Loading branch information
vladzcloudius committed Aug 19, 2022
1 parent 14aabcc commit aa34f2f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions scripts/perftune.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def auto_detect_irq_mask(cpu_mask):
PUs_key = 'PUs'

# List of NUMA IDs that own CPUs from the given CPU mask
numa_ids_list = run_hwloc_calc(['-I', 'numa', cpu_mask]).split(",")
numa_ids_list = [int(n) for n in run_hwloc_calc(['-I', 'numa', cpu_mask]).split(",")]

# Let's calculate number of HTs and cores on each NUMA node belonging to the given CPU set
cores_PUs_per_numa = {} # { <numa_id> : {'cores': <number of cores>, 'PUs': <number of PUs>}}
Expand Down Expand Up @@ -293,20 +293,17 @@ def auto_detect_irq_mask(cpu_mask):
# Let's allocate a full core for each 32 HTs.
# Let's distribute IRQ cores among present NUMA nodes
num_irq_cores = math.ceil(num_PUs / 32)
num_cores_per_numa = max(1, num_irq_cores // len(numa_ids_list))
hwloc_args = []
numa_cores_count = {n: 0 for n in numa_ids_list}
added_cores = 0
for numa in numa_ids_list:
for i in range(num_cores_per_numa):
hwloc_args.append(f"node:{numa}.core:{i}")
while added_cores < num_irq_cores:
for numa in numa_ids_list:
hwloc_args.append(f"node:{numa}.core:{numa_cores_count[numa]}")
added_cores += 1
numa_cores_count[numa] += 1

if added_cores >= num_irq_cores:
break
else:
continue
# if the inner loop exited on break - get out
break

return run_hwloc_calc(['--restrict', cpu_mask] + hwloc_args)

Expand Down

0 comments on commit aa34f2f

Please sign in to comment.