Commit 8177eeb
committed
Defer NESTML compilation to sim.setup()
Previously each nestml_cell_type() / nestml_synapse_type() call compiled and
installed a NEST module immediately, causing a collision when called more than
once (second nest.Install() fails; single module name overwrites earlier models).
Now both functions register a stub class in a module-level list and return it
immediately — no compilation occurs. sim.setup() calls _compile_and_resolve(),
which gathers all pending descriptions, invokes generate_nest_target() once for
all of them, calls nest.Install() once, then resolves each stub class in place
so it behaves identically to a native_cell_type() / native_synapse_type() class.
Calling nestml_cell_type() or nestml_synapse_type() after setup() raises
RuntimeError. Examples updated to register NESTML types before setup().1 parent af5ea37 commit 8177eeb
5 files changed
Lines changed: 239 additions & 143 deletions
File tree
- examples/nestml
- pyNN/nest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 44 | + | |
51 | 45 | | |
52 | 46 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
57 | 52 | | |
58 | 53 | | |
| 54 | + | |
59 | 55 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 56 | | |
64 | | - | |
| 57 | + | |
65 | 58 | | |
66 | | - | |
67 | | - | |
| 59 | + | |
| 60 | + | |
68 | 61 | | |
69 | | - | |
| 62 | + | |
70 | 63 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 64 | + | |
74 | 65 | | |
75 | 66 | | |
76 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 43 | + | |
47 | 44 | | |
48 | 45 | | |
49 | 46 | | |
| |||
141 | 138 | | |
142 | 139 | | |
143 | 140 | | |
| 141 | + | |
| 142 | + | |
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 44 | + | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
| 50 | + | |
| 51 | + | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
0 commit comments