Comments (4)
The problem appears to come from hybrid/samplers.py
, line 80. This line does a
qpu_sampler = DWaveSampler(solver=dict(qpu=True))
instead of querying the configuration file. I haven't yet checked the DWaveSampler
code, but based on my observations, the above appears to be returning the alphabetically first solver instead of the solver that appears first in dwave.conf
. The following replacement code returns the sampler I'd expect:
with Client.from_config(client="qpu") as client:
qpu_sampler = client.get_solver()
I'm thinking that DWaveSampler
is perhaps at fault here. Given a set of filters, it should return the first match in the configuration file, not an arbitrary match.
from dwave-hybrid.
The solver=dict(qpu=True)
part is actually a (temporary) fix for currently unexpected (unwanted) behavior of DWaveSampler
(see dwavesystems/dwave-system#288) -- by default it will not filter-out non-QPU solver.
Nevertheless, the configuration file is queried (unless explicitly skipped with config_file=False
on Client
construction), it's just that solver
definition is overridden. However, ordering of profiles (after first) is not relevant, since the first profile is used by default, unless explicitly specified with profile
on Client
construction or DWAVE_PROFILE
env var.
With introduction of feature-based solver filtering (check examples at the end), ordering of solvers is determined with order_by
argument in get_solver/get_solvers
(defaulting to pick the solver with least avg_load
).
In short, by specifying client
type (in code or config) and not specifying solver
(in code), solver can be defined via config or environment. (That the behavior we'll have in DWaveSampler
after dwavesystems/dwave-system#288).
from dwave-hybrid.
Nevertheless, the configuration file is queried (unless explicitly skipped with
config_file=False
onClient
construction), it's just thatsolver
definition is overridden. However, ordering of profiles (after first) is not relevant, since the first profile is used by default, unless explicitly specified withprofile
onClient
construction orDWAVE_PROFILE
env var.
It looks like what's actually happening is that my first profile is chosen, but the solver specified in that profile is being ignored. Is that what you mean by "that solver
definition is overridden"? It's possible that my least loaded solver is what's getting selected—above I had guessed alphabetically first—but in my case it's least loaded because it's an inferior solver (a D-Wave 2X compatibility mode solver). Setting DWAVE_API_SOLVER
in my environment doesn't seem to help. Will this be fixed with dwavesystems/dwave-system#288?
from dwave-hybrid.
Yes, solver
kwarg overrides DWAVE_API_SOLVER
env var, which overrides solver
read from config files. Same rule applies to other variables as well (token
, endpoint
, client
, etc).
dwavesystems/dwave-system#288 will eliminate the need to supply solver
kwarg if you need a QPU solver, in turn allowing environment or config file variable to determine the solver used (BTW, it will still be possible to fail with SolverNotFoundError
exception if solver from config is non-QPU, when DWaveSampler
will implicitly use client="qpu"
).
In the meantime, I'll patch Kerberos
to use:
qpu_sampler = DWaveSampler(client="qpu")
effectively simulating dwavesystems/dwave-system#288, and resolving this issue.
Config subsystem in dwave-cloud-client/Ocean is quite different from the one in the old SAPI client. It's layered and hierarchical with profiles across multiple config files being inherited/extended, environment overriding config file, and code overriding everything. I hope Client.from_config
and client configuration section provide enough details (if not, please let us know).
from dwave-hybrid.
Related Issues (20)
- Make `Lambda` stateless by default
- Support cyBQMs from dimod 0.9+ HOT 1
- Potential dependency conflicts between dwave-hybrid and numpy HOT 3
- Better support for (fixed) clique embedding sampling HOT 2
- Division by zero in hybrid.reference.HybridizedPopulationAnnealing HOT 1
- SplatComposer produces a numpy.float64 sampleset
- Performance of Parallel Tempering
- Feature request: make Kerberos's default max_subproblem_size topology-dependent HOT 1
- How should the `racing_context` parameter be used with a third-party framework? HOT 1
- Difference b/w D Wave leap hybrid solver and QBsolv? HOT 1
- `SteepestDescentProblemSampler` not using `SteepestDescentSolver`
- Expose QPU timing info in `timers`
- CI not sweeping dimod versions properly
- Clique Embedding not working HOT 3
- Solution refinement using ReverseAnnealingAutoEmbeddingSampler
- Specifying init_sample as a SampleSet when sampling from KerberosSampler results in error HOT 4
- Bug in flip_energy_gains causes a TypeError HOT 2
- Hybrid solver execution on CPU! HOT 1
- Several tests fail HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwave-hybrid.