ANNarchy 4.8.2
  • ANNarchy
  • Installation
  • Tutorial
  • Manual
  • Notebooks
  • Reference

  • Reference
  • Core components
    • Population
    • Projection
    • Neuron
    • Synapse
    • Monitor
    • PopulationView
    • Dendrite
    • Network
  • Configuration
    • setup
    • compile
    • clear
    • reset
    • set_seed
    • get_population
    • get_projection
    • populations
    • projections
    • monitors
  • Simulation
    • simulate
    • simulate_until
    • step
    • parallel_run
    • enable_learning
    • disable_learning
    • get_time
    • set_time
    • get_current_step
    • set_current_step
    • dt
  • Neuron models
    • LeakyIntegrator
    • Izhikevich
    • IF_curr_exp
    • IF_cond_exp
    • IF_curr_alpha
    • IF_cond_alpha
    • HH_cond_exp
    • EIF_cond_alpha_isfa_ista
    • EIF_cond_exp_isfa_ista
  • Synapse models
    • STP
    • STDP
    • Hebb
    • Oja
    • IBCM
  • Inputs
    • InputArray
    • TimedArray
    • PoissonPopulation
    • TimedPoissonPopulation
    • SpikeSourceArray
    • HomogeneousCorrelatedSpikeTrains
    • CurrentInjection
    • DecodingProjection
    • ImagePopulation
    • VideoPopulation
  • IO
    • save
    • load
    • save_parameters
    • load_parameters
  • Utilities
    • report
  • Random Distributions
    • Uniform
    • DiscreteUniform
    • Normal
    • LogNormal
    • Exponential
    • Gamma
    • Binomial
  • Functions and Constants
    • add_function
    • functions
    • Constant
    • get_constant
  • Plotting
    • raster_plot
    • histogram
    • inter_spike_interval
    • coefficient_of_variation
    • population_rate
    • smoothed_rate
  • Callbacks
    • every
    • callbacks_enabled
    • disable_callbacks
    • enable_callbacks
    • clear_all_callbacks
  • Convolution
    • Convolution
    • Pooling
    • Transpose
    • Copy
  • BOLD monitoring
    • BoldMonitor
    • BoldModel
    • balloon_RN
    • balloon_RL
    • balloon_CN
    • balloon_CL
    • balloon_maith2021
    • balloon_two_inputs
  • Tensorboard logging
    • Logger
  • ANN-to-SNN conversion
    • ANNtoSNNConverter

On this page

  • parallel_run
    • Parameters
    • Returns

parallel_run

core.Network.parallel_run(
    method,
    networks=None,
    number=0,
    max_processes=-1,
    measure_time=False,
    sequential=False,
    same_seed=False,
    annarchy_json='',
    visible_cores=[],
    **args,
)

Allows to run multiple networks in parallel using multiprocessing.

If the networks argument is provided as a list of Network objects, the given method will be executed for each of these networks.

If number is given instead, the same number of networks will be created and the method is applied.

If number is used, the created networks are not returned, you should return what you need to analyse.

Example:

pop1 = ann.PoissonPopulation(100, rates=10.0)
pop2 = ann.Population(100, ann.Izhikevich)
proj = ann.Projection(pop1, pop2, 'exc')
proj.connect_fixed_probability(weights=5.0, probability=0.2)
m = ann.Monitor(pop2, 'spike')

ann.compile()

def simulation(idx, net):
    net.get(pop1).rates = 10. * idx
    net.simulate(1000.)
    return net.get(m).raster_plot()

results = ann.parallel_run(method=simulation, number = 3)

t1, n1 = results[0]
t2, n2 = results[1]
t3, n3 = results[2]

Parameters

Name Type Description Default
method a Python method which will be executed for each network. This function must accept an integer as first argument (id of the simulation) and a Network object as second argument. required
networks list a list of networks to simulate in parallel. None
number int the number of identical networks to run in parallel. 0
max_processes int maximal number of processes to start concurrently (default: the available number of cores on the machine). -1
measure_time bool if the total simulation time should be printed out. False
sequential bool if True, runs the simulations sequentially instead of in parallel (default: False). False
same_seed bool if True, all networks will use the same seed. If not, the seed will be randomly initialized with time(0) for each network (default). It has no influence when the networks argument is set (the seed has to be set individually for each network using net.set_seed()), only when number is used. False
annarchy_json str path to a different configuration file if needed (default ““). ''
visible_cores list a list of CPU core ids to simulate on (must have max_processes entries and max_processes must be != -1) []
args other named arguments you want to pass to the simulation method. {}

Returns

Name Type Description
list a list of the values returned by each call to method.
step
enable_learning
 

Copyright Julien Vitay, Helge Ülo Dinkelbach, Fred Hamker