# set_device function

(Shortest import: `from brian2 import set_device)`

brian2.devices.device.set_device(device, build_on_run=True, **kwargs)

  Set the device used for simulations.

  Parameters:

    device : `Device` or str

    > The `Device` object or the name of the device.

    build_on_run : bool, optional

    > Whether a call to `run()` (or `Network.run`) should directly trigger a `Device.build`. This is only relevant for standalone devices and means that a run call directly triggers the start of a simulation. If the simulation consists of multiple run calls, set `build_on_run` to `False` and call `Device.build` explicitly. Defaults to `True`.

    kwargs : dict, optional

    > Only relevant when `build_on_run` is `True`: additional arguments that will be given to the `Device.build` call.