Skip to content

Commit

Permalink
Merge pull request #2926 from heplesser/def_nolag_mrg
Browse files Browse the repository at this point in the history
Improve NEST performance by revised connection exchange and spike delivery
  • Loading branch information
heplesser authored Sep 13, 2023
2 parents a3cf23d + e57b9a1 commit c2258df
Show file tree
Hide file tree
Showing 50 changed files with 1,851 additions and 754 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ set( with-defines OFF CACHE STRING "Additional defines, e.g. '-DXYZ=1' [default=
set( with-userdoc OFF CACHE STRING "Build user documentation [default=OFF]")
set( with-devdoc OFF CACHE STRING "Build developer documentation [default=OFF]")

set( with-full-logging OFF CACHE STRING "Write debug output to 'dump_<num_ranks>_<rank>.log' file [default=OFF]")

################################################################################
################## Project Directory variables ##################
################################################################################
Expand Down Expand Up @@ -153,6 +155,7 @@ nest_process_with_hdf5()
nest_process_target_bits_split()
nest_process_userdoc()
nest_process_devdoc()
nest_process_full_logging()

nest_process_models()

Expand Down
8 changes: 7 additions & 1 deletion cmake/ProcessOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ function( NEST_PROCESS_WITH_HDF5 )
set( HDF5_VERSION "${HDF5_VERSION}" PARENT_SCOPE )
set( HDF5_HL_LIBRARIES "${HDF5_HL_LIBRARIES}" PARENT_SCOPE )
set( HDF5_DEFINITIONS "${HDF5_DEFINITIONS}" PARENT_SCOPE )

include_directories( ${HDF5_INCLUDE_DIRS} )

endif ()
Expand Down Expand Up @@ -703,3 +702,10 @@ function( NEST_PROCESS_DEVDOC )
set( BUILD_DOCS ON PARENT_SCOPE )
endif ()
endfunction ()

function( NEST_PROCESS_FULL_LOGGING )
if ( with-full-logging )
message( STATUS "Configuring full logging" )
set( ENABLE_FULL_LOGGING ON PARENT_SCOPE )
endif ()
endfunction ()
5 changes: 5 additions & 0 deletions doc/htmldoc/installation/cmake_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ NEST properties
| | If running on more than 262144 MPI processes or more than 512 |
| | threads, change to 'hpc'. |
+-----------------------------------------------+----------------------------------------------------------------+
| ``-Dwith-full-logging=[OFF|ON]`` | Write debug output to file ``dump_<num_ranks>_<rank>.log`` |
| | [default=OFF]. Developers should wrap debugging output in |
| | macro ``FULL_LOGGING_ONLY()`` and call kernel().write_dump()` |
| | from inside it. The macro can contain almost any valid code. |
+-----------------------------------------------+----------------------------------------------------------------+

Generic build configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
11 changes: 11 additions & 0 deletions lib/sli/unittest.sli
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,10 @@ FirstVersion: 2012-05-22

SeeAlso: unittest::distributed_assert_or_die, unittest::distributed_collect_assert_or_die, nest_indirect, unittest::mpirun_self, unittest::assert_or_die
*/

/distributed_process_invariant_events_assert_or_die << /show_results false >> Options


/distributed_process_invariant_events_assert_or_die
[/arraytype /proceduretype]
{
Expand All @@ -1312,6 +1316,13 @@ SeeAlso: unittest::distributed_assert_or_die, unittest::distributed_collect_asse
} Map

% we now have array of arrays, should be identical
/distributed_process_invariant_events_assert_or_die /show_results GetOption
{
dup
{ == } forall
}
if

dup First /reference Set
Rest true exch { reference eq and } Fold
}
Expand Down
3 changes: 3 additions & 0 deletions libnestutil/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,7 @@
/* Whether to enable detailed NEST internal timers */
#cmakedefine TIMER_DETAILED 1

/* Whether to do full logging */
#cmakedefine ENABLE_FULL_LOGGING 1

#endif // #ifndef CONFIG_H
2 changes: 1 addition & 1 deletion models/music_event_out_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ nest::music_event_out_proxy::handle( SpikeEvent& e )
#pragma omp critical( insertevent )
{
#endif
for ( int i = 0; i < e.get_multiplicity(); ++i )
for ( size_t i = 0; i < e.get_multiplicity(); ++i )
{
V_.MP_->insertEvent( time, MUSIC::GlobalIndex( receiver_port ) );
}
Expand Down
2 changes: 1 addition & 1 deletion models/rate_neuron_ipn_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ void
nest::rate_neuron_ipn< TNonlinearities >::handle( DelayedRateConnectionEvent& e )
{
const double weight = e.get_weight();
const long delay = e.get_delay_steps();
const long delay = e.get_delay_steps() - kernel().connection_manager.get_min_delay();

size_t i = 0;
std::vector< unsigned int >::iterator it = e.begin();
Expand Down
2 changes: 1 addition & 1 deletion models/rate_neuron_opn_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void
nest::rate_neuron_opn< TNonlinearities >::handle( DelayedRateConnectionEvent& e )
{
const double weight = e.get_weight();
const long delay = e.get_delay_steps();
const long delay = e.get_delay_steps() - kernel().connection_manager.get_min_delay();

size_t i = 0;
std::vector< unsigned int >::iterator it = e.begin();
Expand Down
2 changes: 1 addition & 1 deletion models/rate_transformer_node_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void
nest::rate_transformer_node< TNonlinearities >::handle( DelayedRateConnectionEvent& e )
{
const double weight = e.get_weight();
const long delay = e.get_delay_steps();
const long delay = e.get_delay_steps() - kernel().connection_manager.get_min_delay();

size_t i = 0;
std::vector< unsigned int >::iterator it = e.begin();
Expand Down
2 changes: 1 addition & 1 deletion models/spike_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ nest::spike_recorder::handle( SpikeEvent& e )
{
assert( e.get_multiplicity() > 0 );

for ( int i = 0; i < e.get_multiplicity(); ++i )
for ( size_t i = 0; i < e.get_multiplicity(); ++i )
{
write( e, RecordingBackend::NO_DOUBLE_VALUES, RecordingBackend::NO_LONG_VALUES );
}
Expand Down
3 changes: 2 additions & 1 deletion nestkernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ set ( nestkernel_sources
target_table.h target_table.cpp
target_table_devices.h target_table_devices.cpp target_table_devices_impl.h
target.h target_data.h static_assert.h
send_buffer_position.h
send_buffer_position.h send_buffer_position.cpp
source.h
source_table.h source_table.cpp
source_table_position.h
Expand All @@ -114,6 +114,7 @@ set ( nestkernel_sources
position.h
spatial.h spatial.cpp
stimulation_backend.h
buffer_resize_log.h buffer_resize_log.cpp
)


Expand Down
66 changes: 66 additions & 0 deletions nestkernel/buffer_resize_log.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* buffer_resize_log.cpp
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/

#include "buffer_resize_log.h"

// Includes from nestkernel:
#include "kernel_manager.h"
#include "nest_names.h"

namespace nest
{

BufferResizeLog::BufferResizeLog()
: time_steps_()
, global_max_spikes_sent_()
, new_buffer_size_()
{
}

void
BufferResizeLog::clear()
{
time_steps_.clear();
global_max_spikes_sent_.clear();
new_buffer_size_.clear();
}

void
BufferResizeLog::add_entry( size_t global_max_spikes_sent, size_t new_buffer_size )
{
time_steps_.emplace_back( kernel().simulation_manager.get_clock().get_steps() );
global_max_spikes_sent_.emplace_back( global_max_spikes_sent );
new_buffer_size_.emplace_back( new_buffer_size );
}

void
BufferResizeLog::to_dict( DictionaryDatum& events ) const
{
initialize_property_intvector( events, names::times );
append_property( events, names::times, time_steps_ );
initialize_property_intvector( events, "global_max_spikes_sent" );
append_property( events, "global_max_spikes_sent", global_max_spikes_sent_ );
initialize_property_intvector( events, "new_buffer_size" );
append_property( events, "new_buffer_size", new_buffer_size_ );
}

}
54 changes: 54 additions & 0 deletions nestkernel/buffer_resize_log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* buffer_resize_log.h
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/

#ifndef BUFFER_RESIZE_LOG_H
#define BUFFER_RESIZE_LOG_H

// C++ includes:
#include <vector>

// Includes from sli:
#include "dictdatum.h"

namespace nest
{

/**
* Collect information on spike transmission buffer resizing.
*/
class BufferResizeLog
{
public:
BufferResizeLog();
void clear();
void add_entry( size_t global_max_spikes_sent, size_t new_buffer_size );
void to_dict( DictionaryDatum& ) const;

private:
std::vector< long > time_steps_; //!< Time of resize event in steps
std::vector< long > global_max_spikes_sent_; //!< Spike number that triggered resize
std::vector< long > new_buffer_size_; //!< Buffer size after resize
};

}

#endif /* buffer_resize_log_h */
Loading

0 comments on commit c2258df

Please sign in to comment.