dwavesystems / dwave-cloud-client

A minimal implementation of the REST interface used to communicate with D-Wave Solver API (SAPI) servers.
https://docs.ocean.dwavesys.com/projects/cloud-client/en/stable/
Apache License 2.0
59 stars 40 forks source link

Remove circular references in `computation.Future` #602

Closed randomir closed 6 months ago

randomir commented 6 months ago

Fix #601.

Running the test snippet from #601:

from dwave.system import DWaveSampler

sampler = DWaveSampler()

s = 0
for i in range(100):
    print("job:", i)
    future = sampler.solver.sample_ising({30: 0, 31: 0, 32: 0, 33: 0, 34: 0, 35: 0, 36: 0, 37: 0, 38: 0, 39: 0}, {}, num_reads=1000)
    sampleset = future.wait_sampleset()

before the fix: image

and after the fix: image

arcondello commented 6 months ago

@randomir out of curiosity, it looks like there is still a bit of creeping memory usage in the second image as well. Is that just an artifact of the test or are there other memory leaks or pseudo-leaks?

randomir commented 6 months ago

@arcondello, I'm not sure. Haven't seen other circular refs in the client-solver-future constellation, but to make sure, I plan to analize it properly. Also, I want to look broader, across the whole Ocean.

Related, 400MiB for a single QPU sampling is abhorrent, IMO.

But all this can be tackled under the QPU path performance improvements umbrella.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.47%. Comparing base (f3614c8) to head (b90794f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #602 +/- ## ========================================== + Coverage 88.44% 88.47% +0.03% ========================================== Files 33 33 Lines 4344 4356 +12 ========================================== + Hits 3842 3854 +12 Misses 502 502 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.