Skip to content

Commit f3c46bf

Browse files
create symbolic links to blif and traffic flow files in NoC MLP benchmarks
Created symbolic links are ignored
1 parent 6cc52c8 commit f3c46bf

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ vtr_flow/benchmarks/titan_blif/titan_new
4141
#
4242
# NoC MLP benchmarks
4343
#
44-
# We ignore blif and vqm files because of thier large size/
44+
# We ignore blif and vqm files because of thier large size.
45+
# We also ignore symbolic links to traffic flow and blif files.
4546
#
4647
vtr_flow/benchmarks/noc/Large_Designs/MLP/**/*.vqm
4748
vtr_flow/benchmarks/noc/Large_Designs/MLP/**/*.blif
49+
vtr_flow/benchmarks/noc/Large_Designs/MLP/blif_files/*
50+
vtr_flow/benchmarks/noc/Large_Designs/MLP/traffic_flow_files/*
4851

4952
#
5053
# ISPD benchmarks

vtr_flow/scripts/download_noc_mlp.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,44 @@ def extract_to_vtr_flow_dir(args, tar_gz_filename):
148148
source_file = os.path.join(root, file)
149149
relative_path = os.path.relpath(source_file, tmp_source_blif_dir)
150150
destination_file = os.path.join(mlp_benchmarks_dir, relative_path)
151-
print(source_file, destination_file)
152151
os.makedirs(os.path.dirname(destination_file), exist_ok=True)
153152
shutil.copy2(source_file, destination_file)
154153

154+
# Create symbolic links to blif files
155+
find_and_link_files(mlp_benchmarks_dir, ".blif", "blif_files")
156+
# Create symbolic links to traffic flow files
157+
find_and_link_files(mlp_benchmarks_dir, ".flows", "traffic_flow_files")
158+
155159
finally:
156160
# Clean-up
157161
shutil.rmtree(tmpdir)
158162

159163
print("Done")
160164

161165

166+
def find_and_link_files(base_path, target_extension, link_folder_name):
167+
"""
168+
Finds files with a given extension and make symbolic links to them
169+
"""
170+
171+
# Create a folder to store symbolic links
172+
link_folder_path = os.path.join(base_path, link_folder_name)
173+
os.makedirs(link_folder_path, exist_ok=True)
174+
175+
# Walk through all subdirectories
176+
for root, dirs, files in os.walk(base_path):
177+
if root == link_folder_path:
178+
continue
179+
180+
for file in files:
181+
if file.endswith(target_extension):
182+
# Get the full path of the file
183+
file_path = os.path.join(root, file)
184+
185+
# Create symbolic link in the link folder
186+
link_name = os.path.join(link_folder_path, file)
187+
os.symlink(file_path, link_name)
188+
162189

163190
if __name__ == "__main__":
164191
main()

0 commit comments

Comments
 (0)