PureCPP is a powerful C++ backend architecture for RAG systems.
Designed for maximum performance and scalability, it integrates vector search, ONNX models, and CPU/CUDA acceleration into a seamless, Python-integrated framework.
This repository provides detailed guidance on how to set up the environment, configure dependencies and build.
Explore all of Bruno Bavaresco Zaffari’s contributions (explained)🔍
git clone --recursive https://github.com/bbzaffari/purecpp_sp
cd purecpp_spWarning
If you forgot to use --recursive when cloning the repository, make sure to run:
git submodule update --init --recursive- 1. Build a Docker image from the current directory and tag it as 'purecpp_env'
docker build -t purecpp_env .- 2. Start a Docker container named 'env' from the 'purecpp_env' image, mounting current dir to /home
docker run -it --name env -v "$PWD":/home purecpp_env- 3. Run the
env_config.sh
chmod +x installers/*.sh
./installers/env_config.shThis script automates the setup. Installing Python essentials, LibTorch, FAISS, and configuring Conan profile.
Caution
Once you've created the container using docker run, you don't need to recreate it again.
Instead, follow these two simple commands to reuse the container:
docker start envThis command starts an existing container that has already been created earlier using docker run.
docker exec -it env bashThis command attaches a terminal to the running container, allowing you to interact with it just like you would with a regular Linux shell.
Requirements
- GCC/G++ >= 13.1
- CMake >= 3.22
- Python >= 3.8
- Ubuntu/Debian
sudo apt update && \
sudo apt upgrade -y && \
sudo apt install -y \
build-essential wget curl \
ninja-build cmake libopenblas-dev \
libgflags-dev python3-dev libprotobuf-dev \
protobuf-compiler unzip libssl-dev zlib1g-dev- Red Hat
yum update &&
yum install -y \
gcc gcc-c++ make git curl wget \
ninja-build libffi-devel openssl-devel \
protobuf-devel gflags-devel zlib-devel \
openblas-devel unzip \curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yRun rustup installer non-interactively (-y).
source ~/.cargo/envThis places cargo and rustc in /root/.cargo & activate Rust Environment
In case you do not have a Docker environment available, we strongly recommend that you use a Python venv (virtual environment) to ensure proper isolation of dependencies and reproducibility of results.
-
Create the virtual environment (replace 'venv' with your preferred name)
python3 -m venv venv
-
Activate the virtual environment on Linux or macOS
source venv/bin/activate
This practice minimizes conflicts between global packages and project-specific requirements.
Then run env_config.sh script
chmod +x installers/*.sh
./installers/env_config.shThis script automates the setup. Installing Python essentials, LibTorch, FAISS, and configuring Conan profile.
The build.sh is a development version pipeline, that makes it easier to compile and test all five modules.
Ensure the scripts have the execution permission
chmod +x ./CMAKE/sub_mod_build.sh
chmod +x ./build.sh./build.sh all./build.sh MODULE-NUMBERThis, by calling the sub_mod_build.sh, delegates the build to the selected CMAKE_MODULE, and then it:
- Cleans the build/ folder
- Installs Conan dependencies, if missing
- Compiles the code
- Sends the purecpp_*.so output to the central
Sandbox/
Note
First build: ~600s (installs dependencies).
Next builds: ~30s.
The shared object will be placed inside the Sandbox/
Sandbox/
├── Resources/
├── purecpp_*.so
└── YOUR-TEST.py
To test the Python bindings:
import purecpp_MODULENote: Please disregard the commit history in this repository. This repository is my development scratchpad, where all structural changes are designed and documented before being pushed to the official ecosystem.