Skip to content
Merged
Show file tree
Hide file tree
Changes from 191 commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
fe1a261
CUDA added to the build image: #8
Feb 10, 2025
510dc12
Redundant key adding remove: #8
Feb 10, 2025
5a518b7
CUDA ARM installation fix: #8
Feb 10, 2025
22dd10f
Build fix: #8
Feb 10, 2025
b974221
TARGETARCH added as argument: #8
Feb 10, 2025
ac74dc5
Name fix: #8
Feb 10, 2025
6053797
Key fix: #8
Feb 10, 2025
d8a23b5
Download fix: #8
Feb 10, 2025
0941614
Trying to fix build: #8
Feb 10, 2025
6f6291b
CUDA CMakeListst add: #8
Feb 24, 2025
75f60cf
CUDA backend headers add: #8
artiomn Feb 24, 2025
a952b89
CUDA backend impl add: #8
artiomn Feb 24, 2025
7678a1e
CUDA backend impl add: #8
artiomn Feb 24, 2025
c8eca2c
CUDA headers directory renamed: #8
artiomn Feb 24, 2025
619297f
CUDA device implementation stub add: #8
artiomn Feb 24, 2025
bf31daf
Removed file restored: #8
artiomn Feb 24, 2025
0a33aef
Fix doc: #8
artiomn Feb 24, 2025
7b5330c
File renamed, fixes: #8
artiomn Feb 24, 2025
8d691c7
Backend directory renamed: #8
artiomn Feb 24, 2025
77d859f
Configuration fix: #8
artiomn Feb 24, 2025
4f1e6b4
CUDA build fix: #8
artiomn Feb 24, 2025
2d328df
CPU device class fix: #8
artiomn Feb 26, 2025
a7b6e43
CUDA device class implemented: #8
artiomn Feb 26, 2025
abff972
CUDA test added: #8
artiomn Feb 26, 2025
f8a53e5
Merge branch 'master' into feature/#8-cuda-backend
artiomn Feb 26, 2025
91aaf05
CUDA test file template add: #8
artiomn Feb 26, 2025
04efe5b
CUDA device interface fix: #8
artiomn Feb 26, 2025
849bc40
Device population loading: #8
artiomn Mar 6, 2025
ad2077d
Device projection loading: #8
artiomn Mar 6, 2025
10ba556
Merge branch 'master' into feature/#8-cuda-backend
artiomn Mar 6, 2025
a603f6f
CUDA bus proto: #8
artiomn Mar 19, 2025
5583e5e
CUDA build fix: #8
artiomn Mar 19, 2025
56a9807
Some message structures implemented for CUDA: #8
artiomn Apr 4, 2025
fafdb29
CUDA subscription implemented, bus interface fixed: #8
artiomn Apr 29, 2025
e3d7139
Merge branch 'master' into feature/#8-cuda-backend
artiomn Apr 29, 2025
7fc3753
Compilation restored: #8
artiomn Apr 30, 2025
0534827
DeltaSynapse and BLIFATNeuron implemented for CUDA: #8
artiomn May 28, 2025
ea6fdad
CUDA backend implementation separated: #8
artiomn Jun 4, 2025
b4db75f
Improve build script, CMake parameters can be passed: #8
artiomn Jun 4, 2025
450cfeb
Link fixed: #8
artiomn Jun 4, 2025
4e7ce6e
CUDA backend implementation build partially fixed: #8
artiomn Jun 10, 2025
61f66bc
Merge branch 'KasperskyLab:master' into feature/#8-cuda-backend
artiomn Jun 18, 2025
6d03d26
Backend one device selection fixed: #8
artiomn Jun 18, 2025
526936a
CUDA device selection implemented: #8
artiomn Jun 18, 2025
3984813
CUDA device improved: #8
artiomn Jun 27, 2025
d30ed0b
CUDA device improved: #8
artiomn Jun 27, 2025
635d8a4
Merge branch 'KasperskyLab:master' into feature/#8-cuda-backend
artiomn Jun 27, 2025
b13426e
CUDA device power getting fix: #8
artiomn Jun 27, 2025
c9dd4e8
Redundant CUDA bus endpoint removed: #8
artiomn Jun 27, 2025
efbc8aa
CUDA build option add: #8
artiomn Jul 1, 2025
aedf9e3
CUDA device specifiers replaced: #8
artiomn Jul 1, 2025
60979f8
CUDA IPO fix: #8
artiomn Jul 6, 2025
0aa5100
CUDA device library implementation started: #8
artiomn Jul 6, 2025
21fd5a6
Merge branch 'KasperskyLab:master' into feature/#8-cuda-backend
artiomn Jul 6, 2025
03ef3da
Adding functions for CUDA message bus: #0000008
a-vartenkov Jul 18, 2025
4510a87
Change cuda functions declarations: #0000008
a-vartenkov Jul 22, 2025
9b4ab52
Restore message bus compilation: #0000008
a-vartenkov Jul 22, 2025
3e36c50
Some changes required for the simplest test, not working yet: #000008
a-vartenkov Jul 24, 2025
2f6ccb7
Compilation partially restored: #8
artiomn Jul 24, 2025
5d688b4
Add some tests, make vector host device: #0000008
a-vartenkov Jul 26, 2025
cd8530a
Fix message and subscription: #0000008
a-vartenkov Jul 28, 2025
1d6de98
Restored more of subscription functions: #0000008
a-vartenkov Jul 29, 2025
7519b76
Fix CudaVector constructor and destructor somewhat: #0000008
a-vartenkov Jul 30, 2025
7efd0e4
Change Allocator to host-device: #0000008
a-vartenkov Jul 30, 2025
a0b9dfb
Upgrade CudaVector: #0000008
a-vartenkov Aug 1, 2025
6e5a910
Change receive message from host to device: #00000008
a-vartenkov Aug 1, 2025
f01d51c
Fix container functions, equality isn't working: #0000008
a-vartenkov Aug 6, 2025
d975115
Use allocator instead of new: #0000008
a-vartenkov Aug 6, 2025
949e8eb
Segfault fixed: #8
artiomn Aug 6, 2025
f6094e4
Fix reserve and equality kernel: #0000008
a-vartenkov Aug 6, 2025
e3502eb
Bus fix: #8
artiomn Aug 6, 2025
04a4137
Merge branch 'master' into feature/#8-cuda-message-bus
artiomn Aug 8, 2025
fe0ca04
Projection and Population classes were split: #8
artiomn Aug 8, 2025
027439a
BLIFAT Population code implemented for CUDA: #8
artiomn Aug 8, 2025
6b1693f
step method removed from GPU: #8
artiomn Aug 10, 2025
b53d39a
Projection and population calculation calls moved from GPU step metho…
artiomn Aug 10, 2025
061bac4
Move some functions to cu - not working: #0000008
a-vartenkov Aug 11, 2025
4aa1250
Merge branch 'feature/#8-cuda-message-bus' of github.com:artiomn/knp …
a-vartenkov Aug 11, 2025
f814770
Fix some tests: #0000008
a-vartenkov Aug 11, 2025
608fbda
Remove extra line: #0000008
a-vartenkov Aug 11, 2025
b32c9e1
Doxygen fix: #8
artiomn Aug 12, 2025
a4ce192
CUDA backend link fix: #8
artiomn Aug 12, 2025
f54ad7d
CUDA backend partially implemented: #8
artiomn Aug 14, 2025
98c8d29
CUCO added as a dependency: #8
artiomn Aug 14, 2025
31c92e9
CUDA backend compilation restored: #8
artiomn Aug 19, 2025
e87b300
Merge branch 'master' into feature/#8-cuda-message-bus
artiomn Aug 20, 2025
52ec712
Loading projections and populations to GPU: #8
artiomn Aug 20, 2025
22a3cfc
CUDA calculation fix: #8
artiomn Aug 20, 2025
f0b87af
CUDA step partially implemented: #8
artiomn Aug 20, 2025
24faa2c
CUCO dependency removed: #8
artiomn Aug 21, 2025
a322581
CUDA tests separated: #8
artiomn Aug 22, 2025
a903bfe
CUDA vector improved: #8
artiomn Aug 22, 2025
720c7ac
Compilation fix: #8
artiomn Aug 22, 2025
b36ddf8
Test: #8
artiomn Aug 22, 2025
44d2083
CUDA projections and populations loading improved: #8
artiomn Aug 22, 2025
3081136
CUDA projections and populations improved, compilation failed: #8
artiomn Aug 26, 2025
38646b9
Compilation fix: #8
artiomn Aug 27, 2025
2396b07
CUDA vector from std vector constructor add: #8
artiomn Aug 27, 2025
6087c3d
Fix copy_kernel for UID: #0000008
a-vartenkov Sep 5, 2025
257ae0a
Merge with changes: #0000008
a-vartenkov Sep 5, 2025
ecef14b
Restore compilability: #0000008
a-vartenkov Sep 5, 2025
4d3cc6b
Adding extraction functions for messages, subscriptions etc: #0000008
a-vartenkov Sep 26, 2025
cdd2735
Fix newlines: #0000008
a-vartenkov Sep 26, 2025
5a7ec77
Move extraction functions around: #00000008
a-vartenkov Sep 26, 2025
8ae885d
Compilation partially fixed: #8
artiomn Sep 27, 2025
e650503
Some changes to make code closer to compilability: #0000008
a-vartenkov Sep 29, 2025
d884ba4
Restore compilation: #0000008
a-vartenkov Sep 30, 2025
25e0e43
Change structs to classes, improve push_back, not working yet: #0000008
a-vartenkov Oct 2, 2025
9bd967c
Remove allocator as a parameter: #0000008
a-vartenkov Oct 3, 2025
2722d0e
Add construct_kernel test: #0000008
a-vartenkov Oct 4, 2025
9dad342
Change some kernels: #0000008
a-vartenkov Oct 4, 2025
94fba5e
Fix error 98 and equal kernel: #0000008
a-vartenkov Oct 5, 2025
c3f1f15
Add macro for template initiation, fix some kernels: #0000008
a-vartenkov Oct 6, 2025
3f90779
Fix error 98 in message bus test, doesn't work yet: #0000008
a-vartenkov Oct 8, 2025
42f7823
Python framework under Windows build: #96
Oct 8, 2025
863f448
More logging for cuda vector: #0000008
a-vartenkov Oct 9, 2025
57c38c7
Test renamed: #8
artiomn Oct 13, 2025
329b116
Fix: #8
artiomn Oct 14, 2025
2bdc499
Fix subscription move: #0000008
a-vartenkov Oct 15, 2025
1068db0
Temp restore compilation: #0000008
a-vartenkov Oct 15, 2025
8456007
CCCC CUDA fix: #8
artiomn Oct 16, 2025
fd1b52a
CUDA SMallestNetwork test add: #8
artiomn Oct 16, 2025
826f75d
Temporary build fix: #96
Oct 16, 2025
0778174
Merge branch 'master' into feature/#8-cuda-message-bus
artiomn Oct 16, 2025
5d990cc
Fix vector erase, add erase test: #0000008
a-vartenkov Oct 17, 2025
4c5f8d5
Fix bus unsubscribe and vector erase: #0000008
a-vartenkov Oct 17, 2025
0843ca2
Trhust vector replaced with CUDAVector: #8
artiomn Oct 17, 2025
9b4c144
Changed subscribe to std vector: #0000008
a-vartenkov Oct 19, 2025
6b925f4
Forgotten testing namespace added: #8
artiomn Oct 21, 2025
38f7b63
CUDAVector initializer constructor added: #8
artiomn Oct 22, 2025
39f949e
Messaging tests added: #8
artiomn Oct 22, 2025
f0ee976
Finishing message bus, at least compiles: #0000008
a-vartenkov Oct 24, 2025
14adfb1
Merging, not sure if compiles: #0000008
a-vartenkov Oct 24, 2025
6e5ae1d
Merging, not sure if compiles: #0000008
a-vartenkov Oct 24, 2025
f03b933
Fixing compilation: #0000008
a-vartenkov Oct 24, 2025
f4704cd
Fix tests compilation: #0000008
a-vartenkov Oct 24, 2025
225452c
Fixing tests, HostSubscription works: #0000008
a-vartenkov Oct 27, 2025
131cd6b
Added some changes from Artiom N: #0000008
a-vartenkov Oct 27, 2025
b899de2
Add types registration: #0000008
a-vartenkov Oct 28, 2025
8466e0e
Fixed add-receive message test: #0000008
a-vartenkov Oct 29, 2025
23e982c
Calculations methods became static: #8
artiomn Oct 29, 2025
321a657
Projection message finding implemented: #8
artiomn Oct 31, 2025
9d73084
Python neurons and synapses type conversion fix: #96
Nov 1, 2025
7ceb069
AltAI LIF neuron added to Python framework: #96
Nov 1, 2025
c75c556
Updating projection interface: #0000008
a-vartenkov Nov 1, 2025
17cc6f9
Fixes: #8
artiomn Nov 1, 2025
98886dd
Restoring compilation: #0000008
a-vartenkov Nov 4, 2025
2eeefc1
Population messaging fixes: #8
artiomn Nov 5, 2025
d40e759
Add population message exchange, not compiling: #0000008
a-vartenkov Nov 6, 2025
2a95523
Compilation fix: #8
artiomn Nov 6, 2025
4435f2d
Add functions for variant processing. Not working yet: #0000008
a-vartenkov Nov 9, 2025
02c9fce
Restore compilation: #0000008
a-vartenkov Nov 9, 2025
8b8a47d
GPU selection in the test added: #8
artiomn Nov 10, 2025
d8fcf4e
Add more checks on zero threads: #0000008
a-vartenkov Nov 10, 2025
777785b
GPU selection in the test added: #8
artiomn Nov 10, 2025
3bf2536
Style fix: #8
artiomn Nov 10, 2025
874ea53
GPU projection subscription add: #8
artiomn Nov 10, 2025
375d89d
Functions replaced with templates: #8
artiomn Nov 11, 2025
d394d69
Add Register to network test: #0000008
a-vartenkov Nov 12, 2025
e3b58de
Add type registration, doesn't work yet: #0000008
a-vartenkov Nov 14, 2025
308b548
Add registration for vector of vectors of uint64_t: #0000008
a-vartenkov Nov 14, 2025
f6d6472
Fix memory errors: #0000008
a-vartenkov Nov 18, 2025
a107c0b
Remove CUDA launch configuration error: #0000008
a-vartenkov Nov 19, 2025
b45ab99
Add message conversion to GPU: #0000008
a-vartenkov Nov 20, 2025
d3b4dab
Add reverse message transformation: #0000008
a-vartenkov Nov 21, 2025
fa6a8cc
Add message exchange with host, compiles but not tested: #0000008
a-vartenkov Nov 24, 2025
3a798cf
Connected gpu bus with backend's internal endpoint: #0000008
a-vartenkov Nov 26, 2025
c8b275c
Messages sending and receiving in backends tests refactored: #8
artiomn Nov 27, 2025
6d9c03b
Tests fix: #8
artiomn Nov 27, 2025
94a79e7
CUDA backend test unification: #8
artiomn Nov 27, 2025
b024d0b
CUDA backend messaging fix: #8
artiomn Nov 27, 2025
c0733ce
CUDA backend initialization: #8
artiomn Nov 27, 2025
844d903
Indexes instead of iterators: #0000008
a-vartenkov Nov 28, 2025
2e8fd0b
Add connection to host: #0000008
a-vartenkov Dec 3, 2025
4b4f734
Fix wrong memory access: #0000008
a-vartenkov Dec 3, 2025
b7c261c
Python framework core refactored: #96
Dec 5, 2025
6ac567d
Python bindings for C++ framework refactored: #96
Dec 5, 2025
93b6137
Python bindings for C++ framework refactored: #96
Dec 5, 2025
feff7d4
Merge branch 'master' of https://github.com/artiomn/knp
Dec 5, 2025
559ff0a
Python bindings for neurons library refactored: #96
Dec 5, 2025
f4527d3
Python bindings for synapses library refactored: #96
Dec 5, 2025
544e1fe
Fix device push_back and equal, add more logs: #0000008
a-vartenkov Dec 6, 2025
76ed8c4
Fix some vector issues, remove default constructor from traits: #0000008
a-vartenkov Dec 9, 2025
c255ac3
Add some logs, register some types: #0000008
a-vartenkov Dec 10, 2025
e0e9336
Remove reinterpret from vector, register synaptic impact: #0000008
a-vartenkov Dec 10, 2025
45a288c
Some more fixes, too many spikes: #0000008
a-vartenkov Dec 15, 2025
ffe96ed
Fix smallest network test, add parameter to header: #0000008
a-vartenkov Dec 17, 2025
638f706
Merge branch 'master' of https://github.com/artiomn/knp
Dec 17, 2025
6bd9a23
Logging improved: #96
Dec 17, 2025
e0c6174
Backend loading in Python fix: #96
Dec 17, 2025
1c0de90
Merge branch 'feature/#8-cuda-message-bus'
Dec 17, 2025
3e96908
Fixing minor issues, such as extra empty lines: #0000008
a-vartenkov Dec 17, 2025
f92fc35
Fix comments for pull request: #0000008
a-vartenkov Dec 18, 2025
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ repos:
# language_version: python3

- repo: https://github.com/pre-commit/pre-commit
rev: v4.5.0
rev: v4.5.1
hooks:
- id: validate_manifest

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.0
rev: v1.19.1
hooks:
- id: mypy
args: ["--config-file", "knp/.mypy.ini", "--install-types", "--explicit-package-bases", "--check-untyped-defs", "--scripts-are-modules", "--strict"]
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
]]

cmake_minimum_required(VERSION 3.25)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHED)

include_guard(GLOBAL)

Expand Down Expand Up @@ -159,6 +160,7 @@ else()
endif()

cmake_dependent_option(KNP_BUILD_DOCUMENTATION "Build doxygen auto documentation" ${KNP_BUILD_AUTONOMOUS} "DOXYGEN_FOUND" OFF)
option(KNP_BUILD_CUDA "Enable CUDA backend build" ON)
option(KNP_BUILD_EXAMPLES "Build usage examples" ${KNP_BUILD_AUTONOMOUS})
option(KNP_BUILD_TESTS "Build tests" ${KNP_BUILD_AUTONOMOUS})
option(KNP_ENABLE_AVX "Enable AVX and other CPU-specific extensions in the release build" ${KNP_ENABLE_AVX_DEFAULT})
Expand Down Expand Up @@ -196,7 +198,8 @@ if (KNP_ENABLE_AVX)
# endif()

set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
add_compile_options(-include x86intrin.h)
add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:-include>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX,C>:x86intrin.h>)
# -include bits/stdc++.h
endif()

Expand Down
5 changes: 3 additions & 2 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ filter=-legal/copyright,-whitespace/braces
linelength=120
root=knp


# - Do not check access modifier indentation.
# CPPLint enforces +1, but our rule is no indentation.
# - Do not check NOLINT* directives.
Expand All @@ -17,7 +16,9 @@ root=knp
# Chromium team uses own headers instead of standard.
# - whitespace/newline
# An else should appear on the same line as the preceding }
filter=-whitespace/indent,-readability/nolint,-readability/todo,-build/include_subdir,-runtime/references,-build/c++11,-whitespace/newline, -whitespace/parens
# - build/include_order
# Need to skip CUDA headers.
filter=-whitespace/indent,-readability/nolint,-readability/todo,-build/include_subdir,-runtime/references,-build/c++11,-whitespace/newline, -whitespace/parens,-build/include_order

# Python framework macroses.
filter=-readability/braces
Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ while getopts "rcvsh" o; do
SINGLE_PROCESS=1
;;
*)
usage
exit 1
shift $((OPTIND-1))
CMAKE_ADD_OPTS="${CMAKE_ADD_OPTS} $*"
break;
;;
esac
done
Expand Down
19 changes: 10 additions & 9 deletions cmake/knp-functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,16 @@ function(knp_set_target_parameters target visibility)
else()
set(pub_visibility "PUBLIC")
if(KNP_IPO_ENABLED)
check_ipo_supported(RESULT _ipo_result OUTPUT _ipo_output)
check_ipo_supported(RESULT _ipo_result OUTPUT _ipo_output LANGUAGES C CXX)
if (_ipo_result)
set_target_properties("${target}" PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
set_target_properties("${target}" PROPERTIES
$<$<NOT:$<COMPILE_LANGUAGE:C,CXX>>:INTERPROCEDURAL_OPTIMIZATION TRUE>)
else()
message(WARNING "IPO is not supported: ${_ipo_output}.")
endif()
endif()
endif()

# if (MSVC) # AND ($<COMPILE_LANGUAGE> STREQUAL CXX OR $<COMPILE_LANGUAGE> STREQUAL C))
# set_property(TARGET "${target}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
# endif()

target_compile_options("${target}" ${visibility} $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wdocumentation>)
target_compile_options("${target}" ${visibility} $<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wdocumentation>)

Expand Down Expand Up @@ -236,6 +233,12 @@ function(knp_add_python_module name)
target_include_directories("${LIB_NAME}" PRIVATE ${Python3_INCLUDE_DIRS})
message(TRACE "Linking ${LIB_NAME} with Boost::python${PARSED_ARGS_PY_VER}...")
target_link_libraries("${LIB_NAME}" PRIVATE Boost::disable_autolinking Boost::headers Boost::python${PARSED_ARGS_PY_VER} ${PARSED_ARGS_LINK_LIBRARIES})
target_compile_options("${LIB_NAME}" PRIVATE $<$<CONFIG:Debug>:-DBOOST_PYTHON_DEBUG>)

# if (MSVC) # AND ($<COMPILE_LANGUAGE> STREQUAL CXX OR $<COMPILE_LANGUAGE> STREQUAL C))
# # Dynamic MSVC runtime.
# set_property(TARGET "${LIB_NAME}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
# endif()

# set_target_properties(${LIB_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
# set_target_properties(${LIB_NAME} PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}")
Expand All @@ -247,8 +250,6 @@ function(knp_add_python_module name)

if (NOT WIN32)
target_compile_definitions("${LIB_NAME}" PRIVATE Py_NO_ENABLE_SHARED)
else()
target_compile_definitions("${LIB_NAME}" PRIVATE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON)
endif()

add_custom_command(TARGET "${LIB_NAME}" POST_BUILD
Expand Down Expand Up @@ -291,7 +292,7 @@ function(knp_packaging_set_parameters component_name project_name)

if (PARSED_ARGS_DEPENDS)
string(REPLACE ";" ", " PARSED_ARGS_DEPENDS "${PARSED_ARGS_DEPENDS}")
set(CPACK_COMPONENT_${COMPONENT_VAR_NAME}_DEPE NDS "${PARSED_ARGS_DEPENDS}" CACHE STRING "${project_name} dependencies" FORCE)
set(CPACK_COMPONENT_${COMPONENT_VAR_NAME}_DEPENDS "${PARSED_ARGS_DEPENDS}" CACHE STRING "${project_name} dependencies" FORCE)
else()
unset(CPACK_COMPONENT_${COMPONENT_VAR_NAME}_DEPENDS CACHE)
endif()
Expand Down
2 changes: 2 additions & 0 deletions knp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ if (PVS_BINARY)
else()
message(WARNING "PVS analyzer was not found, static analysis with PVS Studio disabled.")
endif()


14 changes: 1 addition & 13 deletions knp/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,4 @@ limitations under the License.
cmake_minimum_required(VERSION 3.25)

add_subdirectory(cpu)

file(GLOB backends LIST_DIRECTORIES true "[a-zA-Z0-9_]*-backend")

if(NOT backends)
message(WARNING "No non-CPU backend was found.")
return()
endif()

foreach(backend ${backends})
message(STATUS "Adding backend \"${backend}\"...")
get_filename_component(BACKEND_NAME "${backend}" NAME)
add_subdirectory("${backend}")
endforeach()
add_subdirectory(gpu)
2 changes: 1 addition & 1 deletion knp/backends/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(NOT backends)
endif()

foreach(backend ${backends})
message(STATUS "Adding backend \"${backend}\"...")
message(STATUS "Adding CPU backend \"${backend}\"...")
get_filename_component(BACKEND_NAME "${backend}" NAME)
add_subdirectory("${backend}")
endforeach()
3 changes: 2 additions & 1 deletion knp/backends/cpu/cpu-devices/impl/unknown_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ CPU::CPU(uint32_t cpu_num) : cpu_num_(cpu_num), power_meter_{std::make_unique<Cp
}


CPU::CPU(CPU&& other) : cpu_name_{std::move(other.cpu_name_)} {}
CPU::CPU(CPU&& other) : cpu_name_{std::move(other.cpu_name_)}, cpu_num_{std::move(other.cpu_num_)} {}


CPU::~CPU() {}


CPU& CPU::operator=(CPU&& other) noexcept
{
cpu_num_.swap(other.cpu_num_);
cpu_name_.swap(other.cpu_name_);
power_meter_.swap(other.power_meter_);
return *this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <knp/synapse-traits/stdp_synaptic_resource_rule.h>

#include <spdlog/spdlog.h>
#include <spdlog/fmt/fmt.h>

#include <algorithm>
#include <mutex>
Expand Down Expand Up @@ -65,12 +66,12 @@ constexpr bool is_forcing<knp::core::Projection<synapse_traits::DeltaSynapse>>()
template <typename ProjectionType>
MessageQueue::const_iterator calculate_delta_synapse_projection_data(
ProjectionType &projection, std::vector<core::messaging::SpikeMessage> &messages, MessageQueue &future_messages,
size_t step_n,
const size_t step_n,
std::function<knp::synapse_traits::synapse_parameters<knp::synapse_traits::DeltaSynapse>(
const typename ProjectionType::SynapseParameters &)>
sp_getter = [](const typename ProjectionType::SynapseParameters &synapse_params) { return synapse_params; })
{
SPDLOG_TRACE("Calculating delta synapse projection data...");
SPDLOG_TRACE("Calculating delta synapse projection data for the step = {}", step_n);
using SynapseType = typename ProjectionType::ProjectionSynapseType;
WeightUpdateSTDP<SynapseType>::init_projection(projection, messages, step_n);

Expand All @@ -80,6 +81,7 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
for (const auto &spiked_neuron_index : message_data)
{
auto synapses = projection.find_synapses(spiked_neuron_index, ProjectionType::Search::by_presynaptic);
SPDLOG_TRACE("Projection synapse count for the spike = {}", synapses.size());
for (auto synapse_index : synapses)
{
auto &synapse = projection[synapse_index];
Expand All @@ -94,8 +96,13 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
static_cast<uint32_t>(std::get<core::target_neuron_id>(synapse))};

auto iter = future_messages.find(future_step);

SPDLOG_TRACE("Synapse index = {}, synapse delay = {}, synapse weight = {}, step = {}, future step = {}",
synapse_index, synapse_params.delay_, synapse_params.weight_, step_n, future_step);

if (iter != future_messages.end())
{
SPDLOG_TRACE("Add existing impact.");
iter->second.impacts_.push_back(impact);
}
else
Expand All @@ -106,11 +113,13 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
projection.get_postsynaptic(),
is_forcing<ProjectionType>(),
{impact}};
SPDLOG_TRACE("Add new impact.");
future_messages.insert(std::make_pair(future_step, message_out));
}
}
}
}

WeightUpdateSTDP<SynapseType>::modify_weights(projection);
return future_messages.find(step_n);
}
Expand Down Expand Up @@ -208,6 +217,18 @@ void calculate_delta_synapse_projection_impl(
SPDLOG_DEBUG("Calculating delta synapse projection...");

auto messages = endpoint.unload_messages<core::messaging::SpikeMessage>(projection.get_uid());

SPDLOG_DEBUG("Messages count = {}...", messages.size());

#if (SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE)
for (const auto &message : messages)
{
SPDLOG_TRACE("Spike from {} with spiked neurons: {}",
std::string(message.header_.sender_uid_),
fmt::join(message.neuron_indexes_, ", "));
}
#endif

auto out_iter = calculate_delta_synapse_projection_data(projection, messages, future_messages, step_n);
if (out_iter != future_messages.end())
{
Expand Down
30 changes: 30 additions & 0 deletions knp/backends/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#[[
© 2024 AO Kaspersky Lab

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]

cmake_minimum_required(VERSION 3.25)

file(GLOB backends LIST_DIRECTORIES true "[a-zA-Z0-9_]*-backend")

if(NOT backends)
message(WARNING "No backend was found.")
return()
endif()

foreach(backend ${backends})
message(STATUS "Adding GPU backend \"${backend}\"...")
get_filename_component(BACKEND_NAME "${backend}" NAME)
add_subdirectory("${backend}")
endforeach()
Loading
Loading