-
Notifications
You must be signed in to change notification settings - Fork 0
installation
This library supports both x86_64/amd64 and arm64/aarch64. Check if your system is supported out of the box in the table below. The library requires very few dependencies, so as long as your machine supports a C++ compiler and python, you should be able to get it working by fiddling with the CMake and setuptools files.
| OS + Arch | Python | Latest Release Directly Tested |
|---|---|---|
| Ubuntu 24.04 AMD64 | Python 3.9+ | |
| Ubuntu 22.04 AMD64 | Python 3.9+ | |
| Ubuntu 20.04 AMD64 | Python 3.9+ | |
| Ubuntu 24.04 ARM64 | TBD | |
| Ubuntu 22.04 ARM64 | TBD | |
| Ubuntu 20.04 ARM64 | TBD | |
| ArchLinux 6.6.68 LTS | Python 3.9+ | |
| MacOS 15 ARM64 | Python 3.9+ | |
| MacOS 14 ARM64 | Python 3.9+ | v0.0.16 |
| MacOS 13 ARM64 | Python 3.9+ | |
| MacOS 12 ARM64 | Python 3.9+ | |
| MacOS 11 ARM64 | Python 3.9+ | |
| Windows 11 | Python 3.9+ | v0.0.17 |
| Windows 10 | Python 3.9+ | |
| Debian 13 | Python 3.9+ | |
| Debian 12 | Python 3.9+ | |
| LinuxMint 22 | Python 3.9+ | |
| LinuxMint 21 | Python 3.9+ |
Your machine will need system dependencies such as CMake, a C++ compiler, and pybind11. The library uses C++17. Preferably you will have git and conda installed already. For more specific instructions on installing these on your system, refer to the more detailed installation guide.
Git clone the repo, then pip install, which will run setup.py.
git clone git@github.com:mbahng/pyember.git
cd pyember
pip install .
This runs cmake on aten/CMakeLists.txt, which calls the following.
- It always calls
aten/src/CMakeLists.txtthat compiles and links the source files in the C++ tensor library. - If
BUILD_PYTHON_BINDINGS=ON(always on by default), it further callsaten/bindings/CMakeLists.txtto further generate a.sofile that can be imported intoember. - If
BUILD_DEV=ON, it callsaten/test/CMakeLists.txtto further compile the C++ unit testing suite.
If there are problems with building, you should check, in order,
- Whether
build/has been created. This is the first step insetup.py - Whether the compiled
main.cppand, ifBUILD_DEV=ON, the C++ unit test files have been compiled, i.e. ifbuild/src/mainandbuild/test/testsexecutables exist. - Whether
build/*/aten.cpython-3**-darwin.soexists (somewhere in the build directory, depending on the machine). The Makefile generated byaten/bindings/CMakeLists.txtwill producebuild/*/aten.cpython-3**-darwin.so. - The
setup()function will immediately copy this.sofile toember/aten.cpython-3**-darwin.so. You should see a success message saying that it has been moved or an error. The.sofile must live withinember, the actual library, sinceember/__init__.pymust access it within the same directory level.
The pip install comes with two more environment variable parameters. Note that the following command is whitespace-sensitive.
CMAKE_DEBUG=1 CMAKE_DEV=1 pip install .
- Setting
CMAKE_DEBUG=1compiles theatenlibrary with debug mode (-g) on, which I use when using gdb/lldb on the compiled code. - Setting
CMAKE_DEV=1compiles the C++ testing suite as well. If you want to do this, you will also need to install google-tests. A code snippet for Ubuntu and Debian is shown below.
sudo apt-get install libgtest-dev
cd /usr/src/gtest
cmake CMakeLists.txt
make
cp lib/*.a /usr/lib
rm -rf /var/lib/apt/lists/*
If you would like to run tests and/or develop the package yourself, you can run the script ./run_tests.sh all (args python to run just python tests and cpp to run just C++ tests), which will
- Run all C++ unit tests for
aten, ensuring that all functions work correctly. - Run all Python unit tests for
ember, ensuring that additional functions work correctly and that the C++ functions are bound correctly.
The stub (.pyi) files for aten are located in ember/aten.
hi