Skip to main content

Spiking Deep Neural Networks Library

Project description

logo

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spyker-0.1.0.tar.gz (12.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (17.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file spyker-0.1.0.tar.gz.

File metadata

  • Download URL: spyker-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for spyker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0b8d364c07ebc2e4976708cd0fd2d67f2b27f40a416dcd7d17d1f6d3c332f405
MD5 321eb67dbf3f85afeb39cf645df72a4f
BLAKE2b-256 aac1999b6b55918b9ff3d0c116d7c94646a42a9a1627cba71e7112b41e5b0420

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c3e70e564874cb19e061f574a66cfcaa11f684876266b1a9cf21df85d6ee1879
MD5 1581ab93da61df17475a47907c46d162
BLAKE2b-256 3cb8aea0eb839e08e9a590d2a310b852175e59dcb44f88b1dcec0806922aaa4a

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d7311cb17b4ba0e912d7341739464f1584384b4287612b8d2af312db4086629e
MD5 cc0231f8ea76edbf2536f3b71b160a9c
BLAKE2b-256 cfea6fbcf678ebc89806965613cfc9b0c78dff1664348adb88a467d45345a251

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 49448f654b9fae76bcd75298e2ab992b66e0ccf48e749dcf33b69992ccdfe8b3
MD5 f6dbad39cf0552deaf685859af93112e
BLAKE2b-256 c27de5fc04b595236cdad54b99c826adbf894453decde495ce8a665353366502

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 07b542a5d5230f623d69a7e09d1d2d380c1db7f68e578d1fb45b0c70b0a3997e
MD5 34565a559a4e473571a59af492f28446
BLAKE2b-256 94230f95983e6c13ba723874d0ea937d56bd9273a36658847d5dfa0db288f1fb

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8fb18d8f2885f87d268b11c1b72d1ec8d39eefdfff7049ae07195b4874eba063
MD5 1503bb20f09571c43ce105f77dcfb50d
BLAKE2b-256 2324aaae14f05e53c1e56c604efca2bbc2b0a60ba6517aa686c3ad70507e0a5c

See more details on using hashes here.

File details

Details for the file spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for spyker-0.1.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ec75d694e4cc8500070eb1c1ae88b10e0c40553728ea17d6d2da77674bb86dcb
MD5 15469e3e4521c804214dd44ba8ef693f
BLAKE2b-256 b83757f6f2327c38870a26a45892f9b9ed36a1696294d3eb5a485fe63a3ecf89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page