Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nest/nest-simulator into new_regi…
Browse files Browse the repository at this point in the history
…stration
  • Loading branch information
heplesser committed Mar 19, 2024
2 parents aee10b1 + 3ee7f98 commit c3bc06b
Show file tree
Hide file tree
Showing 26 changed files with 233 additions and 102 deletions.
1 change: 0 additions & 1 deletion .#foo

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
uses: github/codeql-action/init@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -61,7 +61,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
uses: github/codeql-action/autobuild@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -74,6 +74,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
uses: github/codeql-action/upload-sarif@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
with:
sarif_file: results.sarif
6 changes: 5 additions & 1 deletion doc/htmldoc/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ div[role="main"] .md-source {
color: var(--nest-orange);
background-color: #ffffff8a;
border-radius: 5px;
padding: 6px;
}
/* Add padding around buttons on index page */
#welcome-to-the-nest-simulator-documentation [data-md-color-primary="orange"] .md-typeset a {
padding: 6px;
}

.md-typeset details {
background-color: white;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/sli/nest-init.sli
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def

/CreateParameter trie
[/dictionarytype] /CreateParameter_D load addtotrie
[/doubletype] /CreateParameter_D load addtotrie
[/doubletype] { /val Set << /constant << /value val >> >> CreateParameter_D } addtotrie
def

/GetValue [/parametertype]
Expand Down
12 changes: 6 additions & 6 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ nest::ConnectionManager::~ConnectionManager()
}

void
nest::ConnectionManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
nest::ConnectionManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
// Add connection rules
register_conn_builder< OneToOneBuilder >( "one_to_one" );
Expand Down Expand Up @@ -153,7 +153,7 @@ nest::ConnectionManager::initialize( const bool adjust_number_of_threads_or_rng_
}

void
nest::ConnectionManager::finalize( const bool adjust_number_of_threads_or_rng_seed_only )
nest::ConnectionManager::finalize( const bool adjust_number_of_threads_or_rng_only )
{
source_table_.finalize();
target_table_.finalize();
Expand All @@ -163,7 +163,7 @@ nest::ConnectionManager::finalize( const bool adjust_number_of_threads_or_rng_se
std::vector< std::vector< std::vector< size_t > > >().swap( secondary_recv_buffer_pos_ );
compressed_spike_data_.clear();

if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
for ( auto cbf : connbuilder_factories_ )
{
Expand Down Expand Up @@ -902,13 +902,13 @@ nest::ConnectionManager::connect_( Node& source,
{
#pragma omp atomic write
has_primary_connections_ = true;
check_primary_connections_[ tid ].set_true();
check_primary_connections_.set_true( tid );
}
else if ( check_secondary_connections_[ tid ].is_false() and not is_primary )
{
#pragma omp atomic write
secondary_connections_exist_ = true;
check_secondary_connections_[ tid ].set_true();
check_secondary_connections_.set_true( tid );
}
}

Expand Down
20 changes: 10 additions & 10 deletions nestkernel/event_delivery_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ EventDeliveryManager::~EventDeliveryManager()
}

void
EventDeliveryManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
EventDeliveryManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
init_moduli();
reset_timers_for_preparation();
Expand Down Expand Up @@ -790,7 +790,7 @@ EventDeliveryManager::gather_target_data( const size_t tid )
assert( not kernel().connection_manager.is_source_table_cleared() );

// assume all threads have some work to do
gather_completed_checker_[ tid ].set_false();
gather_completed_checker_.set_false( tid );
assert( gather_completed_checker_.all_false() );

const AssignedRanks assigned_ranks = kernel().vp_manager.get_assigned_ranks( tid );
Expand All @@ -802,7 +802,7 @@ EventDeliveryManager::gather_target_data( const size_t tid )
{
// assume this is the last gather round and change to false
// otherwise
gather_completed_checker_[ tid ].set_true();
gather_completed_checker_.set_true( tid );

#pragma omp master
{
Expand All @@ -819,7 +819,7 @@ EventDeliveryManager::gather_target_data( const size_t tid )
assigned_ranks, kernel().mpi_manager.get_send_recv_count_target_data_per_rank() );

const bool gather_completed = collocate_target_data_buffers_( tid, assigned_ranks, send_buffer_position );
gather_completed_checker_[ tid ].logical_and( gather_completed );
gather_completed_checker_.logical_and( tid, gather_completed );

if ( gather_completed_checker_.all_true() )
{
Expand All @@ -842,7 +842,7 @@ EventDeliveryManager::gather_target_data( const size_t tid )
#pragma omp barrier

const bool distribute_completed = distribute_target_data_buffers_( tid );
gather_completed_checker_[ tid ].logical_and( distribute_completed );
gather_completed_checker_.logical_and( tid, distribute_completed );

// resize mpi buffers, if necessary and allowed
if ( gather_completed_checker_.any_false() and kernel().mpi_manager.adaptive_target_buffers() )
Expand All @@ -864,7 +864,7 @@ EventDeliveryManager::gather_target_data_compressed( const size_t tid )
assert( not kernel().connection_manager.is_source_table_cleared() );

// assume all threads have some work to do
gather_completed_checker_[ tid ].set_false();
gather_completed_checker_.set_false( tid );
assert( gather_completed_checker_.all_false() );

const AssignedRanks assigned_ranks = kernel().vp_manager.get_assigned_ranks( tid );
Expand All @@ -874,7 +874,7 @@ EventDeliveryManager::gather_target_data_compressed( const size_t tid )
while ( gather_completed_checker_.any_false() )
{
// assume this is the last gather round and change to false otherwise
gather_completed_checker_[ tid ].set_true();
gather_completed_checker_.set_true( tid );

#pragma omp master
{
Expand All @@ -891,7 +891,7 @@ EventDeliveryManager::gather_target_data_compressed( const size_t tid )
const bool gather_completed =
collocate_target_data_buffers_compressed_( tid, assigned_ranks, send_buffer_position );

gather_completed_checker_[ tid ].logical_and( gather_completed );
gather_completed_checker_.logical_and( tid, gather_completed );

if ( gather_completed_checker_.all_true() )
{
Expand All @@ -916,7 +916,7 @@ EventDeliveryManager::gather_target_data_compressed( const size_t tid )
// all data it is responsible for to buffers. Now combine with information on whether other ranks
// have sent all their data. Note: All threads will return the same value for distribute_completed.
const bool distribute_completed = distribute_target_data_buffers_( tid );
gather_completed_checker_[ tid ].logical_and( distribute_completed );
gather_completed_checker_.logical_and( tid, distribute_completed );

// resize mpi buffers, if necessary and allowed
if ( gather_completed_checker_.any_false() and kernel().mpi_manager.adaptive_target_buffers() )
Expand Down
8 changes: 4 additions & 4 deletions nestkernel/io_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ IOManager::~IOManager()
}

void
IOManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
IOManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
// Register backends again, since finalize cleans up
// so backends from external modules are unloaded
Expand Down Expand Up @@ -114,7 +114,7 @@ IOManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
}

void
IOManager::finalize( const bool adjust_number_of_threads_or_rng_seed_only )
IOManager::finalize( const bool adjust_number_of_threads_or_rng_only )
{
for ( const auto& it : recording_backends_ )
{
Expand All @@ -125,7 +125,7 @@ IOManager::finalize( const bool adjust_number_of_threads_or_rng_seed_only )
it.second->finalize();
}

if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
for ( const auto& it : recording_backends_ )
{
Expand Down
8 changes: 4 additions & 4 deletions nestkernel/kernel_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ nest::KernelManager::initialize()
{
for ( auto& manager : managers )
{
manager->initialize( /* adjust_number_of_threads_only */ false );
manager->initialize( /* adjust_number_of_threads_or_rng_only */ false );
}

++fingerprint_;
Expand Down Expand Up @@ -122,7 +122,7 @@ nest::KernelManager::finalize()

for ( auto&& m_it = managers.rbegin(); m_it != managers.rend(); ++m_it )
{
( *m_it )->finalize( /* adjust_number_of_threads_only */ false );
( *m_it )->finalize( /* adjust_number_of_threads_or_rng_only */ false );
}
initialized_ = false;
}
Expand All @@ -147,15 +147,15 @@ nest::KernelManager::change_number_of_threads( size_t new_num_threads )
// Finalize in reverse order of initialization with old thread number set
for ( auto mgr_it = managers.rbegin(); mgr_it != managers.rend(); ++mgr_it )
{
( *mgr_it )->finalize( /* adjust_number_of_threads_or_rng_seed_only */ true );
( *mgr_it )->finalize( /* adjust_number_of_threads_or_rng_only */ true );
}

vp_manager.set_num_threads( new_num_threads );

// Initialize in original order with new number of threads set
for ( auto& manager : managers )
{
manager->initialize( /* adjust_number_of_threads_or_rng_seed_only */ true );
manager->initialize( /* adjust_number_of_threads_or_rng_only */ true );
}

// Finalizing deleted all register components. Now that all infrastructure
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/logging_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ nest::LoggingManager::LoggingManager()
}

void
nest::LoggingManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
nest::LoggingManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
dict_miss_is_error_ = true;
}
Expand Down
13 changes: 7 additions & 6 deletions nestkernel/manager_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ class ManagerInterface
* is responsible for calling the initialization routines on the
* specific managers in correct order.
*
* @param adjust_number_of_threads_only Pass true if calling from kernel_manager::change_number_of_threads() to limit
* operations to those necessary for thread adjustment.
* @param adjust_number_of_threads_or_rng_only Pass true if calling from kernel_manager::change_number_of_threads()
* or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding
* of RNG.
*
* @see finalize()
*/
virtual void initialize( const bool adjust_number_of_threads_only ) = 0;
virtual void initialize( const bool adjust_number_of_threads_or_rng_only ) = 0;

/**
* Take down manager after operation.
Expand All @@ -88,12 +89,12 @@ class ManagerInterface
* specific managers in correct order, i.e., the opposite order of
* initialize() calls.
*
* @param adjust_number_of_threads_only Pass true if calling from kernel_manager::change_number_of_threads() to limit
* operations to those necessary for thread adjustment.
* @param adjust_number_of_threads_or_rng_only Pass true if calling from kernel_manager::change_number_of_threads()
* to limit operations to those necessary for thread adjustment.
*
* @see initialize()
*/
virtual void finalize( const bool adjust_number_of_threads_only ) = 0;
virtual void finalize( const bool adjust_number_of_threads_or_rng_only ) = 0;

/**
* Set the status of the manager
Expand Down
6 changes: 3 additions & 3 deletions nestkernel/module_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ModuleManager::ModuleManager()

ModuleManager::~ModuleManager()
{
finalize( /* adjust_number_of_threads_or_rng_seed_only */ false ); // closes dynamically loaded modules
finalize( /* adjust_number_of_threads_or_rng_only */ false ); // closes dynamically loaded modules
lt_dlexit();
}

Expand All @@ -71,9 +71,9 @@ ModuleManager::initialize( const bool )
}

void
ModuleManager::finalize( const bool adjust_number_of_threads_or_rng_seed_only )
ModuleManager::finalize( const bool adjust_number_of_threads_or_rng_only )
{
if ( adjust_number_of_threads_or_rng_seed_only )
if ( adjust_number_of_threads_or_rng_only )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion nestkernel/module_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ModuleManager : public ManagerInterface
void initialize( const bool ) override;

//! Unload modules but only on full ResetKernel(), not when just changing then number of threads
void finalize( const bool adjust_number_of_threads_only ) override;
void finalize( const bool adjust_number_of_threads_or_rng_only ) override;

//! To be called after change of number of threads to re-register components provided by modules
void reinitialize_dynamic_modules();
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/mpi_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ nest::MPIManager::init_mpi( int* argc, char** argv[] )
#endif /* #ifdef HAVE_MPI */

void
nest::MPIManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
nest::MPIManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( adjust_number_of_threads_or_rng_seed_only )
if ( adjust_number_of_threads_or_rng_only )
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/music_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ MUSICManager::MUSICManager()
}

void
MUSICManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
MUSICManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( adjust_number_of_threads_or_rng_seed_only )
if ( adjust_number_of_threads_or_rng_only )
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/node_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ NodeManager::~NodeManager()
}

void
NodeManager::initialize( const bool adjust_number_of_threads_or_rng_seed_only )
NodeManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
// explicitly force construction of wfr_nodes_vec_ to ensure consistent state
wfr_network_size_ = 0;
local_nodes_.resize( kernel().vp_manager.get_num_threads() );
num_thread_local_devices_.resize( kernel().vp_manager.get_num_threads(), 0 );
ensure_valid_thread_local_ids();

if ( not adjust_number_of_threads_or_rng_seed_only )
if ( not adjust_number_of_threads_or_rng_only )
{
sw_construction_create_.reset();
}
Expand Down
Loading

0 comments on commit c3bc06b

Please sign in to comment.