blob: fd4dbfbc01011f9887322ca2d474f306da8c0d32 (
plain) (
blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
import os
import argparse
import subprocess
import time
parser = argparse.ArgumentParser(description = "Collects sha bitstreams for a data pattern")
parser.add_argument('dimm', help="DIMM label under test")
parser.add_argument('pattern', help="data pattern to use")
parser.add_argument('temperature', help="DIMM temperature in centigrades")
args = parser.parse_args()
bitstreams_available = False
if not os.path.isdir("data/" + args.dimm + "/sha"):
os.mkdir("data/" + args.dimm + "/sha")
if os.path.isdir("data/" + args.dimm + "/sha/" + args.temperature + "C"):
bitstreams_available = True
if not os.path.isdir("data/" + args.dimm + "/sha/" + args.temperature + "C"):
os.mkdir("data/" + args.dimm + "/sha/" + args.temperature + "C")
infile = os.path.normpath("data/" + args.dimm + "/ent/" + args.temperature + "C/top.txt")
outdir = os.path.normpath("data/" + args.dimm + "/sha/" + args.temperature + "C")
if not os.path.isdir("data/" + args.dimm + "/sha"):
os.mkdir("data/" + args.dimm + "/sha_nist_results")
if not os.path.isdir("data/" + args.dimm + "/sha/" + args.temperature + "C"):
os.mkdir("data/" + args.dimm + "/sha_nist_results/" + args.temperature + "C")
sha_output = os.path.normpath("data/" + args.dimm + "/sha_nist_results/" + args.temperature + "C")
if not bitstreams_available:
sha_path = "bin/SHA"
print("sudo " + sha_path + " " + outdir + " " + infile)
os.system("sudo " + sha_path + " " + outdir + " " + infile)
else:
print("I think we have the bitstreams available, I won't run softmc code again")
i=0
bitstream = []
for j in range(0,10):
bitstream.append([])
for fname in os.listdir(outdir):
bitstream[i].append(fname)
i+=1
i = i % 10
print(bitstream)
for i in range(len(bitstream[9])):
print("Finished " + str(i) + " out of " + str(len(bitstream[9])))
processes = []
for thr in range(0,10):
outpath = os.path.normpath(sha_output+'/thr'+str(thr))
if not os.path.isdir(outpath):
os.mkdir(outpath)
command = 'tools/sts -O -i 1024 -I 1 -P 11=0.001 -S '+ str(1024*1024) +' -w '+ outpath +' -F r ' + outdir+'/'+bitstream[thr][i] + " 2>/dev/null"
process = subprocess.Popen(command, shell=True)
processes.append(process)
print(command)
# Collect statuses
output = [p.wait() for p in processes]
for thr in range(0,10):
outpath = os.path.normpath(sha_output+'/thr'+str(thr))
res_txt = open(outpath + '/finalAnalysisReport.txt', "r")
lines = res_txt.readlines()
n_success = 0
for j in range(7, len(lines)):
line = lines[j].strip()
if not ("1" in line or "0" in line):
break
split = line.split()
if "/" in split[11]:
n_success += int(split[11].split("/")[0])
res_txt.close()
print(bitstream[thr][i] + " succeeded in " + str(n_success) + "tests + bits: " + str(1024*1024))
if n_success > 186:
os.system("mkdir "+sha_output+"/" + bitstream[thr][i])
os.system("cp "+sha_output+'/thr'+str(thr)+"/finalAnalysisReport.txt "+sha_output+"/" + bitstream[thr][i])
|