When is the problem submitted w.r.t the code?
In the below screenshot, I am aware of resolving the issue by reducing num_reads
as the annealing time is exceeding my allowance. My question with this error is different;
The error says that the problem cannot be submitted while I am trying to access the value of the variable sample_set
. I expected the error to have occurred while executing:
sample_set = sampler.sample(bqm, num_reads=10000)
It seems like the problem is being submitted while I access the variable sample_set
.
So, my question is, when do the following things happen in the code?
- problem submission
- mapping of logical to physical qubits
- QPU solving the problem
Thanks in advance!!
Comments
Hello,
This call is actually asynchronous:
The sample() call returns a concurrent.futures.Future-like object, which resolves to a Sampleset:
dwave.system.samplers.dwave_sampler — dwave-system 1.10.0 documentation (dwavesys.com)
This can result in some events happening in different orders than one would expect with synchronous calls.
The problem is submitted in the sample() function call.
The mapping of the logical to physical qubits happens before the problem is submitted to the QPU, thanks to the EmbeddingComposite, which takes your bqm problem and maps it to the architecture of the DWaveSampler.
After the problem has been submitted, the SAPI endpoint confirms enough QPU Access Time is available and returns an error as you are seeing above if not.
Your code submitted the problem and went on to the next step of accessing the sampleset, while at same time the SAPI endpoint was checking the QPU Access time. Because of this asynchronous call, it appears that accessing the sampleset variable results in this error.
Checking the sampleset variable does result in blocking behaviour which waits for the results to be ready. This would further make it appear that it was this call that threw the error. You could not access the sampleset i.e. wait/sleep after the sample() call and it would still result in this behaviour.
In the case where there is enough QPU Access time, the problem will run on the QPU and accessing the sampleset variable will block and return the value. Accessing the QPU directly is quite quick and rarely results in long delays, so code using the QPU directly usually appears to behave as though it is synchronous.
Hopefully this was helpful. Please let us know if you have any questions.
Please sign in to leave a comment.