Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Termination max_time criterion #200

Open
JoelPasvolsky opened this issue Sep 12, 2019 · 5 comments
Open

Termination max_time criterion #200

JoelPasvolsky opened this issue Sep 12, 2019 · 5 comments

Comments

@JoelPasvolsky
Copy link
Contributor

From the current defintion of `max_time as:
"max_time (float/None, optional, default=None):
Wall clock runtime termination criterion. Unlimited by default."

I wouldn't expect this:

import timeit
start_time = timeit.default_timer()
result = sampler.sample(bqm, num_reads=5, max_iter=2, **max_time=6**)
print(timeit.default_timer() - start_time)

print("Found solutions with energy", result.record.energy)

results in

**27.63140569999996**
Found solutions with energy [-139. -137. -141. -139. -139.]

I'd have expected that the sampler operation would terminate in ~6 six of wall time.

Also, be nice to add the units to the definition: "... termination criterion, in seconds. Unlimited"

@randomir
Copy link
Member

What sampler are you talking about here?

@JoelPasvolsky
Copy link
Contributor Author

sampler = KerberosSampler()

@randomir
Copy link
Member

randomir commented Sep 12, 2019

If it's Kerberos, then there's no way to guarantee the run time (currently). max_time parameter is on the outer Loop, and if loop body (racing branches with QPU in one branch) takes longer, the Loop will not forcefully interrupt the child workflow (source here). Maybe we could do that, but it probably makes more sense just to document the current behavior instead.

@JoelPasvolsky
Copy link
Contributor Author

I think what surprised me most was not that it doesn't have the granularity of interrupting the loop body, but that it applies to the loop body rather than the sampler as a whole, that is I expected that when the first RacingBranch completed with more than max_time having elapsed since iteration 0 began, it would terminate.
Yes, I think clearly documenting what we have is enough.

@randomir
Copy link
Member

Although, limiting branches' execution time to max_time also makes a lot of sense. We should do that. The only problem is that QPU sampler does not yet support timeout (#121). So, we can implement this once we complete #121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants