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

Enable Solver Parallelization with Loihi2 Backend #197

Merged
merged 34 commits into from
Mar 23, 2023
Merged
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c9d5a13
Expose cost from CostIntegrator on the OptimizationSolver.
GaboFGuerra Feb 1, 2023
ec3c065
Enable cost tracking on the OptimizationSolver.
GaboFGuerra Feb 1, 2023
5d1a35c
Merge branch 'main' of https://github.com/lava-nc/lava-optimization
GaboFGuerra Feb 14, 2023
db392e5
Merge local and remote mains which diverged.
GaboFGuerra Mar 8, 2023
8cf27f5
Remove obsolete code.
GaboFGuerra Mar 8, 2023
cb49032
Solve merging issues.
GaboFGuerra Mar 9, 2023
a668841
Merge-in remote into local changes.
GaboFGuerra Mar 10, 2023
b4cc0c6
Resolve import issue for ReadGate.
GaboFGuerra Mar 13, 2023
90887dc
solve linting issue
GaboFGuerra Mar 13, 2023
1d8480c
Solve linting issue.
GaboFGuerra Mar 13, 2023
5981f6a
Split Py and C read gate models.
GaboFGuerra Mar 14, 2023
1613fdf
Use different function for generating py and C ReadGate models.
GaboFGuerra Mar 14, 2023
51c5916
Change assertion to raise a ValueError instead.
GaboFGuerra Mar 15, 2023
0694242
Merge branch 'main' into hp_parallel_l2
GaboFGuerra Mar 16, 2023
06a67f8
Solve linting inssues.
GaboFGuerra Mar 16, 2023
86ba199
Merge remote into local.
GaboFGuerra Mar 16, 2023
98081e3
Reformat file.
GaboFGuerra Mar 16, 2023
57c1d78
Solve linting.
GaboFGuerra Mar 16, 2023
221d951
Reformat files.
GaboFGuerra Mar 16, 2023
e975c09
Merge branch 'hp_parallel_l2' of https://github.com/lava-nc/lava-opti…
GaboFGuerra Mar 16, 2023
551e717
merge remote into local
GaboFGuerra Mar 16, 2023
804910b
Correct test for membership.
GaboFGuerra Mar 16, 2023
9c9cf2a
Optimize imports.
GaboFGuerra Mar 16, 2023
0ce5ca7
Solve linting.
GaboFGuerra Mar 16, 2023
99efed9
Solve linting issue.
GaboFGuerra Mar 16, 2023
4ce3786
Update function name.
GaboFGuerra Mar 16, 2023
61015db
Update function name.
GaboFGuerra Mar 16, 2023
058d522
Add default backend to function.
GaboFGuerra Mar 16, 2023
1c1506e
Add missing white spaces.
GaboFGuerra Mar 16, 2023
d606bd6
Add default value for argument in funciton.
GaboFGuerra Mar 16, 2023
d05b931
Add missing white spaces.
GaboFGuerra Mar 17, 2023
0f4a6be
Remove backend param as obsolete after separation of backends.
GaboFGuerra Mar 20, 2023
2f6cc33
Complete conditional for reading state.
GaboFGuerra Mar 23, 2023
a9ae2ec
Remove sconfig.py as not needed anymore.
GaboFGuerra Mar 23, 2023
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
50 changes: 23 additions & 27 deletions src/lava/lib/optimization/solvers/generic/solver.py
Original file line number Diff line number Diff line change
@@ -10,36 +10,29 @@
from lava.lib.optimization.solvers.generic.hierarchical_processes import (
NEBMAbstract,
NEBMSimulatedAnnealingAbstract,
)
)
from lava.lib.optimization.solvers.generic.nebm.models import NEBMPyModel
from lava.lib.optimization.solvers.generic.nebm.process import (
NEBM,
NEBMSimulatedAnnealing,
)
NEBMSimulatedAnnealing
)
from lava.lib.optimization.solvers.generic.scif.models import (
PyModelQuboScifFixed,
)
)
from lava.lib.optimization.solvers.generic.scif.process import QuboScif
from lava.lib.optimization.solvers.generic.sub_process_models import (
NEBMAbstractModel,
NEBMSimulatedAnnealingAbstractModel,
)
)
from lava.lib.optimization.solvers.generic.types_optim import (
BACKENDS_TYPE,
HP_TYPE,
CPUS,
NEUROCORES,
BACKEND_MSG,
)
from lava.lib.optimization.solvers.generic.cost_integrator.process import (
CostIntegrator,
)

BACKENDS_TYPE, HP_TYPE,
CPUS, NEUROCORES, BACKEND_MSG
)
from lava.magma.core.resources import (
AbstractComputeResource,
CPU,
Loihi2NeuroCore,
)
)
from lava.magma.core.run_conditions import RunSteps
from lava.magma.core.run_configs import Loihi1SimCfg, Loihi2HwCfg
from lava.magma.core.sync.protocol import AbstractSyncProtocol
@@ -50,6 +43,9 @@
from lava.utils.profiler import Profiler

try:
from lava.lib.optimization.solvers.generic.read_gate.ncmodels import (
ReadGateCModel,
)
from lava.proc.dense.ncmodels import NcModelDense
from lava.lib.optimization.solvers.generic.nebm.ncmodels import (
NEBMNcModel,
@@ -60,6 +56,9 @@
)
except ImportError:

class ReadGateCModel:
pass

class NcModelDense:
pass

@@ -305,15 +304,12 @@ def _get_run_config(
from lava.lib.optimization.solvers.generic.read_gate.process import (
ReadGate,
)

if backend in CPUS:
from lava.lib.optimization.solvers.generic.read_gate.models import (
get_read_gate_py_model_class,
)

ReadGatePyModel = get_read_gate_py_model_class(
num_in_ports, backend
)
)
ReadGatePyModel = get_read_gate_py_model_class(num_in_ports,
backend)
pdict = {
self.solver_process: self.solver_model,
ReadGate: ReadGatePyModel,
@@ -326,20 +322,20 @@ def _get_run_config(
exception_proc_model_map=pdict, select_sub_proc_model=True
)
elif backend in NEUROCORES:
from lava.lib.optimization.solvers.generic.read_gate.ncmodels import (
from lava.lib.optimization.solvers.generic.read_gate.ncmodels \
import (
get_read_gate_c_model_class,
)

)
ReadGateCModel = get_read_gate_c_model_class(num_in_ports, backend)
pdict = {
self.solver_process: self.solver_model,
ReadGate: ReadGateCModel,
# Dense: NcModelDense,
NEBMAbstract: NEBMAbstractModel,
# NEBM: NEBMNcModel,
NEBMSimulatedAnnealingAbstract: NEBMSimulatedAnnealingAbstractModel,
NEBMSimulatedAnnealingAbstract:
NEBMSimulatedAnnealingAbstractModel,
NEBMSimulatedAnnealing: NEBMSimulatedAnnealingNcModel,
CostIntegrator: CostIntegratorNcModel,
}
return Loihi2HwCfg(
exception_proc_model_map=pdict,