Skip to content

Commit

Permalink
Merge pull request #3035 from heplesser/fix_shrink_buffer
Browse files Browse the repository at this point in the history
Set buffer shrink limit to 20% by default (activates shrinking) and fix documentation
  • Loading branch information
heplesser authored Dec 11, 2023
2 parents 12cff3d + 25210bb commit 8fe19e0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 39 deletions.
4 changes: 2 additions & 2 deletions nestkernel/event_delivery_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ EventDeliveryManager::EventDeliveryManager()
, recv_buffer_target_data_()
, buffer_size_target_data_has_changed_( false )
, global_max_spikes_per_rank_( 0 )
, send_recv_buffer_shrink_limit_( 0.0 )
, send_recv_buffer_shrink_limit_( 0.2 )
, send_recv_buffer_shrink_spare_( 0.1 )
, send_recv_buffer_grow_extra_( 0.5 )
, send_recv_buffer_resize_log_()
Expand Down Expand Up @@ -91,7 +91,7 @@ EventDeliveryManager::initialize()
// Ensures that ResetKernel resets off_grid_spiking_
off_grid_spiking_ = false;
buffer_size_target_data_has_changed_ = false;
send_recv_buffer_shrink_limit_ = 0.0;
send_recv_buffer_shrink_limit_ = 0.2;
send_recv_buffer_shrink_spare_ = 0.1;
send_recv_buffer_grow_extra_ = 0.5;
send_recv_buffer_resize_log_.clear();
Expand Down
45 changes: 21 additions & 24 deletions nestkernel/kernel_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,38 +126,35 @@
(read only).
growth_factor_buffer_target_data double - If MPI buffers for communication of connections resize on the fly,
grow them by this factor each round, defaults to 1.5.
spike_buffer_grow_extra double - When spike exchange buffer needs to be expanded, resize to
(1 + spike_buffer_grow_extra) * required_buffer_size
spike_buffer_grow_extra double - When spike exchange buffer is expanded, resize it to
(1 + spike_buffer_grow_extra) * required_buffer_size,
defaults to 0.5.
spike_buffer_shrink_limit double - If largest number of spikes sent from any rank to any rank is
less than spike_buffer_shrink_limit * buffer_size, then reduce
buffer size. spike_buffer_shrink_limit == 0 means that buffers
never shrink. See `spike_buffer_shrink_factor` for how much buffer
shrinks.
spike_buffer_shrink_spare double - When buffer needs to shrink, set new size to
never shrink. See `spike_buffer_shrink_spare` for how the new
buffer size is determined. Defaults to 0.2.
spike_buffer_shrink_spare double - When buffer shrinks, set new size to
(1 + spike_buffer_shrink_spare) * required_buffer_size`.
See `spike_buffer_shrink_limit` for when buffers shrink.
Defaults to 0.1.
spike_buffer_resize_log dict - Information on spike buffer resizing as dictionary. It contains the
times of the resizings (simulation clock in steps, always multiple
of min_delay), global_max_spikes_sent, i.e., the observed spike
of min_delay), global_max_spikes_sent, that is, the observed spike
number that triggered the resize, and the new_buffer_size. Sizes
are for the section addressing one rank (read only).
keep_source_table booltype - Whether to keep source table after connection setup is complete,
defaults to true.
local_spike_counter integertype - Number of spikes fired by neurons on a given MPI rank during the
most recent call to Simulate(). Only spikes from “normal” neurons
are counted, not spikes generated by devices such as
poisson_generator (read only).
max_num_syn_models integertype - Maximal number of synapse models supported (read only).
network_size integertype - The number of nodes in the network (read only).
node_models arraytype - The list of available node models (neurons and devices; read only).
num_connections integertype - The number of connections in the network (read only; local only).
stimulation_backends arraytype - List of available backends for stimulation devices (read-only).
structural_plasticity_synapses dicttype - Defines all synapses which are plastic for the structural
plasticity algorithm. Each entry in the dictionary is composed of
a synapse model, the presynaptic element and the postsynaptic
element.
structural_plasticity_update_interval integertype - Defines the time interval in ms at which the structural plasticity
manager will make changes in the structure of the network (creation
are for the buffer section sent from one rank to another rank (read
only). keep_source_table booltype - Whether to keep source table after connection setup is
complete, defaults to true. local_spike_counter integertype - Number of spikes fired by neurons on a
given MPI rank during the most recent call to Simulate(). Only spikes from “normal” neurons are counted, not spikes
generated by devices such as poisson_generator (read only). max_num_syn_models integertype - Maximal
number of synapse models supported (read only). network_size integertype - The number of nodes
in the network (read only). node_models arraytype - The list of available node models
(neurons and devices; read only). num_connections integertype - The number of connections in the
network (read only; local only). stimulation_backends arraytype - List of available backends for
stimulation devices (read-only). structural_plasticity_synapses dicttype - Defines all synapses which are
plastic for the structural plasticity algorithm. Each entry in the dictionary is composed of a synapse model, the
presynaptic element and the postsynaptic element. structural_plasticity_update_interval integertype - Defines the time
interval in ms at which the structural plasticity manager will make changes in the structure of the network (creation
and deletion of plastic synapses), defaults to 10000.
synapse_models arraytype - The list of the available synapse models (read only).
Expand Down
16 changes: 9 additions & 7 deletions nestkernel/save_doc_fmt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
(read only).
growth_factor_buffer_target_data double - If MPI buffers for communication of connections resize on the fly,
grow them by this factor each round, defaults to 1.5.
spike_buffer_grow_extra double - When spike exchange buffer needs to be expanded, resize to
(1 + spike_buffer_grow_extra) * required_buffer_size
spike_buffer_grow_extra double - When spike exchange buffer is expanded, resize it to
(1 + spike_buffer_grow_extra) * required_buffer_size,
defaults to 0.5.
spike_buffer_shrink_limit double - If largest number of spikes sent from any rank to any rank is
less than spike_buffer_shrink_limit * buffer_size, then reduce
buffer size. spike_buffer_shrink_limit == 0 means that buffers
never shrink. See `spike_buffer_shrink_factor` for how much buffer
shrinks.
spike_buffer_shrink_spare double - When buffer needs to shrink, set new size to
never shrink. See `spike_buffer_shrink_spare` for how the new
buffer size is determined. Defaults to 0.2.
spike_buffer_shrink_spare double - When buffer shrinks, set new size to
(1 + spike_buffer_shrink_spare) * required_buffer_size`.
See `spike_buffer_shrink_limit` for when buffers shrink.
Defaults to 0.1.
spike_buffer_resize_log dict - Information on spike buffer resizing as dictionary. It contains the
times of the resizings (simulation clock in steps, always multiple
of min_delay), global_max_spikes_sent, i.e., the observed spike
of min_delay), global_max_spikes_sent, that is, the observed spike
number that triggered the resize, and the new_buffer_size. Sizes
are for the section addressing one rank (read only).
are for the buffer section sent from one rank to another rank (read only).
keep_source_table booltype - Whether to keep source table after connection setup is complete,
defaults to true.
local_spike_counter integertype - Number of spikes fired by neurons on a given MPI rank during the
Expand Down
12 changes: 6 additions & 6 deletions pynest/nest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __dir__(self):
)
spike_buffer_grow_extra = KernelAttribute(
"float",
"When spike exchange buffer needs to be expanded, resize to "
"When spike exchange buffer is expanded, resize it to "
+ "`(1 + spike_buffer_grow_extra) * required_buffer_size`",
default=0.5,
)
Expand All @@ -238,14 +238,14 @@ def __dir__(self):
"If the largest number of spikes sent from any rank to any rank is less than "
+ "`spike_buffer_shrink_limit * buffer_size`, then reduce buffer size. "
+ "`spike_buffer_shrink_limit == 0` means that buffers never shrink. "
+ "See ``spike_buffer_shrink_factor`` for how much buffer shrinks"
+ "See ``spike_buffer_shrink_spare`` for how the new buffer size is determined"
),
default=0.0,
default=0.2,
)
spike_buffer_shrink_spare = KernelAttribute(
"float",
(
"When the buffer needs to shrink, set the new size to "
"When the buffer shrinks, set the new size to "
+ "`(1 + spike_buffer_shrink_spare) * required_buffer_size`. "
+ "See `spike_buffer_shrink_limit` for when buffers shrink"
),
Expand All @@ -254,10 +254,10 @@ def __dir__(self):
spike_buffer_resize_log = KernelAttribute(
"dict",
(
"Information on spike buffer resizing as a dictionary. It contains the "
"Log of spike buffer resizing as a dictionary. It contains the "
+ "`times` of the resizings (simulation clock in steps, always multiple of ``min_delay``), "
+ "``global_max_spikes_sent``, that is, the observed spike number that triggered the resize, "
+ "and the ``new_buffer_size``. Sizes are for the section addressing one rank."
+ "and the ``new_buffer_size``. Sizes for the buffer section sent from one rank to another rank"
),
readonly=True,
)
Expand Down

0 comments on commit 8fe19e0

Please sign in to comment.