diff --git a/src/lava/lib/optimization/solvers/generic/solver.py b/src/lava/lib/optimization/solvers/generic/solver.py index 79b55998..8e235583 100644 --- a/src/lava/lib/optimization/solvers/generic/solver.py +++ b/src/lava/lib/optimization/solvers/generic/solver.py @@ -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 @@ -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) @@ -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()