Spyker
Spyker is a fast software library for spiking neural networks (SNNs). It uses a hand-optimized C++/CUDA core alongside optimized computational backends from Intel and NVIDIA with easy-to-use Python bindings. This means you can test new learning rules in a notebook, run large models quickly on a workstation, or use it in production without rewriting code. Spyker is made for researchers and engineers who need biologically realistic SNN parts (filters, learning rules, sparse encodings) but still want the speed and flexibility of modern deep-learning tools.
In short: Spyker brings event-driven, STDP-capable networks to regular CPUs and GPUs. Its API feels like PyTorch/NumPy but runs with the power and control of native C++.
Why Spyker?
The research behind Spyker shows what makes it different from other SNN tools:
- Speed first -> The backend is written from scratch in C++/CUDA to cut memory use and reduce GPU kernel calls. This makes it several times faster than PyTorch-based SNN libraries. Tasks that used to take hours now finish in minutes on standard GPUs.
- Learning rules -> It includes ready-to-use spike-timing-dependent plasticity (STDP) and reward-modulated STDP (R-STDP). You can easily reproduce neuroscience experiments or test new rules. Backpropagation learning rule is also experimentally being tested.
- Flexible data formats -> Spyker works with both dense tensors (for layers like convolutions) and sparse spike streams. You can pick whichever fits your problem or even mix the two.
- Seamless integration -> The library has seemles interactions with PyTorch and Numpy and plays really well with them.
- Simple API -> The Python and C++ APIs mirror each other, so code you write in Python can be easily ported to C++.
Main Features
- Layer modules: Filters (DoG, Gabor, Laplacian), ZCA whitening, convolution, fully connected layers, pooling, inhibition, spike coding/decoding, winner-take-all (WTA), temporal backprop, and more.
- Plasticity tools: Configurable STDP variants, integrate-and-fire spiking, event aggregation, and winner tracking utilities.
- Device/runtime control: Manage CUDA devices, memory, caching, and threading from Python or C++.
- Interop tools: Convert data between Spyker, NumPy, and PyTorch without copying. Helpers for image read/write, MNIST, and CSV data.
- Docs, examples and tutorials: Full installation notes, tutorials, Jupyter notebooks, and example implementations of famous networks.
Installation (Quick Guide)
You need CMake ≥ 3.24 and a C++11 capable compiler. Optional backends include CUDA, cuDNN, oneDNN, and BLAS/MKL.
Example installs:
# CPU-only C++ build
git clone --recursive https://github.com/ShahriarRezghi/Spyker.git
cmake -S Spyker -B build -DCMAKE_BUILD_TYPE=Release \
-DSPYKER_ENABLE_CUDA=OFF -DSPYKER_ENABLE_CUDNN=OFF
cmake --build build -j$(nproc)
# Python wheel
python -m pip install .
# Editable Python install
python -m pip install --editable .
See the documentation for advanced options like forcing MKL or selecting CUDA architectures.
Documentation
You can see the documentation for installation, usage tutorial, and the C++ and Python interfaces here.
Tutorials
You can take a look at the tutorials listed below to learn how to use the library.
- Tutorial 1: Spyker and PyTorch
- Tutorial 2: Spyker and Numpy
- Tutorial 3: Sparse Spyker
- Tutorial 4: Other Functionalities
- Tutorial 5: Rate Coding
Examples
You can checkout example implementations of some networks in the examples directory. The example use the MNIST dataset, which is expected to be inside the MNIST directory beside the files, and the name of the files is expected to be train-images-idx3-ubyte, train-labels-idx1-ubyte, t10k-images-idx3-ubyte, t10k-labels-idx1-ubyte.
Project Structure
3rd/ # Third-party libraries
docs/ # Documentation
examples/ # Example SNN pipelines
src/ # C++ core and CUDA kernels
src/python/ # Python package
tutorials/ # Tutorial Jupyter notebooks
Future Work
The paper suggests extending Spyker by:
- Adding more learning rules
- Expanding sparse CUDA and neuromorphic support
- Adding more neuron/synapse models
- Exploring recurrent SNNs and event-based data (e.g., speech, DVS)
Contributions are always welcome!
Contributing
Bug reports, features, and pull requests are welcome on the GitHub tracker.
License
Spyker is available under the BSD 3-Clause License.
Metadata
Release files for spyker 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spyker-0.1.0.tar.gz | 12.5 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.17+ x86-64 | Details |
| spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.17+ x86-64 | Details |
| spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64 | Details |
| spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details |
| spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
| spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 115.2 MB
Release files / spyker-0.1.0.tar.gz
| Download URL | spyker-0.1.0.tar.gz |
|---|---|
| Size | 12.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b8d364c07ebc2e4976708cd0fd2d67f2b27f40a416dcd7d17d1f6d3c332f405
|
|
BLAKE2b-256 checksum How to use checksums |
aac1999b6b55918b9ff3d0c116d7c94646a42a9a1627cba71e7112b41e5b0420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3e70e564874cb19e061f574a66cfcaa11f684876266b1a9cf21df85d6ee1879
|
|
BLAKE2b-256 checksum How to use checksums |
3cb8aea0eb839e08e9a590d2a310b852175e59dcb44f88b1dcec0806922aaa4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d7311cb17b4ba0e912d7341739464f1584384b4287612b8d2af312db4086629e
|
|
BLAKE2b-256 checksum How to use checksums |
cfea6fbcf678ebc89806965613cfc9b0c78dff1664348adb88a467d45345a251
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
49448f654b9fae76bcd75298e2ab992b66e0ccf48e749dcf33b69992ccdfe8b3
|
|
BLAKE2b-256 checksum How to use checksums |
c27de5fc04b595236cdad54b99c826adbf894453decde495ce8a665353366502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
07b542a5d5230f623d69a7e09d1d2d380c1db7f68e578d1fb45b0c70b0a3997e
|
|
BLAKE2b-256 checksum How to use checksums |
94230f95983e6c13ba723874d0ea937d56bd9273a36658847d5dfa0db288f1fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8fb18d8f2885f87d268b11c1b72d1ec8d39eefdfff7049ae07195b4874eba063
|
|
BLAKE2b-256 checksum How to use checksums |
2324aaae14f05e53c1e56c604efca2bbc2b0a60ba6517aa686c3ad70507e0a5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ec75d694e4cc8500070eb1c1ae88b10e0c40553728ea17d6d2da77674bb86dcb
|
|
BLAKE2b-256 checksum How to use checksums |
b83757f6f2327c38870a26a45892f9b9ed36a1696294d3eb5a485fe63a3ecf89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|