From 5b8f0b1d82526b529b706b309ea0be05f731b428 Mon Sep 17 00:00:00 2001 From: Ben Greenman Date: Thu, 20 Jul 2023 22:56:54 -0400 Subject: [PATCH] fannkuch: broken but fix some bugs blocked on https://github.com/facebookincubator/cinder/issues/115 and https://github.com/facebookincubator/cinder/issues/116 --- Benchmark/fannkuch/advanced/main.py | 12 ++++++------ Benchmark/fannkuch/shallow/main.py | 3 ++- Benchmark/fannkuch/untyped/main.py | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Benchmark/fannkuch/advanced/main.py b/Benchmark/fannkuch/advanced/main.py index e939508..db819f5 100644 --- a/Benchmark/fannkuch/advanced/main.py +++ b/Benchmark/fannkuch/advanced/main.py @@ -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: @@ -64,6 +63,7 @@ def fannkuch(nb: int) -> int: r += 1 else: return box(max_flips) + return 0 if __name__ == "__main__": num_iterations = 1 @@ -71,4 +71,4 @@ def fannkuch(nb: int) -> int: num_iterations = int(sys.argv[1]) for _ in range(num_iterations): res = fannkuch(DEFAULT_ARG) - assert res == 30 \ No newline at end of file + assert res == 30 diff --git a/Benchmark/fannkuch/shallow/main.py b/Benchmark/fannkuch/shallow/main.py index 1697fdc..214dcf2 100644 --- a/Benchmark/fannkuch/shallow/main.py +++ b/Benchmark/fannkuch/shallow/main.py @@ -48,6 +48,7 @@ def fannkuch(n: int) -> int: r += 1 else: return max_flips + return 0 if __name__ == "__main__": num_iterations = 1 @@ -55,4 +56,4 @@ def fannkuch(n: int) -> int: num_iterations = int(sys.argv[1]) for _ in range(num_iterations): res = fannkuch(DEFAULT_ARG) - assert res == 30 \ No newline at end of file + assert res == 30 diff --git a/Benchmark/fannkuch/untyped/main.py b/Benchmark/fannkuch/untyped/main.py index 1bb28b2..a99d6c1 100644 --- a/Benchmark/fannkuch/untyped/main.py +++ b/Benchmark/fannkuch/untyped/main.py @@ -43,6 +43,7 @@ def fannkuch(n): r += 1 else: return max_flips + return 0 if __name__ == "__main__": import sys @@ -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 \ No newline at end of file + assert res == 30