Skip to main content

A fast math and neural network library for Python and C++

Project description

Build Status Documentation Status PyPI version fury.io PyPI license PyPI pyversions Downloads per month Discord

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

librapid-0.2.8.tar.gz (1.2 MB view hashes)

Uploaded Source

Built Distributions

librapid-0.2.8-cp39-cp39-win_amd64.whl (7.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

librapid-0.2.8-cp39-cp39-manylinux2014_x86_64.whl (515.0 kB view hashes)

Uploaded CPython 3.9

librapid-0.2.8-cp38-cp38-win_amd64.whl (7.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

librapid-0.2.8-cp38-cp38-manylinux2014_x86_64.whl (509.9 kB view hashes)

Uploaded CPython 3.8

librapid-0.2.8-cp37-cp37m-win_amd64.whl (7.1 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

librapid-0.2.8-cp37-cp37m-manylinux2014_x86_64.whl (520.0 kB view hashes)

Uploaded CPython 3.7m

librapid-0.2.8-cp36-cp36m-win_amd64.whl (7.1 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

librapid-0.2.8-cp36-cp36m-manylinux2014_x86_64.whl (520.1 kB view hashes)

Uploaded CPython 3.6m

Supported by

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