nengo / nengo-gui

Nengo interactive visualizer
Other
99 stars 38 forks source link

Pass parameters to backends #741

Open xchoo opened 8 years ago

xchoo commented 8 years ago

I'm trying to use nengo_ocl as a backend on nengo_gui. Unfortunately, the nengo_ocl backend simulator requires extra information (the current ocl context) to be created. There should be a way of passing this information to the backend.

tcstewar commented 8 years ago

Yup, this definitely should be done. For now, the workaround for this particular case is to set the environment variable for the context instead, but we should have a more general solution.

tcstewar commented 6 years ago

If the parameter options can all be set via a string, then we should be able to have a text field beside the dropdown for choosing the backend where you can set parameters (e.g. set the backend to nengo and then write optimize=False in the field beside it).

If we do this, we should also allow a similar configuration when setting the backend from the command line. I do something similar to this in pytry, where I ended up with this syntax: nengo --backend nengo(optimize=False).

It should be noted that for parameters that are complex Python objects (like the current ocl context), this approach won't work. But for ocl context there's the workaround of using the environment variable and we might be able to do something that allows it to be set as a string too (if we could do nengo_ocl.Simulator(model, context="0:1") then this problem would be solved... but that's a PR for nengo_ocl)