HdBitset™ - a hyperdimensional wrapper for the C++ std::bitset

The HdBitset Logo

HdBitset™ is a Hyperdimensional Bitset wrapper for the C++ std::bitset with parallel processing in mind.

HdBitset™ is a single-thread hyperdimensional wrapper for the C++ bitset with parallel computing (OpenMP & OpenMPI) in mind. The project is in alpha and is subject to change without notice.

Our internal brief suggests that OpenMp should take care of threads, and OpenMPI should manage the nodes of the cluster. We are always assuming an inhomogeneous cluster such as Protogonus.

Smart pointers should be thread-safe. Beyond this we are simply avoiding calls to the same object from multiple threads (not to mention multiple nodes).

For performance and reliability reasons we are utilising as much of the existing, time-proved and robust C++ implementations as possible, hence the design choice of providing just a simple wrapper. Nevertheless, building on the internal storage structure of the underlying std::bitset could lead to higher performance at the detriment of portability and perhaps code readability.

The 19337 Mersenne Twister random number engine is constructed and randomized for each node independently (also using the thread and node IDs available from OpenMP and MPI) and is injected to the hdbitset codes of the specific thread & node. This is done so as to not end up with the same sequence of numbers generated on two threads as a result of incorrect seeding, and to avoid any issues related to thread-safety or lack thereof.

This layout is the reason we call the wrapper single-threaded with parallel computing in mind.

For an overview of HDC, please check out the arXiv article titled Classification using Hyperdimensional Computing: A Review and Stanford's YouTube video titled Computing with High-Dimensional Vectors.


Github, installation, and more information

You can obtain the files from the HdBitset™ GitHub repo and place them in the appropriate projects of your solution.

#include "hd.h"

The files and our github wiki section contain comments that are hopefully sufficiently detailed to let you start your work with HdBitset.

Catch2 is used for unit tests.

The logo is based on Dynamic Wang's work.


License

Copyright (c) 2020 FINAL Neural Architecture Laboratories

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software" ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.