Skip to content

About

Deterministic, computing and raytracing engine for General Relativity, Post-Newtonian celestial mechanics, relativistic hydrodynamics, and polarized radiative transfer across curved spacetimes.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Relativity-Simulator

Deterministic simulation and ray-tracing engine for General Relativity, Post-Newtonian dynamics, relativistic hydrodynamics, and polarized radiative transfer in curved spacetimes.


Documentation Map

Primary references:


Key Features


Visual Overview

The visual renders and trajectory sequences below were recorded and generated using the integrated Capture Studio workspace widget.

Curved Spacetime Null Geodesic Ray-Tracing (Schwarzschild Metric, M = 60.00)

Schwarzschild Metric Flyby Trajectory (M = 60.00) Schwarzschild Metric Infall Trajectory (M = 60.00)


Building and Installation

Toolchain & Platform Requirements

  • ISO C++23 compliant compiler:
    • GCC 13 or newer (Linux x86_64, aarch64, Windows MinGW-w64)
    • Clang 16 or newer / Homebrew LLVM (Linux, FreeBSD, macOS Intel & Apple Silicon)
    • Apple Clang 15+ (Xcode 15+ on macOS 14 Sonoma / Xcode 16+ on macOS 15 Sequoia)
    • MSVC 2022 v19.36+ (Windows 11 x64)
    • MinGW-w64 GCC 13+ (Windows 11 portable static builds)
  • CMake 3.25 or newer
  • Ninja or Make build system
  • Vulkan headers & loader (1.2+):
    • Linux: libvulkan-dev (Debian/Ubuntu) or vulkan-loader-devel (Fedora/RHEL)
    • macOS: MoltenVK runtime (brew install molten-vk vulkan-headers vulkan-loader or LunarG Vulkan SDK)
    • Windows: LunarG Vulkan SDK
  • glslangValidator (recommended for compiling compute shaders to SPIR-V bytecode):
    • Linux: glslang-tools / glslang
    • macOS: brew install glslang
    • Windows: included in LunarG Vulkan SDK
  • OpenGL and GLFW (automatically fetched and built via CMake FetchContent)
  • ENet and LZ4 (automatically fetched and built via CMake FetchContent when ENGINE_ENABLE_DISTRIBUTED=ON, enabled by default)
  • ffmpeg (optional run-time dependency for automated video assembly in Capture Studio)

CMake Configuration Options

CMake Option Type Default Description
CMAKE_BUILD_TYPE String Release Build profile: Release, Debug, RelWithDebInfo, MinSizeRel.
ENABLE_LTO Boolean OFF Interprocedural / Link-Time Optimization (-flto=auto on GCC, /GL on MSVC).
ENABLE_PGO_GENERATE Boolean OFF Instrument binary for Profile-Guided Optimization generation.
ENABLE_PGO_USE Boolean OFF Utilize recorded profiling data to produce optimized binary.
ENGINE_ENABLE_DISTRIBUTED Boolean ON Compile distributed computing subsystem, network codecs, and cluster worker.
ENGINE_PORTABLE_EXE Boolean OFF Produce standalone portable executable with static runtime on Windows MinGW.
ENGINE_UNIVERSAL_MACOS Boolean OFF Build macOS Universal 2 binary supporting both arm64 and x86_64.
ENGINE_NATIVE_OPTIMIZATION Boolean OFF Tune CPU instructions for the host compilation architecture (-march=native).
CMAKE_OSX_DEPLOYMENT_TARGET String 11.0/10.15 Minimum target macOS deployment version.

Windows 11 (MSVC 2022 & MinGW-w64)

Prerequisites

Install Visual Studio 2022 Community/Professional with the "Desktop development with C++" workload, CMake 3.25+, and the Vulkan SDK from LunarG.

Development Build (MSVC 2022)

cmake -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS

Release Build (MinGW-w64 Portable Static Binary)

cmake -S . -B build-release -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=ON -DENGINE_PORTABLE_EXE=ON
cmake --build build-release --target RelativisticEngine -j $env:NUMBER_OF_PROCESSORS

macOS (Apple Silicon & Intel)

Compatibility Matrix

Hardware Architecture Minimum OS Supported Compilers Vulkan Driver Implementation
Apple Silicon (M1 / M2 / M3 / M4) macOS 14.0 (Sonoma) / 15.0 (Sequoia) Apple Clang (Xcode 15+) or Homebrew LLVM (clang++ 16+) MoltenVK (libMoltenVK.dylib) via Metal
Apple Silicon (M1 / M2 / M3 / M4) macOS 11.0 (Big Sur) / 12.0 (Monterey) / 13.0 (Ventura) Homebrew LLVM (clang++ 16+) MoltenVK (libMoltenVK.dylib) via Metal
Intel x86_64 macOS 14.0 (Sonoma) / 15.0 (Sequoia) Apple Clang (Xcode 15+) or Homebrew LLVM (clang++ 16+) MoltenVK (libMoltenVK.dylib) via Metal
Intel x86_64 macOS 11.0 (Big Sur) / 12.0 (Monterey) / 13.0 (Ventura) Homebrew LLVM (clang++ 16+) MoltenVK (libMoltenVK.dylib) via Metal
Intel x86_64 (macOS Catalina 10.15.7) macOS 10.15.7 Homebrew LLVM (clang++ 16+) MoltenVK (libMoltenVK.dylib) via Metal

Apple Silicon Setup & Build (macOS 14+ Sonoma / macOS 15+ Sequoia)

xcode-select --install
brew install cmake ninja vulkan-headers vulkan-loader molten-vk glslang

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON

cmake --build build -j $(sysctl -n hw.ncpu)

Apple Silicon & Intel Setup with Homebrew LLVM (macOS 11 through 15)

export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER="/opt/homebrew/opt/llvm/bin/clang" \
  -DCMAKE_CXX_COMPILER="/opt/homebrew/opt/llvm/bin/clang++" \
  -DENABLE_LTO=ON

cmake --build build -j $(sysctl -n hw.ncpu)

macOS Catalina 10.15.7 (Legacy Intel x86_64)

xcode-select --install
brew install llvm cmake ninja vulkan-headers vulkan-loader molten-vk glslang
export PATH="/usr/local/opt/llvm/bin:$PATH"

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" \
  -DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" \
  -DENABLE_LTO=OFF \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15

cmake --build build -j $(sysctl -n hw.ncpu)

macOS Universal 2 Binary (arm64 + x86_64)

cmake -B build-universal -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENGINE_UNIVERSAL_MACOS=ON \
  -DENABLE_LTO=OFF \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15

cmake --build build-universal -j $(sysctl -n hw.ncpu)

Linux Distributions

Ubuntu 24.04 LTS & Debian 12

sudo apt update
sudo apt install -y build-essential cmake ninja-build g++-13 gcc-13 \
  libvulkan-dev vulkan-tools glslang-tools libgl1-mesa-dev \
  libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=gcc-13 \
  -DCMAKE_CXX_COMPILER=g++-13 \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Ubuntu 22.04 LTS

sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y build-essential cmake ninja-build g++-13 gcc-13 \
  libvulkan-dev vulkan-tools glslang-tools libgl1-mesa-dev \
  libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=gcc-13 \
  -DCMAKE_CXX_COMPILER=g++-13 \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Ubuntu 20.04 LTS

sudo apt update
sudo apt install -y software-properties-common wget gpg
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y build-essential cmake ninja-build g++-13 gcc-13 \
  libvulkan-dev vulkan-tools glslang-tools libgl1-mesa-dev \
  libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=gcc-13 \
  -DCMAKE_CXX_COMPILER=g++-13 \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Fedora 39 / 40 / 41

sudo dnf install -y gcc gcc-c++ cmake ninja-build \
  vulkan-loader-devel vulkan-tools glslang mesa-libGL-devel \
  libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel libXext-devel

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

RHEL 8 / 9, Rocky Linux & AlmaLinux

sudo dnf --enablerepo=crb install -y gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ cmake ninja-build \
  vulkan-loader-devel mesa-libGL-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
source /opt/rh/gcc-toolset-13/enable

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Arch Linux & Manjaro

sudo pacman -Syu --needed base-devel cmake ninja gcc vulkan-devel vulkan-tools glslang \
  mesa libx11 libxrandr libxinerama libxcursor libxi libxext

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

openSUSE (Tumbleweed & Leap)

sudo zypper install -y gcc13 gcc13-c++ cmake ninja \
  vulkan-loader-devel vulkan-tools glslang Mesa-libGL-devel \
  libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel libXext-devel

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=gcc-13 \
  -DCMAKE_CXX_COMPILER=g++-13 \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Alpine Linux (v3.19+ / Edge)

apk add build-base cmake ninja g++ gcc vulkan-loader-dev glslang mesa-dev \
  libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev linux-headers

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Linux ARM64 / AArch64 (Raspberry Pi 5, Ampere, AWS Graviton)

sudo apt update
sudo apt install -y build-essential cmake ninja-build g++-13 gcc-13 \
  libvulkan-dev vulkan-tools glslang-tools libgl1-mesa-dev \
  libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=gcc-13 \
  -DCMAKE_CXX_COMPILER=g++-13 \
  -DENABLE_LTO=ON

cmake --build build -j $(nproc)

Headless Server & Slurm HPC Compute Nodes

cmake -B build-server -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DENABLE_LTO=ON \
  -DENGINE_ENABLE_DISTRIBUTED=ON

cmake --build build-server --target headless_exporter cluster_worker -j $(nproc)

FreeBSD 13 / 14

pkg install -y llvm17 cmake ninja vulkan-loader vulkan-headers glslang libglvnd glfw lz4 enet

cmake -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=clang17 \
  -DCMAKE_CXX_COMPILER=clang++17 \
  -DENABLE_LTO=ON

cmake --build build -j $(sysctl -n hw.ncpu)

Verification & Analytical Validation

1. CTest Test Suite

ctest --test-dir build --output-on-failure -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)

2. Golden Master Analytical Benchmarks

./build/headless_exporter --validate-benchmarks

3. Headless Verification Loop

./build/RelativisticEngine --headless

4. Cluster Worker Operational Probe

./build/cluster_worker --auth-token "a8f5c2d3e9b14708215649fbcde71024385960abcedf1234567890abcdef1234" --backend auto

Profile-Guided Optimization (PGO) Workflow

Step 1: Generate Instrument Profile Binary

cmake -B build-pgo -DCMAKE_BUILD_TYPE=Release -DENABLE_PGO_GENERATE=ON
cmake --build build-pgo --config Release -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
./build-pgo/headless_exporter --validate-benchmarks

Step 2: Compile Final Optimized Binary

cmake -B build-opt -DCMAKE_BUILD_TYPE=Release -DENABLE_PGO_USE=ON
cmake --build build-opt --config Release -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)

Installation & Packaging (CPack)

cd build
cpack -G TGZ
cpack -G DEB   # Linux Debian/Ubuntu
cpack -G RPM   # Linux Fedora/RHEL/openSUSE
cpack -G NSIS  # Windows Nullsoft Installer
cpack -G DragNDrop # macOS DMG

Quickstart

Interactive Workspace & REPL Mode

./build/RelativisticEngine

Available interactive commands (warp, step, set mass, status, etc.) are documented in the Interactive Terminal Commands (REPL) and navigation keybindings in Navigation & Viewport Keybindings.

Headless Batch Execution

./build/headless_exporter --validate-benchmarks
./build/headless_exporter --scenario scenarios/kerr_accretion_disk.yaml --output-dir ./output --width 3840 --height 2160

Command-line options are documented in Headless Batch Exporter, declarative scenario definitions in Declarative Scenario Definition, and validation targets in Verification Criteria & Benchmark Protocols.

Cluster Worker Daemon Execution

# Start an autonomous worker listening on LAN (auto-discovered by running masters)
./build/cluster_worker --auth-token "a8f5c2d3e9b14708215649fbcde71024385960abcedf1234567890abcdef1234" --backend auto

# Start an outbound worker targeting a remote master host (cloud instance / Colab)
./build/cluster_worker --master-address 198.51.100.24:42425 --auth-token "a8f5c2d3e9b14708215649fbcde71024385960abcedf1234567890abcdef1234" --no-listen --no-discovery

Worker options, Slurm HPC submission scripts, and configuration schemas are documented in Cluster Compute Worker and Cluster Configuration File.


Third-Party Assets and Image Licenses

Sky and panorama assets:

Earth and planetary assets:


License

This project is licensed under the MIT License. See LICENSE for details.

About

Deterministic, computing and raytracing engine for General Relativity, Post-Newtonian celestial mechanics, relativistic hydrodynamics, and polarized radiative transfer across curved spacetimes.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages