Quick Start

Get up and running with Parallax in 5 minutes

Prerequisites

  • CMake 3.20 or higher
  • C++20 compiler (GCC 11+, Clang 14+, MSVC 2022+)
  • Vulkan SDK 1.2 or higher

Installation

1. Install Vulkan SDK

terminal
# Ubuntu/Debian
sudo apt install vulkan-sdk

# macOS
brew install molten-vk vulkan-loader

# Windows
# Download from https://vulkan.lunarg.com/

2. Clone and Build

terminal
git clone https://github.com/parallax-compiler/parallax-runtime.git
cd parallax-runtime
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install

Your First Program

Create a file called hello_parallax.cpp:

C++ hello_parallax.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <execution>

int main() {
    std::vector<float> data(1'000'000);
    
    // Initialize
    for (size_t i = 0; i < data.size(); i++) {
        data[i] = static_cast<float>(i);
    }
    
    // GPU acceleration with std::execution::par
    // Parallax automatically handles memory coherence
    std::for_each(std::execution::par,
                  data.begin(), data.end(),
                  [](float& x) { x *= 2.0f; });
    
    // Use results immediately - coherence is automatic!
    std::cout << "First element: " << data[0] << std::endl;
    std::cout << "Last element: " << data.back() << std::endl;
    
    return 0;
}

Compile and Run

terminal
g++ -std=c++20 hello_parallax.cpp -lparallax-runtime -o hello
./hello
✓ Success! You've just run your first Parallax application.

Next Steps