+20 seconds to run

The examples in this page: https://docs.ocean.dwavesys.com/en/latest/examples/and.html

Takes more than 20 seconds to run and generate 50 "problem ids"

This example has some problem, consumes more than 20 seconds to complete.

I appreciate a timeout command to stop my code execution after 1 second.

My code:

def run(sampler_embedded):
    response = sampler_embedded.sample_qubo(Q, num_reads=50)
    for sample, energy, num_occurrences in response.data(['sample', 'energy', 'num_occurrences'], sorted_by='num_occurrences'):
        print(sample, "Energy: ", energy, "Occurrences: ", num_occurrences)

from dwave.system.samplers import DWaveSampler
from dwave.system.composites import EmbeddingComposite
sampler = DWaveSampler()
Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}

sampler_embedded = EmbeddingComposite(sampler)
print(sampler.adjacency[sampler.nodelist[0]])
run(sampler_embedded)

from dwave.system.composites import VirtualGraphComposite
embedding = {'x1': {1}, 'x2': {5}, 'z': {0, 4}}
sampler_embedded = VirtualGraphComposite(sampler, embedding)
print(sampler_embedded.adjacency)
run(sampler_embedded)

print(sampler.properties['extended_j_range'])
sampler_embedded = VirtualGraphComposite(sampler, embedding, chain_strength=0.1)
run(sampler_embedded)

2

Comments

2 comments
  • Hello John,

    Thank you for pointing out this issue. The example above uses VirtualGraphComposite, which generates many problem submissions to calculate flux biases. We have reviewed the documentation and updated the example to not use VirtualGraphComposite, so the QPU time required to run the example is much less. 

    The new example is in the same location:

    https://docs.ocean.dwavesys.com/en/latest/examples/and.html

    1
    Comment actions Permalink
  • Thank you, John,

    VirtualGraphComposite automatically calibrates the qubits in a chain to compensate for the effects of biases that may be introduced as a result of strong couplings. That calibration is the multiple submissions you see to the QPU and can take a good number of seconds. It is possible to use VirtualGraphComposite without doing that calibration by setting the flux_biases to None (flux biases are pulled from the database or calculated empirically) or False (no flux bias is applied or calculated).

    You can see information on its use in the white paper Virtual Graphs for High-Performance Embedded Topologies here: https://www.dwavesys.com/resources/publications.

    The AND example has been updated to use FixedEmbeddingComposite instead. That one sets the chain strength but does not calibrate, so consumes less QPU time. On the Solving Problems on a D-Wave System page, a notification has been added to alert users that VirtualGraphComposite is a high consumer of QPU time.

    1
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post