Skip to content

Commit

Permalink
added folded_compilation option in SolverConfig (#270)
Browse files Browse the repository at this point in the history
* added folded_compilation option in SolverConfig
  • Loading branch information
ymeng-git authored Oct 19, 2023
1 parent 0190199 commit a03b700
Showing 1 changed file with 9 additions and 1 deletion.
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:
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

0 comments on commit a03b700

Please sign in to comment.