DNX Maximum independent set (python) - time of computation

Hi,

I am running dnx.maximum_independent_set with sampler=LeapHybridSampler() for different graphs and wanted to know, how to retrieve the qpu time for each of the computations (to see how the performance actually scales with increasing the number of nodes).

 

Any ideas how to do it?

 

the code: result = dnx.maximum_independent_set(G, sampler=my_sampler) only returns a list object with no info on the qpu time.

 

Thank you in advance!

0

Comments

2 comments
  • Aleksander,

    The list object is the return object when calling maximum_independent_set. (See https://docs.ocean.dwavesys.com/en/stable/docs_dnx/reference/algorithms/generated/dwave_networkx.maximum_independent_set.html 

    It does seem odd that it does not return the usual timing info and that there is not an apparent alternative way to get it programmatically.

    As a work around, the timing info can be seen by going to the Leap Dashboard and reviewing the recent problems.

    Ed

    0
    Comment actions Permalink
  • Hi Aleksander,

    Apologies for the delay!

    For the above use case, you can retrieve the timing information by using dimod.TrackingComposite. This composite tracks input and output of the child sampler(LeapHybridSampler in this case).

    Here is a code example:

    >>>import dimod
    >>>import dwave_networkx as dnx
    >>>from dwave.system import LeapHybridSampler

    >>>sampler = dimod.TrackingComposite(LeapHybridSampler())

    >>>G = dnx.chimera_graph(1, 1, 4)
    >>>indep_nodes = dnx.maximum_independent_set(G, sampler)

    >>>sampler.output
    SampleSet(rec.array([([1, 1, 1, 1, 0, 0, 0, 0], -4., 1)],
    dtype=[('sample', '<i4', (8,)), ('energy', '<f8'), ('num_occurrences', '<i8')]), Variables([0, 1, 2, 3, 4, 5, 6, 7]), {'qpu_access_time': 45604, 'charge_time': 2987635, 'run_time': 2987635, 'problem_id': '09d66bfb-54a7-4385-804c-dc03b6b2719d'}, 'BINARY')

    sampler.output contains the returned sampleset and you can access the timing info using sampler.output.info

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post