Development Environment Setup¶
This guide will help you set up your development environment for building and running IPU applications.
Prerequisites¶
The IPU emulator and assembler require the following tools:
- Bazel - Build system (managed via Bazelisk)
- C/C++ Compiler - GCC or Clang for building the emulator
- Python 3.10+ - For the assembler and build tools
- uv - Fast Python package manager (optional but recommended)
- Git - Version control
Quick Start¶
Linux / macOS¶
- Install Bazelisk (manages Bazel versions automatically):
# Linux
wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazel
# macOS
brew install bazelisk
- Install build essentials:
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install build-essential gcc g++ git curl python3 python3-pip
# macOS (install Xcode Command Line Tools)
xcode-select --install
- Install uv (recommended for faster Python package management):
- Clone the repository:
Windows (WSL2)¶
For Windows users, we recommend using Windows Subsystem for Linux 2 (WSL2):
- Install WSL2 with Ubuntu:
- Follow the Linux instructions above inside your WSL2 Ubuntu environment.
Using Docker¶
For a consistent development environment, you can use Docker:
- Build the Docker image:
- Run the container:
- Build and test inside the container:
Using VS Code Dev Container¶
The repository includes a Dev Container configuration for VS Code:
-
Install VS Code and the Dev Containers extension
-
Open the repository in VS Code
-
Reopen in Container: Press
F1and select "Dev Containers: Reopen in Container" -
Wait for the container to build - VS Code will automatically set up the environment
The Dev Container includes all required tools pre-installed.
Verifying Your Setup¶
After installation, verify everything is working:
# Check Bazel version
bazel --version
# Check Python version
python3 --version
# Check GCC version
gcc --version
# Build the project
bazel build //...
# Run tests
bazel test //...
Expected output: - Bazel should be 7.0.0 or higher - Python should be 3.10 or higher - GCC should be 11.0 or higher - All builds and tests should pass
Dependencies¶
The project uses Bazel to automatically manage dependencies:
C/C++ Dependencies¶
- GoogleTest (1.15.2) - Testing framework
- cxxopts (3.0.0) - Command-line argument parsing
Python Dependencies¶
- Click (≥8.3.1) - CLI framework
- Lark (≥1.3.1) - Parser generator
- Jinja2 (≥3.1.4) - Template engine
- MkDocs (≥1.6.0) - Documentation generator (optional)
- MkDocs Material (≥9.5.0) - Documentation theme (optional)
All dependencies are automatically fetched and cached by Bazel on first build.
Building the Assembler¶
The IPU assembler (ipu-as) is built automatically when needed:
# Use through Bazel (recommended)
bazel run //src/tools/ipu-as-py:ipu-as -- --help
# Or build and install locally with uv
cd src/tools/ipu-as-py
uv pip install -e .
ipu-as --help
Common Issues¶
Bazel build fails with "external repository not found"¶
Solution: Clean the Bazel cache and rebuild:
Python version mismatch¶
Solution: Ensure Python 3.10+ is installed and set as default:
Permission denied when running Bazel¶
Solution: Ensure Bazelisk is executable:
WSL2 performance issues¶
Solution: Clone the repository inside WSL2 filesystem (not /mnt/c/):
# Good - inside WSL2 filesystem
cd ~
git clone https://github.com/rechefe/ipu-emulator.git
# Bad - on Windows filesystem (slow)
cd /mnt/c/Users/...
IDE Setup¶
VS Code¶
Recommended extensions: - C/C++ (Microsoft) - C/C++ IntelliSense - Bazel (BazelBuild) - Bazel support - Python (Microsoft) - Python language support - Pylance (Microsoft) - Python type checking
CLion¶
CLion supports Bazel projects natively. Open the repository and select "Import Bazel Project".
Next Steps¶
Now that your environment is set up:
- Build your first application
- Learn the Assembly Syntax
- Explore the Instruction Reference