Advanced installation guide¶
Compilation¶
The build system for aihwkit
is based on cmake, making use of
scikit-build for generating the Python packages.
Some of the dependencies and tools are Python-based. For convenience, we suggest creating a virtual environment as a way to isolate your environment:
$ python3 -m venv aihwkit_env
$ cd aihwkit_env
$ source bin/activate
(aihwkit_env) $
Note
The following sections assume that the command line examples are executed
in the activated aihwkit_env
environment.
Dependencies¶
For compiling aihwkit
, the following dependencies are required:
Dependency |
Version |
Notes |
---|---|---|
C++11 compatible compiler |
||
3.18+ |
||
2.5.0+ |
Installing from |
|
0.11.0+ |
||
3.6+ |
||
BLAS implementation |
||
CUDA |
9.0+ |
Optional, for GPU-enabled simulator |
1.8.0 |
Optional, for GPU-enabled simulator |
|
1.10.0 |
Optional, for building the C++ tests |
|
1.5+ |
The libtorch library and headers are needed 2 |
Please refer to your operative system documentation for instructions on how to install the different dependencies. The following section contains quick instructions for several operative systems:
Debian-based¶
On a Debian-based operative system, the following commands can be used for installing the minimal dependencies:
$ sudo apt-get install python3-pybind11 python3-dev libopenblas-dev
$ pip install cmake scikit-build torch
OSX¶
On an OSX-based system, the following commands can be used for installing the
minimal dependencies (note that Xcode
needs to be installed):
$ brew install pybind11
$ brew install openblas
$ pip install cmake scikit-build torch
Installing and compiling¶
Once the dependencies are in place, the following command can be used for installing For compiling and installing the Python package, the following command can be used:
$ pip install -v aihwkit
This command will:
download the source tarball for the library.
invoke
scikit-build
which in turn will invoke
cmake
for the compilation.execute the commands in verbose mode, for helping troubleshooting issues.
If there are any issue with the dependencies or the compilation, the output of the command will help diagnosing the issue.
Note
Please note that the instruction on this page refer to installing as an end user. If you are planning to contribute to the project, an alternative setup and tips can be found at the Development setup section that is more tuned towards the needs of a development cycle.
- 1
The current (2.5.0) version of
pybind1
does not include the necessarycmake
helpers on itspip
release. It is recommended to either installpybind11
using your operative system package manager or compile and install it manually.- 2
This library uses PyTorch as both a build dependency and a runtime dependency. Please ensure that your torch installation includes
libtorch
and the development headers - they are included by default if installing torch frompip
.- 3
Please note that currently support for conda-based distributions is experimental, and further commands might be needed.