Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create NEST Extension Interface for NEST compatible with new registration scheme and unloading #3103

Merged
merged 32 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fc81bd3
Replace dynamicloader with ModuleManager
heplesser Feb 11, 2024
fc26af6
Make ModuleManager safe in case of missing ltdl
heplesser Feb 12, 2024
ee0f46b
Add Install function to SLI interpreter
heplesser Feb 12, 2024
1464290
Further significant revision of extension interface, now with class; …
heplesser Feb 12, 2024
bda895b
Add missing include
heplesser Feb 12, 2024
1c2a0b0
Paths to libraries can now be set correctly using -Dwith-...=... flags
heplesser Feb 12, 2024
62ae400
First success with module closing (no python)
heplesser Feb 12, 2024
6190fe0
Fix Cmake _ROOT variables for compatibility with pre-3.27
heplesser Feb 13, 2024
ea33338
Add NEST lib install dir to LTDL search path on ModuleManager constru…
heplesser Feb 19, 2024
0af2567
Update nestkernel/module_manager.cpp
heplesser Feb 20, 2024
45c167e
Remove externa-modules from cmake options doc
heplesser Feb 20, 2024
f404915
Fix comment
heplesser Feb 20, 2024
68bfd1d
Merge branch 'fix-3064' of github.com:heplesser/nest-simulator into f…
heplesser Feb 20, 2024
551543d
Prohibit module Install after nodes have been created
heplesser Feb 28, 2024
8a4d999
Merge branch 'master' of github.com:nest/nest-simulator into fix-3064
heplesser Feb 28, 2024
31aee16
Add missing semicolon
heplesser Feb 28, 2024
61be56b
Merge branch 'master' of github.com:nest/nest-simulator into fix-3064
heplesser Mar 1, 2024
a01dcf3
Remove all metadata methods from NESTExtensionInterface; to be re-add…
heplesser Mar 1, 2024
4763f47
Fix module name use
heplesser Mar 1, 2024
181771b
Merge branch 'master' of github.com:nest/nest-simulator into fix-3064
heplesser Mar 10, 2024
5b2715d
Rename confusing reset_kernel flag to initalize/finalize
heplesser Mar 10, 2024
8b5b02d
Correct re-initialization of components from dynamically loaded modul…
heplesser Mar 11, 2024
b1e3165
Provide reinitialize function also if no ltdl
heplesser Mar 11, 2024
14dc62c
Update nestkernel/module_manager.h
heplesser Mar 12, 2024
aacd3b1
Update nestkernel/module_manager.h
heplesser Mar 12, 2024
6804084
Update nestkernel/module_manager.h
heplesser Mar 12, 2024
bef163e
Merge branch 'master' of github.com:nest/nest-simulator into fix-3064
heplesser Mar 12, 2024
9f5a175
Remove version number from nestmodule::name()
heplesser Mar 12, 2024
e73b52b
Merge branch 'fix-3064' of github.com:heplesser/nest-simulator into f…
heplesser Mar 12, 2024
0b4f406
Fix formatting
heplesser Mar 12, 2024
4b380aa
Remove unintentionally commited file.
heplesser Mar 13, 2024
e17951e
Consistently name adjust_number_of..._only parameter
heplesser Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -67,7 +67,6 @@ set( with-modelset "full" CACHE STRING "The modelset to include. Sample configur
set( with-models OFF CACHE STRING "The models to include as a semicolon-separated list of model headers (without the .h extension). This option is mutually exclusive with -Dwith-modelset. [default=OFF]." )
set( tics_per_ms "1000.0" CACHE STRING "Specify elementary unit of time [default=1000 tics per ms]." )
set( tics_per_step "100" CACHE STRING "Specify resolution [default=100 tics per step]." )
set( external-modules OFF CACHE STRING "External NEST modules to be linked in, separated by ';', [default=OFF]." )
set( with-detailed-timers OFF CACHE STRING "Build with detailed internal time measurements [default=OFF]. Detailed timers can affect the performance." )
set( target-bits-split "standard" CACHE STRING "Split of the 64-bit target neuron identifier type [default='standard']. 'standard' is recommended for most users. If running on more than 262144 MPI processes or more than 512 threads, change to 'hpc'." )

@@ -136,7 +135,6 @@ nest_process_with_libraries()
nest_process_with_includes()
nest_process_with_defines()
nest_process_static_libraries()
nest_process_external_modules()
nest_process_tics_per_ms()
nest_process_tics_per_step()
nest_process_with_libltdl()
12 changes: 0 additions & 12 deletions cmake/ConfigureSummary.cmake
Original file line number Diff line number Diff line change
@@ -43,18 +43,6 @@ function( NEST_PRINT_CONFIG_SUMMARY )
message( "Built-in modelset : ${with-modelset}" )
endif ()

message( "" )
if ( external-modules )
message( "User modules : ${external-modules}" )
foreach ( mod ${external-modules} )
message( " ${mod}:" )
message( " Header : ${${mod}_EXT_MOD_INCLUDE}" )
message( " Library : ${${mod}_EXT_MOD_LIBRARY}" )
endforeach ()
else ()
message( "User modules : None" )
endif ()

message( "" )
if ( HAVE_PYTHON )
message( "Python bindings : Yes (Python ${Python_VERSION}: ${PYTHON})" )
51 changes: 7 additions & 44 deletions cmake/ProcessOptions.cmake
Original file line number Diff line number Diff line change
@@ -222,43 +222,6 @@ function( NEST_PROCESS_STATIC_LIBRARIES )
endif ()
endfunction()

function( NEST_PROCESS_EXTERNAL_MODULES )
if ( external-modules )
# headers from external modules will be installed here
include_directories( "${CMAKE_INSTALL_FULL_INCLUDEDIR}" )

# put all external libs into this variable
set( EXTERNAL_MODULE_LIBRARIES )
# put all external headers into this variable
set( EXTERNAL_MODULE_INCLUDES )
foreach ( mod ${external-modules} )
# find module header
find_file( ${mod}_EXT_MOD_INCLUDE
NAMES ${mod}module.h
HINTS "${CMAKE_INSTALL_FULL_INCLUDEDIR}/${mod}module"
)
if ( ${mod}_EXT_MOD_INCLUDE STREQUAL "${mod}_EXT_MOD_INCLUDE-NOTFOUND" )
printError( "Cannot find header for external module '${mod}'. "
"Should be '${CMAKE_INSTALL_FULL_INCLUDEDIR}/${mod}module/${mod}module.h' ." )
endif ()
list( APPEND EXTERNAL_MODULE_INCLUDES ${${mod}_EXT_MOD_INCLUDE} )

# find module library
find_library( ${mod}_EXT_MOD_LIBRARY
NAMES ${mod}module
HINTS "${CMAKE_INSTALL_FULL_LIBDIR}/nest"
)
if ( ${mod}_EXT_MOD_LIBRARY STREQUAL "${mod}_EXT_MOD_LIBRARY-NOTFOUND" )
printError( "Cannot find library for external module '${mod}'." )
endif ()
list( APPEND EXTERNAL_MODULE_LIBRARIES "${${mod}_EXT_MOD_LIBRARY}" )
endforeach ()

set( EXTERNAL_MODULE_LIBRARIES ${EXTERNAL_MODULE_LIBRARIES} PARENT_SCOPE )
set( EXTERNAL_MODULE_INCLUDES ${EXTERNAL_MODULE_INCLUDES} PARENT_SCOPE )
endif ()
endfunction()

function( NEST_PROCESS_TICS_PER_MS )
# Set tics per ms / step
if ( tics_per_ms )
@@ -280,7 +243,7 @@ function( NEST_PROCESS_WITH_LIBLTDL )
if ( with-ltdl AND NOT static-libraries )
if ( NOT ${with-ltdl} STREQUAL "ON" )
# a path is set
set( LTDL_ROOT_DIR "${with-ltdl}" )
set( LTDL_ROOT "${with-ltdl}" )
endif ()

find_package( LTDL )
@@ -304,7 +267,7 @@ function( NEST_PROCESS_WITH_READLINE )
if ( with-readline )
if ( NOT ${with-readline} STREQUAL "ON" )
# a path is set
set( READLINE_ROOT_DIR "${with-readline}" )
set( Readline_ROOT "${with-readline}" )
endif ()

find_package( Readline )
@@ -328,7 +291,7 @@ function( NEST_PROCESS_WITH_GSL )
if ( with-gsl )
if ( NOT ${with-gsl} STREQUAL "ON" )
# if set, use this prefix
set( GSL_ROOT_DIR "${with-gsl}" )
set( GSL_ROOT "${with-gsl}" )
endif ()

find_package( GSL )
@@ -503,7 +466,7 @@ function( NEST_PROCESS_WITH_LIBNEUROSIM )
if ( with-libneurosim )
if ( NOT ${with-libneurosim} STREQUAL "ON" )
# a path is set
set( LIBNEUROSIM_ROOT ${with-libneurosim} )
set( LibNeurosim_ROOT ${with-libneurosim} )
endif ()

find_package( LibNeurosim )
@@ -527,7 +490,7 @@ function( NEST_PROCESS_WITH_MUSIC )
if ( with-music )
if ( NOT ${with-music} STREQUAL "ON" )
# a path is set
set( MUSIC_ROOT_DIR "${with-music}" )
set( Music_ROOT "${with-music}" )
endif ()

if ( NOT HAVE_MPI )
@@ -553,7 +516,7 @@ function( NEST_PROCESS_WITH_SIONLIB )
set( HAVE_SIONLIB OFF )
if ( with-sionlib )
if ( NOT ${with-sionlib} STREQUAL "ON" )
set( SIONLIB_ROOT_DIR "${with-sionlib}" CACHE INTERNAL "sionlib" )
set( SIONlib_ROOT "${with-sionlib}" CACHE INTERNAL "sionlib" )
endif()

if ( NOT HAVE_MPI )
@@ -576,7 +539,7 @@ function( NEST_PROCESS_WITH_BOOST )
if ( with-boost )
if ( NOT ${with-boost} STREQUAL "ON" )
# a path is set
set( BOOST_ROOT "${with-boost}" )
set( Boost_ROOT "${with-boost}" )
endif ()

set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs
3 changes: 0 additions & 3 deletions doc/htmldoc/installation/cmake_options.rst
Original file line number Diff line number Diff line change
@@ -166,9 +166,6 @@ NEST properties
+-----------------------------------------------+----------------------------------------------------------------+
| ``-Dtics_per_step=[number]`` | Specify resolution [default=100 tics per step]. |
+-----------------------------------------------+----------------------------------------------------------------+
| ``-Dexternal-modules=[OFF|<list;of;modules>]``| External NEST modules to be linked in, separated by ';', |
| | [default=OFF]. |
+-----------------------------------------------+----------------------------------------------------------------+
| ``-Dwith-detailed-timers=[OFF|ON]`` | Build with detailed internal time measurements [default=OFF]. |
| | Detailed timers can affect the performance. |
+-----------------------------------------------+----------------------------------------------------------------+
5 changes: 2 additions & 3 deletions nest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -56,10 +56,10 @@ set_target_properties( nest_lib

target_link_libraries( nest
nestutil nestkernel sli_lib sli_readline models
${EXTERNAL_MODULE_LIBRARIES} OpenMP::OpenMP_CXX )
OpenMP::OpenMP_CXX )

target_link_libraries( nest_lib
nestutil nestkernel sli_lib models ${EXTERNAL_MODULE_LIBRARIES}
nestutil nestkernel sli_lib models
OpenMP::OpenMP_CXX )

target_include_directories( nest PRIVATE
@@ -88,7 +88,6 @@ target_include_directories( nest_lib PRIVATE
${Python_INCLUDE_DIRS}
)


if ( HAVE_PYTHON )
target_compile_definitions( nest_lib PRIVATE
-D_IS_PYNEST
24 changes: 0 additions & 24 deletions nest/neststartup.cpp
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
#include "logging_event.h"

// Includes from nestkernel:
#include "dynamicloader.h"
#include "kernel_manager.h"
#include "nest.h"
#include "nestmodule.h"
@@ -111,29 +110,6 @@ neststartup( int* argc, char*** argv, SLIInterpreter& engine, std::string module
// NestModule extends SLI by commands for neuronal simulations
addmodule< nest::NestModule >( engine );

/*
* The following section concerns shared user modules and is thus only
* included if we built with libtool and libltdl.
*
* One may want to link user modules statically, but for convenience
* they still register themselves with the DyamicLoadModule during static
* initialization. At the same time, we need to create the DynamicLoaderModule,
* since the compiler might otherwise optimize DynamicLoaderModule::registerLinkedModule() away.
*/
#ifdef HAVE_LIBLTDL
// dynamic loader module for managing linked and dynamically loaded extension
// modules
nest::DynamicLoaderModule* pDynLoader = new nest::DynamicLoaderModule( engine );

// initialize all modules that were linked at compile time.
// These modules were registered via DynamicLoader::registerLinkedModule
// from their constructor
pDynLoader->initLinkedModules( engine );

// interpreter will delete module on destruction
engine.addmodule( pDynLoader );
#endif

#ifdef _IS_PYNEST
// add the init-script to the list of module initializers
ArrayDatum* ad = dynamic_cast< ArrayDatum* >( engine.baselookup( engine.commandstring_name ).datum() );
3 changes: 2 additions & 1 deletion nestkernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ set ( nestkernel_sources
deprecation_warning.h deprecation_warning.cpp
device.h device.cpp
device_node.h
dynamicloader.h dynamicloader.cpp
module_manager.h module_manager.cpp
event.h event.cpp
exceptions.h exceptions.cpp
genericmodel.h genericmodel_impl.h
@@ -116,6 +116,7 @@ set ( nestkernel_sources
spatial.h spatial.cpp
stimulation_backend.h
buffer_resize_log.h buffer_resize_log.cpp
nest_extension_interface.h
)


4 changes: 2 additions & 2 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
@@ -91,9 +91,9 @@ nest::ConnectionManager::~ConnectionManager()
}

void
nest::ConnectionManager::initialize( const bool reset_kernel )
nest::ConnectionManager::initialize( const bool adjust_number_of_threads_or_rng_only )
{
if ( reset_kernel )
if ( not adjust_number_of_threads_or_rng_only )
{
keep_source_table_ = true;
connections_have_changed_ = false;
Loading
Loading