Create remap_cores.py

This commit is contained in:
augustin64 2024-07-04 09:21:33 +02:00
parent e610acfc8f
commit 7d2ea63108
3 changed files with 30 additions and 5 deletions

View File

@ -52,7 +52,7 @@ slices = list(stats["hash"].unique())
def slice_reorder(df, fst_slice, params=None):
if params is None:
params = ["clflush_miss_n", "clflush_remote_hit"]
keys = slices.copy()
sliced_df = {
i : df[(df["hash"] == i)] for i in keys
@ -81,7 +81,7 @@ def slice_reorder(df, fst_slice, params=None):
total_dist += dist
new_reorder.append(next)
keys.remove(next)
print("slice_group")
print("\n".join([
str(new_reorder.index(i)) for i in range(len(slices))
@ -111,8 +111,8 @@ def core_reorder(df, fst_core, params=None, position="both", lcores=None):
if params is None:
params = ["clflush_miss_n", "clflush_remote_hit"]
if lcores is None:
lcores = cores.copy()

View File

@ -45,7 +45,7 @@ for pack in get_elements(machine, "Package"):
l1 = get_element(l2, "L1Cache")
l1i = get_element(l1, "L1iCache")
core_obj = get_element(l1i, "Core")
for PU in get_elements(core_obj, "PU"):
core.append(int(PU.attrib["os_index"]))
core_count += 1

View File

@ -0,0 +1,25 @@
import sys
if len(sys.argv) != 3:
print(f"Usage: {sys.argv[0]} <input.csv> <mapping>")
sys.exit(1)
input_file = sys.argv[1]
mapping_file = sys.argv[2]
mapping = []
with open(mapping_file, "r") as f:
for i in f.read().split("\n"):
if i != "":
mapping.append(int(i))
with open(input_file, "r") as f:
for line in f.read().split("\n"):
if line == "" or "core" in line:
print(line)
continue
sock, core, ht = map(int, line.split(","))
core = mapping[core]
print(f"{sock},{core},{ht}")