Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added folded_compilation option in SolverConfig #270

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/lava/lib/optimization/solvers/generic/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ class SolverConfig:
backend.
log_level: int
Select log verbosity (40: default, 20: verbose).
folded_compilation: bool
A boolean flag to enable folded compilation, available only on
"Loihi2" backend. Default value is False.
"""

timeout: int = 1e3
Expand All @@ -173,6 +176,7 @@ class SolverConfig:
probe_time: bool = False
probe_energy: bool = False
log_level: int = 40
folded_compilation: bool = False


@dataclass(frozen=True)
Expand Down Expand Up @@ -272,7 +276,11 @@ def solve(self, config: SolverConfig = SolverConfig()) -> SolverReport:
An object containing all the data generated by the execution.
"""
run_condition, run_cfg = self._prepare_solver(config)
self.solver_process.run(condition=run_condition, run_cfg=run_cfg)
folded_compile_config = None
if config.folded_compilation:
ymeng-git marked this conversation as resolved.
Show resolved Hide resolved
folded_compile_config = {'folded_view' : ['SolutionFinder']}
self.solver_process.run(condition=run_condition, run_cfg=run_cfg,
compile_config=folded_compile_config)
best_state, best_cost, best_timestep = self._get_results(config)
cost_timeseries, state_timeseries = self._get_probing(config)
self.solver_process.stop()
Expand Down
Loading