Skip to main content

IBM Analog Hardware Acceleration Kit

Project description

IBM Analog Hardware Acceleration Kit

PyPI Documentation Status Build Status PyPI - License

Description

IBM Analog Hardware Acceleration Kit is an open source Python toolkit for exploring and using the capabilities of in-memory computing devices in the context of artificial intelligence.

:warning: This library is currently in beta and under active development. Please be mindful of potential issues and keep an eye for improvements, new features and bug fixes in upcoming versions.

The toolkit consists of two main components:

Pytorch integration

A series of primitives and features that allow using the toolkit within Pytorch:

  • Analog neural network modules (fully connected layer, convolution layer, sequential container).
  • Analog training using torch training workflow:
    • Analog torch optimizers (SGD).
    • Analog in-situ training using customizable device models and algorithms (Tiki-Taka).
  • Analog inference using torch inference workflow:
    • State-of-the-art statistical model of a phase-change memory (PCM) array calibrated on hardware measurements from a 1 million PCM devices chip.
    • Hardware-aware training with hardware non-idealities and noise included in the forward pass.

Analog devices simulator

A high-performant (CUDA-capable) C++ simulator that allows for simulating a wide range of analog devices and crossbar configurations by using abstract functional models of material characteristics with adjustable parameters. Features include:

  • Forward pass output-referred noise and device fluctuations, as well as adjustable ADC and DAC discretization and bounds
  • Stochastic update pulse trains for rows and columns with finite weight update size per pulse coincidence
  • Device-to-device systematic variations, cycle-to-cycle noise and adjustable asymmetry during analog update
  • Adjustable device behavior for exploration of material specifications for training and inference
  • State-of-the-art dynamic input scaling, bound management, and update management schemes

Example

Training example

from torch import Tensor
from torch.nn.functional import mse_loss

# Import the aihwkit constructs.
from aihwkit.nn import AnalogLinear
from aihwkit.optim.analog_sgd import AnalogSGD

x = Tensor([[0.1, 0.2, 0.4, 0.3], [0.2, 0.1, 0.1, 0.3]])
y = Tensor([[1.0, 0.5], [0.7, 0.3]])

# Define a network using a single Analog layer.
model = AnalogLinear(4, 2)

# Use the analog-aware stochastic gradient descent optimizer.
opt = AnalogSGD(model.parameters(), lr=0.1)
opt.regroup_param_groups(model)

# Train the network.
for epoch in range(10):
    pred = model(x)
    loss = mse_loss(pred, y)
    loss.backward()

    opt.step()
    print('Loss error: {:.16f}'.format(loss))

You can find more examples in the examples/ folder of the project, and more information about the library in the documentation. Please note that the examples have some additional dependencies - you can install them via pip install -r requirements-examples.txt.

What is Analog AI?

In traditional hardware architecture, computation and memory are siloed in different locations. Information is moved back and forth between computation and memory units every time an operation is performed, creating a limitation called the von Neumann bottleneck.

Analog AI delivers radical performance improvements by combining compute and memory in a single device, eliminating the von Neumann bottleneck. By leveraging the physical properties of memory devices, computation happens at the same place where the data is stored. Such in-memory computing hardware increases the speed and energy-efficiency needed for the next generation of AI. 

What is an in-memory computing chip?

An in-memory computing chip typically consists of multiple arrays of memory devices that communicate with each other. Many types of memory devices such as phase-change memory (PCM), resistive random-access memory (RRAM), and Flash memory can be used for in-memory computing.

Memory devices have the ability to store synaptic weights in their analog charge (Flash) or conductance (PCM, RRAM) state. When these devices are arranged in a crossbar configuration, it allows to perform an analog matrix-vector multiplication in a single time step, exploiting the advantages of analog storage capability and Kirchhoff’s circuits laws. You can learn more about it in our online demo.

In deep learning, data propagation through multiple layers of a neural network involves a sequence of matrix multiplications, as each layer can be represented as a matrix of synaptic weights. The devices are arranged in multiple crossbar arrays, creating an artificial neural network where all matrix multiplications are performed in-place in an analog manner. This structure allows to run deep learning models at reduced energy consumption. 

Installation

Installing from PyPI

The preferred way to install this package is by using the Python package index:

$ pip install aihwkit

:warning: Note that currently we provide CPU-only pre-built packages for specific combinations of architectures and versions, and in some cases a pre-built package might still not be available.

If you encounter any issues during download or want to compile the package for your environment, please refer to the advanced installation guide. That section describes the additional libraries and tools required for compiling the sources, using a build system based on cmake.

Authors

IBM Analog Hardware Acceleration Kit has been developed by IBM Research, with Malte Rasch, Tayfun Gokmen, Diego Moreda and Manuel Le Gallo-Bourdeau as the initial core authors, along with many contributors.

You can contact us by opening a new issue in the repository, or alternatively at the aihwkit@us.ibm.com email address.

License

This project is licensed under Apache License 2.0.

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

aihwkit-0.2.0.tar.gz (245.1 kB view details)

Uploaded Source

Built Distributions

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

aihwkit-0.2.0-cp38-cp38-manylinux2014_x86_64.whl (10.8 MB view details)

Uploaded CPython 3.8

aihwkit-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

aihwkit-0.2.0-cp37-cp37m-manylinux2014_x86_64.whl (10.8 MB view details)

Uploaded CPython 3.7m

aihwkit-0.2.0-cp37-cp37m-macosx_10_9_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

aihwkit-0.2.0-cp36-cp36m-manylinux2014_x86_64.whl (10.8 MB view details)

Uploaded CPython 3.6m

aihwkit-0.2.0-cp36-cp36m-macosx_10_9_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file aihwkit-0.2.0.tar.gz.

File metadata

  • Download URL: aihwkit-0.2.0.tar.gz
  • Upload date:
  • Size: 245.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dcdafb9596c003319f6207af8d4f9e4a58d4e766f08c991375f6228743a54d9b
MD5 c66c163c1f51d21d706d8f78acfd6c35
BLAKE2b-256 4e9562a5518c9d561076182af4460e2a1fcb50d81fddfb36d59e4657b722f22d

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 10.8 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39f713e5789f4d23555e94bb2b825ef62f4eaa72435a4dbfc8a639ce2b5b242f
MD5 aa4a0d0920132e9b07da7488dab13eae
BLAKE2b-256 87d7923bf1a011396a9cb6ee0561b7aed975174808964ead71a3b0e557bbb6fa

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 10.2 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 482122e946703ef9f14d0684c491058e5713c709bfb38302d0af9ccc97e094ec
MD5 ce7aa96b3dcd2bc1bcc6f4e35e90fff4
BLAKE2b-256 ce61bea155066e7d014722216372e18b77fa6b66b27d02e32ccd96a45ecf2535

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 10.8 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af32d03552ddb1bd2bd1bdaf921d93de23c76f1ee37b247ae71f0d0fc8330f10
MD5 ecb43de8b862b8a8588070a84a44fc72
BLAKE2b-256 515212d5a14b62da4e2b2ab4ae26c135250efbc61becbaea62de59fecb806a62

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 10.2 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 429bcafd5dfd501f50c0ab2607a85e7e897cd59e8ddebac2a3e7ef32ad59f608
MD5 e6e6b469106b31f1815a87b2cafe8051
BLAKE2b-256 b3bf76bc9e125a651a06f1368e17073bed4e45bccfeb48a3b0938a87dc922635

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 10.8 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9189bdbeb1d0c8c790286cd705656e21b6b3301243a980c4cb783aad315b69f9
MD5 19d7a487f0b8d25678f3778907e74cd6
BLAKE2b-256 30a3a61304fb478aaa1c4f21729e3e4108bcf94c72c9f5a43cc74c0eada47a56

See more details on using hashes here.

File details

Details for the file aihwkit-0.2.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: aihwkit-0.2.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 10.2 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

File hashes

Hashes for aihwkit-0.2.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d866d16f1c471203dddb5dfd9f9244a6be4a09b3aef97c6b6f999bf16616f430
MD5 06b84b6548f5938ba4d9de33054a8394
BLAKE2b-256 a485ae37f15d6b7c2ac49d798f1adeb34300882c0aea87a536a52d6fa6a51b93

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