This contains my bachelors thesis and associated tex files, code snippets and maybe more. Topic: Data Movement in Heterogeneous Memories with Intel Data Streaming Accelerator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
2.3 KiB

import os
import json
import shutil
import copy
def make_new_list(old,size):
entry = old[0]
new_list = []
for i in range(size): new_list.append(copy.deepcopy(entry))
return new_list
def process_json_file(file_path):
with open(file_path, 'r') as f:
json_data = json.load(f)
v_src = json_data["list"][0]["affinity"]["nnode_src"]
v_dst = json_data["list"][0]["affinity"]["nnode_dst"]
# Adjust v_src and v_dst based on HBM memory
v_src = v_src - 8 if v_src >= 8 else v_src
v_dst = v_dst - 8 if v_dst >= 8 else v_dst
if (0 <= v_src <= 3 and 0 <= v_dst <= 3):
list_size = 4
json_data["list"] = make_new_list(json_data["list"], list_size)
json_data["count"] = list_size
json_data["list"][0]["affinity"]["node"] = 0
json_data["list"][1]["affinity"]["node"] = 1
json_data["list"][2]["affinity"]["node"] = 2
json_data["list"][3]["affinity"]["node"] = 3
elif (4 <= v_src <= 7 and 4 <= v_dst <= 7):
list_size = 4
json_data["list"] = make_new_list(json_data["list"], list_size)
json_data["count"] = list_size
json_data["list"][0]["affinity"]["node"] = 4
json_data["list"][1]["affinity"]["node"] = 5
json_data["list"][2]["affinity"]["node"] = 6
json_data["list"][3]["affinity"]["node"] = 7
else:
# Case B: inter-socket operation
list_size = 2
json_data["list"] = make_new_list(json_data["list"], list_size)
json_data["count"] = list_size
json_data["list"][0]["affinity"]["node"] = v_src
json_data["list"][1]["affinity"]["node"] = v_dst
# Save modified JSON back to file
with open(file_path, 'w') as f:
json.dump(json_data, f, indent=2)
def process_files_in_folder(folder_path):
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
if os.path.isfile(file_path) and filename.endswith('.json'):
if "copy-n" in filename and "ton" in filename and "-1gib-smart.json" in filename:
process_json_file(file_path)
if __name__ == "__main__":
folder_path = "./benchmark-descriptors/peak-perf-smart/"
process_files_in_folder(folder_path)