コード例 #1
0
def setup(timestep=1, min_delay=1, max_delay=10.0, **extra_params):
    """
    Should be called at the very beginning of a script.
    extra_params contains any keyword arguments that are required by a given
    simulator but not by others.
    """
    if (timestep < 1):
        raise Exception(
            "It is not currently possible to have a timestep less than 1ms with this simulator"
        )
    if (min_delay < 1):
        raise Exception(
            "It is not currently possible to have a min_delay less than 1ms with this simulator"
        )

    common.setup(timestep, min_delay, max_delay, **extra_params)
    simulator.state = simulator._State(timestep, min_delay, max_delay)
    simulator.spikes_array_list = []
    simulator.recorder_list = []
    if "cpu_backend" in extra_params:
        simulator.state.conf.set_cpu_backend()
    if "cuda_backend" in extra_params:
        simulator.state.conf.set_cuda_backend(extra_params["cuda_backend"])
    print("The backend used by nemo is: ",
          simulator.state.conf.backend_description())
    return simulator.state.mpi_rank
コード例 #2
0
ファイル: __init__.py プロジェクト: Huitzilo/PyNN
def setup(timestep=1, min_delay=1, max_delay=10.0, **extra_params):
    """
    Should be called at the very beginning of a script.
    extra_params contains any keyword arguments that are required by a given
    simulator but not by others.
    """
    if (timestep < 1):
        raise Exception("It is not currently possible to have a timestep less than 1ms with this simulator")
    if (min_delay < 1):
        raise Exception("It is not currently possible to have a min_delay less than 1ms with this simulator")

    common.setup(timestep, min_delay, max_delay, **extra_params)
    simulator.state = simulator._State(timestep, min_delay, max_delay)
    simulator.spikes_array_list = []
    simulator.recorder_list     = []
    if "cpu_backend" in extra_params:
        simulator.state.conf.set_cpu_backend()
    if "cuda_backend" in extra_params:
        simulator.state.conf.set_cuda_backend(extra_params["cuda_backend"])
    print("The backend used by nemo is: ", simulator.state.conf.backend_description())
    return simulator.state.mpi_rank