Installation Guide#
Introduction#
cuTAGI
is a high-performance C++/CUDA implementation of the TAGI (Tractable Approximate Gaussian Inference) method. Python users can utilize pytagi
, a Python wrapper around the cuTAGI
backend, for seamless integration within Python environments.
This guide covers detailed instructions on installing both pytagi
and cuTAGI
on various platforms.
Prerequisites for Local Installation#
Compiler: C++14 support
CMake: Version >= 3.23
CUDA Toolkit: Optional for GPU support
Python Version: Python >= 3.9 (Python 3.10 recommended)
Installing pytagi
#
pytagi
is the Python interface for the cuTAGI
backend.
Setting Up a Conda Environment#
Install Miniconda: Follow the official instructions.
Create a New Conda Environment:
conda create --name your_env_name python=3.10
Activate the Environment:
conda activate your_env_name
PyPI Installation#
Ensure Conda Environment is Activated.
Install Required Packages:
pip install -r requirements.txt
Install ``pytagi`` from PyPI:
pip install pytagi
Test the Installation:
python -m examples.classification
Note
You can develop your own applications using the provided examples (see
python_examples
).
Local Installation#
Clone the Repository:
git clone https://github.com/lhnguyen102/cuTAGI.git cd cuTAGI git submodule update --init --recursive
Note
The
git submodule
command clones the pybind11 repository, required for binding Python with C++/CUDA.Ensure Conda Environment is Activated.
conda activate your_env_name
Install Required Packages:
pip install -r requirements.txt
Install
pytagi
Locally:Remove cache
pip cache purge
Install package
pip install .
Test the Installation:
build/run_tests
Installing cuTAGI
#
cuTAGI
is the native C++/CUDA implementation. Using Docker is the recommended method for installation.
Docker Build#
Install Docker: Follow the official instructions.
Ensure CUDA Compatibility:
Ensure the host machine’s CUDA version is compatible with the Docker image’s CUDA version (>=12.2).
Install the NVIDIA Container Toolkit to enable Docker to use the NVIDIA GPU:
dpkg -l | grep nvidia-container-toolkit
Build the Docker Image:
CPU Build:
scripts/docker_build.sh
CUDA Build:
scripts/docker_build.sh device=cuda version=latest
Run Unit Tests:
For CPU:
scripts/docker_run.sh
For CUDA (GPU):
scripts/docker_run.sh device=cuda version=latest
Note
Ensure Docker is running during the build and run processes.
Ubuntu 22.04 Installation (Without Docker)#
Install CUDA Toolkit:
Download and install the CUDA Toolkit (version >= 12.2).
Add the following to your
~/.bashrc
file to update your PATH:export PATH="/usr/local/cuda-12.2/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH"
Install GCC Compiler:
sudo apt install g++
Install CMake:
Follow the official instructions to install CMake.
Build the Project:
Navigate to the
cuTAGI
folder and run:scripts/compile.sh [option]
Replace
[option]
with one of the following:Release
: For optimized release build (Default)ReleaseWithInfo
: For release build with debug informationDebug
: For debug build using GDB Debugger
macOS (CPU Version)#
cuTAGI
supports CPU-only builds on macOS.
Install Xcode.
Install CMake:
Refer to the Installation Guide: CMake on macOS section below.
Build the Project:
Navigate to the
cuTAGI
folder and run:scripts/compile.sh [option]
Running Unit Tests#
For C++:
build/run_tests
For Python:
python -m test.py_unit.main
Installation Guide: CMake on macOS#
Step 1: Uninstall Previous CMake Versions (Optional)#
sudo find /usr/local/bin -type l -lname '/Applications/CMake.app/*' -delete
sudo rm -rf /Applications/CMake.app
Step 2: Install CMake#
Download the installer:
mkdir ~/Downloads/CMake curl --silent --location --retry 3 "https://github.com/Kitware/CMake/releases/download/v3.30.5/cmake-3.30.5-macos-universal.dmg" --output ~/Downloads/CMake/cmake-macos.dmg
Mount the image:
yes | PAGER=cat hdiutil attach -quiet -mountpoint /Volumes/cmake-macos ~/Downloads/CMake/cmake-macos.dmg
Copy CMake app to Applications:
cp -R /Volumes/cmake-macos/CMake.app /Applications/
Unmount the image:
hdiutil detach /Volumes/cmake-macos
Add CMake to the PATH:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install=/usr/local/bin
Verify the installation:
cmake --version
Clean up:
rm -rf ~/Downloads/CMake