A fast math and neural network library for Python and C++
Project description
Credits
Thanks to @TheWindoof for his help on the library
How it Works
LibRapid is a highly-optimized C++ (and CUDA) library which can be found at ./src/librapid
. The C++ library is interfaced with Python using PyBind11, meaning very little performance is lost between the C++ backend and Python frontend of the library.
LibRapid also aims to provide a consistent interface between the C++ and Python libraries, allowing you to use the library comprehensively in both languages without having to trawl through two sets of documentation.
Please note that the Python interface has been adjusted slightly from the C++ interface to provide a more "pythonic" feel without reducing the overall functionality.
Installing LibRapid
Python
To install LibRapid as a Python library, simply run pip install librapid
in the command line. Hopefully, there will be precompiled wheels available for your operating system and python version, meaning you will not need a C++ compiler to install it (if this is not the case, a modern C++ compiler will be required)
Building from Source
To enable CUDA support, to use your own BLAS library or to get a (potentially) more optimised install of the library, you will have to build LibRapid from source:
git clone https://github.com/LibRapid/librapid.git --recursive
cd librapid
pip install . -vvv
C++
To use the library for C++ use, a modern C++ compiler will definitely be required. You will need to add all sources to your project and include the main header file librapid/librapid.hpp
.
This method is very tedious. In the future, CMake support will be added to enable easier building and linking
Documentation
Viewing Online
Documentation can be found online here: https://librapid.readthedocs.io/en/latest/
Building from Source
If you would like to build it yourself, you will need to instal the required software, which can be found below:
pip install sphinx
pip install breathe
pip install exhale
pip install furo
You will also need to install a recent version of Doxygen, which you can find here
To build the documentation, open a command line window in the docs
directory and run make html
. You can then open the file docs/build/html/index.html
in a web-browser to view the documentation.
Performance
LibRapid has highly optimized functions and routines, meaning your code will be faster as a result. Many of the functions can match or even exceed the performance of NumPy
Both the C++ and Python libraries are designed to work with any CBLAS compatible library, such as ATLAS or OpenBLAS, though will be fully functional without one, using built-in, but slower, routines.
To use BLAS in C++, simply allow LibRapid to find the cblas.h
file by adding its directory to the additional include paths, and link the required library, such as libopenblas.lib
on Windows. Finally, before you #include<librapid/librapid.hpp>
, you'll have to #define LIBRAPID_CBLAS
to let LibRapid know it should use the provided BLAS library.
For the Python API to LibRapid, things are much simpler. If you install the library via pip
, it should come precompiled with OpenBLAS, so you don't have to do anything yourself.
If you build LibRapid from source, it will automatically search some specific directories for a BLAS install, though if one is not found, BLAS will not be linked and internal routines will be used instead. Please note that the BLAS install must have the following file structure:
blas-dir
├── include
| └── cblas.h
├── lib
| └── your-blas-lib.lib
└── bin (Only on Windows)
└── your-blass-dll.dll
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for librapid-0.2.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3212c0a7887a5ebcb07cf17a8e098ef2a6d16cd7c01c29e25108e461677e3310 |
|
MD5 | f8d958ff16a79f4f261768fe6d22f379 |
|
BLAKE2b-256 | 0a797a5e902070d6f5b70a81bad46089b11572b89163cacc89ad188318f6d6af |
Hashes for librapid-0.2.9-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51444fa785289f4df5d3eecfdb3d39fa6c86fb0fdf5a59f69cf1a949f28fce76 |
|
MD5 | 5b5bb3b452a7a4c74a5e3f53d938a055 |
|
BLAKE2b-256 | 9d1bca2d3d9085db79622592d0daa2d3b204fc497ab5b16a4b422af720268cbc |
Hashes for librapid-0.2.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e306b9d79d29895ef9fa3a61f5cd3ecbea8566f503957080bf949b9f66104a8a |
|
MD5 | 86010eb0f4712fc3ae6ec117c3ee81c6 |
|
BLAKE2b-256 | 4558ce962f090355956df54b2a2c8a7faf03afb892f1323be59529c00ee31214 |
Hashes for librapid-0.2.9-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbcc0309abf7613c1146129309ccff58975bcc429f2b2605de55497f08e71695 |
|
MD5 | 8201a708867611c779ba187a81531f6d |
|
BLAKE2b-256 | 20ca831815cb06c423863284438f20a0a0d5e4aa8f435e583a0c75c764762794 |
Hashes for librapid-0.2.9-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dee6f5ef894be0a785454d7695f365f1815b727b277bab0b65a15989b5537d2 |
|
MD5 | 893c48e9b18457758d28b73bfb6d5d18 |
|
BLAKE2b-256 | 819bdda47b5139f37711f8e5195ca87123fe5b7e4e5476082930dc0cf1facedb |
Hashes for librapid-0.2.9-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98c094aa74494e51054414c7f4df44ce0d63c99835c1394a3b020061efe08370 |
|
MD5 | 5ce5f6cb5dd8008e92d836102a9a7106 |
|
BLAKE2b-256 | 0f55276439c6a41becc1823a1f9ca9a11fce9d5c7d9ad8f4184b7bedc4179111 |
Hashes for librapid-0.2.9-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddebb799b6d0446a66a31c8d97c407c134827a548fd27bfd2ea559960b21aac5 |
|
MD5 | 4f9cdc0bcc05b0bab766e616337c2b57 |
|
BLAKE2b-256 | cb545a00f7226127b6d444b4255dbeccb1f122903a40479803b3e2c929619d98 |
Hashes for librapid-0.2.9-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc080ff4b87a8cc28efe518b4ca2bf5580fb14c9bd88a31202de0297d4d3f00 |
|
MD5 | cd3dd5704a6cbc30717b8957d2678255 |
|
BLAKE2b-256 | 52a3641a9069fac3a2f8e3da4766a03c0bd8ed48b637996ef3b7459d3616340c |