Skip to content

Commit

Permalink
fannkuch: broken but fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bennn committed Jul 21, 2023
1 parent b1cb10b commit 5b8f0b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Benchmark/fannkuch/advanced/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
import sys

DEFAULT_ARG = 9
ArrayI64 = Array[int64]


def fannkuch(nb: int) -> int:
n: int64 = int64(nb)
count: ArrayI64 = ArrayI64(range(1, nb + 1))
count: Array[int64] = Array[int64](nb)
max_flips: int64 = 0
m: int64 = n - 1
r: int64 = n
perm1: ArrayI64 = ArrayI64(range(nb))
perm: ArrayI64 = ArrayI64(range(nb))
perm0: ArrayI64 = ArrayI64(range(nb))
perm1: Array[int64] = Array[int64](nb)
perm: Array[int64] = Array[int64](nb)
perm0: Array[int64] = Array[int64](nb)

while 1:
while r != 1:
Expand Down Expand Up @@ -64,11 +63,12 @@ def fannkuch(nb: int) -> int:
r += 1
else:
return box(max_flips)
return 0

if __name__ == "__main__":
num_iterations = 1
if len(sys.argv) > 1:
num_iterations = int(sys.argv[1])
for _ in range(num_iterations):
res = fannkuch(DEFAULT_ARG)
assert res == 30
assert res == 30
3 changes: 2 additions & 1 deletion Benchmark/fannkuch/shallow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ def fannkuch(n: int) -> int:
r += 1
else:
return max_flips
return 0

if __name__ == "__main__":
num_iterations = 1
if len(sys.argv) > 1:
num_iterations = int(sys.argv[1])
for _ in range(num_iterations):
res = fannkuch(DEFAULT_ARG)
assert res == 30
assert res == 30
3 changes: 2 additions & 1 deletion Benchmark/fannkuch/untyped/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def fannkuch(n):
r += 1
else:
return max_flips
return 0

if __name__ == "__main__":
import sys
Expand All @@ -52,4 +53,4 @@ def fannkuch(n):
num_iterations = int(sys.argv[1])
for _ in range(num_iterations):
res = fannkuch(DEFAULT_ARG)
assert res == 30
assert res == 30

0 comments on commit 5b8f0b1

Please sign in to comment.