Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
parser.add_argument("-noheader", default=False, action="store_true")
parser.add_argument(
"-timeout",
default=5.0,
default=1.0,
type=float,
help="Number of seconds to wait for a run before timing out",
help="Maximum total time (in seconds) allowed for iterations to run",
)
parser.add_argument(
"-pequal", default=False, action="store_true", help="Compute `len(Q) == len(T)`"
)
parser.add_argument(
"-niter", default=4, type=int, help="Number of iterations to run"
"-itermax", default=1000, type=int, help="Maximum number of iterations to run"
)
parser.add_argument("-pmin", default=6, type=int, help="Minimum 2^p to use")
parser.add_argument("-pmax", default=27, type=int, help="Maximum 2^p to use")
Expand Down Expand Up @@ -54,7 +54,7 @@
skip_p_equal = 0
else:
skip_p_equal = 1
n_iter = args.niter
iter_max = args.itermax
p_min = args.pmin
p_max = args.pmax
p_diff = args.pdiff
Expand All @@ -75,7 +75,10 @@
mod.setup(Q, T)

elapsed_times = []
for _ in range(n_iter):
iter_count = 0
while sum(elapsed_times) < timeout and iter_count < iter_max:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid adding extra parameters, I'm reusing the existing timeout variable

iter_count += 1

start = time.time()
mod.sliding_dot_product(Q, T)
diff = time.time() - start
Expand Down
Loading