Commit 8f873aa1 authored by Margret A. Riegert's avatar Margret A. Riegert
Browse files

Run black and shfmt on all python/bash scripts

parent 7d323b78
......@@ -6,8 +6,7 @@ benchmark=blackscholes
mkdir -p test.data/output
for f in test.data/input/*.data
do
for f in test.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
......@@ -16,4 +15,4 @@ do
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_${benchmark}_nn.data
python ./scripts/qos.py test.data/output/${filename}_${benchmark}_orig.data test.data/output/${filename}_${benchmark}_nn.data
done
\ No newline at end of file
done
......@@ -6,12 +6,11 @@ rm -rf train.data/output/bin
mkdir -p train.data/output/bin
benchmark=blackscholes
for f in train.data/input/*.data
do
for f in train.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.out ${f} train.data/output/${filename}_${benchmark}_out.data
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
\ No newline at end of file
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
......@@ -5,29 +5,29 @@ import math
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
if(len(sys.argv) != 3):
printUsage()
if len(sys.argv) != 3:
printUsage()
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
e = 0.0
......@@ -35,25 +35,29 @@ absError = 0.0
for i in range(len(origLines)):
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origPrice = float(origLine)
nnPrice = float(nnLine)
origPrice = float(origLine)
nnPrice = float(nnLine)
nominator = abs(origPrice - nnPrice)
denominator = abs(origPrice)
nominator = abs(origPrice - nnPrice)
denominator = abs(origPrice)
if(denominator == 0):
e = 1.0
elif(math.isnan(nominator) or (math.isnan(denominator))):
e = 1.0
elif ((nominator / denominator > 1)):
e = 1.0
else:
e = nominator / denominator
if denominator == 0:
e = 1.0
elif math.isnan(nominator) or (math.isnan(denominator)):
e = 1.0
elif nominator / denominator > 1:
e = 1.0
else:
e = nominator / denominator
absError += e
absError += e
print(bcolors.FAIL + "*** Error: %1.8f" % (absError/float(len(origLines))) + bcolors.ENDC)
print(
bcolors.FAIL
+ "*** Error: %1.8f" % (absError / float(len(origLines)))
+ bcolors.ENDC
)
......@@ -11,7 +11,7 @@ nc='\033[0m' # No Color
mkdir -p test.data/output
./bin/${benchmark}.nn.out 32768 test.data/output/${benchmark}_nn.data
./bin/${benchmark}.out 32768 test.data/output/${benchmark}_orig.data
./bin/${benchmark}.nn.out 32768 test.data/output/${benchmark}_nn.data
./bin/${benchmark}.out 32768 test.data/output/${benchmark}_orig.data
python ./scripts/qos.py test.data/output/${benchmark}_orig.data test.data/output/${benchmark}_nn.data
python ./scripts/qos.py test.data/output/${benchmark}_orig.data test.data/output/${benchmark}_nn.data
......@@ -6,6 +6,5 @@ rm -rf train.data/output/bin
mkdir -p train.data/output/bin
benchmark=fft
./bin/${benchmark}.out 2048 train.data/output/${benchmark}_out.data
mv hadianeh.parroto.data train.data/output/bin/${benchmark}.bin
mv hadianeh.parroto.data train.data/output/bin/${benchmark}.bin
......@@ -5,29 +5,29 @@ import math
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
if(len(sys.argv) != 3):
printUsage()
if len(sys.argv) != 3:
printUsage()
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
e = 0.0
......@@ -35,32 +35,35 @@ absError = 0.0
for i in range(len(origLines)):
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origReal = float(origLine.split(" ")[0])
origImag = float(origLine.split(" ")[1])
origReal = float(origLine.split(" ")[0])
origImag = float(origLine.split(" ")[1])
nnReal = float(nnLine.split(" ")[0])
nnImag = float(nnLine.split(" ")[1])
nnReal = float(nnLine.split(" ")[0])
nnImag = float(nnLine.split(" ")[1])
diffReal = origReal - nnReal
diffImag = origImag - nnImag
diffReal = origReal - nnReal
diffImag = origImag - nnImag
nominator = math.sqrt(diffReal*diffReal + diffImag*diffImag)
denominator = math.sqrt(origReal*origReal + origImag*origImag)
nominator = math.sqrt(diffReal * diffReal + diffImag * diffImag)
denominator = math.sqrt(origReal * origReal + origImag * origImag)
if(denominator == 0):
e = 1.0
elif(math.isnan(nominator) or (math.isnan(denominator))):
e = 1.0
elif ((nominator / denominator > 1)):
e = 1.0
else:
e = nominator / denominator
if denominator == 0:
e = 1.0
elif math.isnan(nominator) or (math.isnan(denominator)):
e = 1.0
elif nominator / denominator > 1:
e = 1.0
else:
e = nominator / denominator
absError += e
absError += e
print(bcolors.FAIL + "*** Error: %1.8f" % (absError/float(len(origLines))) + bcolors.ENDC)
print(
bcolors.FAIL
+ "*** Error: %1.8f" % (absError / float(len(origLines)))
+ bcolors.ENDC
)
......@@ -11,16 +11,15 @@ nc='\033[0m' # No Color
mkdir -p test.data/output
for f in test.data/input/*.data
do
for f in test.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_${benchmark}_nn.data
./bin/${benchmark}.out ${f} test.data/output/${filename}_${benchmark}_orig.data
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_${benchmark}_nn.data
./bin/${benchmark}.out ${f} test.data/output/${filename}_${benchmark}_orig.data
echo -ne " ${red}- ${f}${nc} "
python ./scripts/qos.py test.data/output/${filename}_${benchmark}_orig.data test.data/output/${filename}_${benchmark}_nn.data
done
\ No newline at end of file
python ./scripts/qos.py test.data/output/${filename}_${benchmark}_orig.data test.data/output/${filename}_${benchmark}_nn.data
done
......@@ -6,12 +6,11 @@ rm -rf train.data/output/bin
mkdir -p train.data/output/bin
benchmark=inversek2j
for f in train.data/input/*.data
do
for f in train.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/inversek2j.out ${f} train.data/output/${filename}_${benchmark}_out.data
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
\ No newline at end of file
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
......@@ -5,29 +5,29 @@ import math
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
if(len(sys.argv) != 3):
printUsage()
if len(sys.argv) != 3:
printUsage()
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
e = 0.0
......@@ -35,31 +35,30 @@ absError = 0.0
for i in range(len(origLines)):
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origItem1 = float(origLine.split("\t")[0])
origItem2 = float(origLine.split("\t")[1])
origItem1 = float(origLine.split("\t")[0])
origItem2 = float(origLine.split("\t")[1])
nnItem1 = float(nnLine.split("\t")[0])
nnItem2 = float(nnLine.split("\t")[1])
nnItem1 = float(nnLine.split("\t")[0])
nnItem2 = float(nnLine.split("\t")[1])
diff1 = origItem1 - nnItem1
diff2 = origItem2 - nnItem2
diff1 = origItem1 - nnItem1
diff2 = origItem2 - nnItem2
nominator = math.sqrt(diff1*diff1 + diff2*diff2)
denominator = math.sqrt(origItem1*origItem1 + origItem2*origItem2)
nominator = math.sqrt(diff1 * diff1 + diff2 * diff2)
denominator = math.sqrt(origItem1 * origItem1 + origItem2 * origItem2)
if(denominator == 0):
e = 1.0
elif(math.isnan(nominator) or (math.isnan(denominator))):
e = 1.0
elif ((nominator / denominator > 1)):
e = 1.0
else:
e = nominator / denominator
if denominator == 0:
e = 1.0
elif math.isnan(nominator) or (math.isnan(denominator)):
e = 1.0
elif nominator / denominator > 1:
e = 1.0
else:
e = nominator / denominator
absError += e
absError += e
print(bcolors.FAIL + "*** Error: %1.8f" % (absError/len(origLines)) + bcolors.ENDC)
print(bcolors.FAIL + "*** Error: %1.8f" % (absError / len(origLines)) + bcolors.ENDC)
......@@ -11,21 +11,19 @@ nc='\033[0m' # No Color
mkdir -p test.data/output
for f in test.data/input/*.gz
do
$(cd $(dirname "$f") && gunzip -k $(basename "$f"))
for f in test.data/input/*.gz; do
$(cd $(dirname "$f") && gunzip -k $(basename "$f"))
done
for f in test.data/input/*.data
do
for f in test.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_${benchmark}_nn.data
./bin/${benchmark}.out ${f} test.data/output/${filename}_${benchmark}_orig.data
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_${benchmark}_nn.data
./bin/${benchmark}.out ${f} test.data/output/${filename}_${benchmark}_orig.data
echo -ne " ${red}- ${f}${nc} "
python ./scripts/qos.py test.data/output/${filename}_${benchmark}_orig.data test.data/output/${filename}_${benchmark}_nn.data
done
\ No newline at end of file
python ./scripts/qos.py test.data/output/${filename}_${benchmark}_orig.data test.data/output/${filename}_${benchmark}_nn.data
done
......@@ -8,12 +8,11 @@ benchmark=jmeint
mkdir -p train.data/output
for f in train.data/input/*.data
do
for f in train.data/input/*.data; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.out ${f} train.data/output/${filename}_${benchmark}_out.data
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
\ No newline at end of file
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
......@@ -5,44 +5,47 @@ import math
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
def printUsage():
print("Usage: python qos.py <original file> <nn file>")
exit(1)
if(len(sys.argv) != 3):
printUsage()
if len(sys.argv) != 3:
printUsage()
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origFilename = sys.argv[1]
nnFilename = sys.argv[2]
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
origLines = open(origFilename).readlines()
nnLines = open(nnFilename).readlines()
missPred = 0
for i in range(len(origLines)):
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
origItem = int(origLine)
nnItem = int(nnLine)
origLine = origLines[i].rstrip()
nnLine = nnLines[i].rstrip()
if(origItem != nnItem):
missPred += 1
origItem = int(origLine)
nnItem = int(nnLine)
if origItem != nnItem:
missPred += 1
print(bcolors.FAIL + "*** Error: %1.8f" % (missPred/float(len(origLines))) + bcolors.ENDC)
print(
bcolors.FAIL
+ "*** Error: %1.8f" % (missPred / float(len(origLines)))
+ bcolors.ENDC
)
......@@ -9,17 +9,16 @@ nc='\033[0m' # No Color
mkdir -p test.data/output
for f in test.data/input/*.rgb
do
for f in test.data/input/*.rgb; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_nn.jpg
./bin/${benchmark}.out ${f} test.data/output/${filename}_orig.jpg
./bin/${benchmark}.nn.out ${f} test.data/output/${filename}_nn.jpg
./bin/${benchmark}.out ${f} test.data/output/${filename}_orig.jpg
compare -metric RMSE test.data/output/${filename}_nn.jpg test.data/output/${filename}_orig.jpg null > tmp.log 2> tmp.err
compare -metric RMSE test.data/output/${filename}_nn.jpg test.data/output/${filename}_orig.jpg null >tmp.log 2>tmp.err
echo -ne "${red}$f\t"
awk '{ printf("*** Error: %0.2f%\n",substr($2, 2, length($2) - 2) * 100) }' tmp.err
echo -ne "${nc}"
done
\ No newline at end of file
done
......@@ -4,12 +4,11 @@ rm -rf train.data/output/bin
mkdir -p train.data/output/bin
benchmark=jpeg
for f in train.data/input/*.rgb
do
for f in train.data/input/*.rgb; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.out ${f} train.data/output/${filename}_${benchmark}_out.jpg
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
\ No newline at end of file
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
......@@ -11,8 +11,7 @@ nc='\033[0m' # No Color
mkdir -p test.data/output
for f in test.data/input/*.rgb
do
for f in test.data/input/*.rgb; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
......@@ -20,10 +19,10 @@ do
./bin/${BENCHMARK}.nn.out ${f} test.data/output/${filename}_kmeans.rgb
./bin/${BENCHMARK}.out ${f} test.data/output/${filename}_orig.rgb
python ../../scripts/png2rgb.py png test.data/output/${filename}_orig.rgb test.data/output/${filename}.rgb_orig.png > out1.tmp
python ../../scripts/png2rgb.py png test.data/output/${filename}_${BENCHMARK}.rgb test.data/output/${filename}_${BENCHMARK}.png > out2.tmp
compare -metric RMSE test.data/output/${filename}.rgb_orig.png test.data/output/${filename}_${BENCHMARK}.png null > tmp.log 2> tmp.err
python ../../scripts/png2rgb.py png test.data/output/${filename}_orig.rgb test.data/output/${filename}.rgb_orig.png >out1.tmp
python ../../scripts/png2rgb.py png test.data/output/${filename}_${BENCHMARK}.rgb test.data/output/${filename}_${BENCHMARK}.png >out2.tmp
compare -metric RMSE test.data/output/${filename}.rgb_orig.png test.data/output/${filename}_${BENCHMARK}.png null >tmp.log 2>tmp.err
echo -ne "${red}- $f\t"
awk '{ printf("*** Error: %0.2f%\n",substr($2, 2, length($2) - 2) * 100) }' tmp.err
echo -ne "${nc}"
done
\ No newline at end of file
done
......@@ -6,13 +6,12 @@ rm -rf train.data/output/bin
mkdir -p train.data/output/bin
benchmark=kmeans
for f in train.data/input/*.rgb
do
for f in train.data/input/*.rgb; do
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
./bin/${benchmark}.out ${f} train.data/output/${filename}_${benchmark}.rgb
python ../../scripts/png2rgb.py png train.data/output/${filename}_${benchmark}.rgb train.data/output/${filename}_${benchmark}.png
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin
done
\ No newline at end of file
mv hadianeh.parroto.data train.data/output/bin/${filename}_${benchmark}.bin