Commit 395f9834 authored by Ture Pålsson's avatar Ture Pålsson
Browse files

Tidy Python version

parent d0b4f9e8
......@@ -11,10 +11,10 @@ def main():
except EOFError:
buf = 'q'
if not buf or buf[0]=='q' or buf[0]=='Q': break
if buf[0] == '\n':
if not buf or buf.isspace():
arsize = 200
elif buf[0]=='q' or buf[0]=='Q':
break
else:
arsize = int(buf)
......@@ -25,8 +25,6 @@ def main():
print("Too small.")
continue
arsize2d = arsize * arsize;
print("\n\nLINPACK benchmark, NumPy/SciPy version, DOUBLE precision.")
# print("Machine precision: {} digits.".format(BASE10DIG))
print("Array size {}x{}".format(arsize, arsize))
......@@ -35,18 +33,14 @@ def main():
nreps = 1
while True:
# print(f"\033[31mnreps = {nreps}\033[0m", end='\r')
if linpack(nreps, arsize) >= 10: break
nreps *= 2
print(" " * 72)
second = time.process_time
def linpack(nreps, arsize):
lda = arsize
n = arsize // 2
arsize2d = arsize * arsize
ops = ((2 * n * n * n) / 3.0 + 2 * n * n)
ops = (2 * n * n * n) / 3.0 + 2 * n * n
tdgesl = 0
tdgefa = 0
......@@ -70,13 +64,13 @@ def linpack(nreps, arsize):
toverhead = totalt - tdgefa - tdgesl
if (tdgefa < 0): tdgefa = 0
if (tdgesl < 0): tdgesl = 0
if (toverhead < 0): toverhead = 0
if tdgefa < 0: tdgefa = 0
if tdgesl < 0: tdgesl = 0
if toverhead < 0: toverhead = 0
print("%8d %6.2f %6.2f%% %6.2f%% %6.2f%% %9.3f"
% (nreps, totalt, 100.*tdgefa/totalt,
100.*tdgesl/totalt, 100.*toverhead/totalt,
% (nreps, totalt, 100 * tdgefa / totalt,
100 * tdgesl / totalt, 100 * toverhead / totalt,
kflops))
return totalt
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment