- Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcollectdata.py
33 lines (26 loc) · 1.01 KB
/
collectdata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
importre, os, glob
defCollectData(N, mem):
forfninglob.glob("search_tmp.*"):
os.remove(fn)
withopen("search.cpp", "rt") asf:
src=f.read()
ints=mem/8
src=re.sub(r"const int SIZE = (\d*);", r"const int SIZE = %d;"%N, src)
src=re.sub(r"const int ARR_SAMPLES = (\(.*?\))", r"const int ARR_SAMPLES = %d"%ints, src)
src=re.sub(r"const int KEY_SAMPLES = (\(.*?\))", r"const int KEY_SAMPLES = %d"%ints, src)
withopen("search_tmp.cpp", "wt") asf:
f.write(src)
withopen("c.bat", "rt") asf:
bat=f.read()
bat=bat.replace("search.cpp", "search_tmp.cpp")
os.system(bat)
logname="res_%04d_%d.log"% (N, mem)
os.system("search_tmp >res/"+logname)
os.system("search_tmp >res/"+logname)
forfninglob.glob("res/*"):
os.remove(fn)
sizes= [16, 32, 64, 128, 256, 512, 1024]
#sizes = [128, 256, 512, 1024, 2048, 4096]
forsinsizes:
CollectData(s, 64<<10)
# CollectData(s, 512<<10)