Getting Started

Run your first Sanguis program

Prerequisites

Windows 10 or later. An NVIDIA CUDA-capable GPU is required. The runtime executes programs directly on CUDA cores. You also need the CUDA Toolkit (nvcc compiler) and MSVC (cl.exe) to compile the blood bridge for your GPU. Both are free from NVIDIA and Microsoft.

Installation

Extract the SDK archive to any folder on your system. The folder structure looks like this:

sanguis-sdk/
  bin/
    sanguis_run.bat              one-command pipeline
    build.bat                    compiles the blood bridge for your GPU
    vana_connectome_transposer.exe   .sang to .vana compiler
    v5_blood_bridge.cu           CUDA runtime source
    v5_blood_bridge.exe          compiled bridge (after running build.bat)
  examples/
    hello.sang                   hello world
    add.sang                     arithmetic
    ...                          more examples
  benchmark/
    build.bat                    compiles the benchmark tool
    benchmark.bat                runs CPU vs GPU comparison
    vana_bench.cu                benchmark source

Open a command prompt, navigate to the bin folder, and run build.bat once. This compiles the blood bridge for your specific GPU. After that, sanguis_run.bat will auto-build it if the exe is missing.

Why source? The blood bridge runs CUDA kernels directly on your GPU. Compiling from source with -arch=native ensures the binary targets your exact GPU architecture. A pre-compiled binary from one GPU generation may not run on another.

Optional: add to PATH. If you want to run sanguis_run.bat from any directory, add the bin folder to your system PATH. Otherwise just cd into the bin folder each time.

One Command

The SDK provides a single entry point. Write .sang, run one command, get output:

sanguis_run.bat program.sang [ticks]

Both stages run invisibly: compilation and GPU execution. You never see the intermediate files or the runtime layer.

Hello World

Create hello.sang:

circuit Hello {
  hold state : memory scalar = 0.0

  when speak {
    but state = 0.0
    emit "Hello, VANA!" to screen
    emit "\n" to screen
    emit 1.0 to state
  }
}

Run it:

sanguis_run.bat hello.sang

Output:

Hello, VANA!

The speak route fires on tick 0 (when state is still 0.0), prints the message, sets state to 1.0, and never fires again because the condition state = 0.0 no longer holds.

Arithmetic

circuit Add {
  hold a : memory scalar = 0.0
  hold b : memory scalar = 0.0
  hold c : memory scalar = 0.0
  hold state : memory scalar = 0.0

  when start {
    but state = 0.0
    emit 1.0 to a
    emit 2.0 to b
    emit a + b to c
    emit "1+2=" to screen
    emit c to screen
    emit "\n" to screen
    emit 1.0 to state
  }
}

Output:

1+2=3.0000

Four operators. +, -, *, /. Division by zero returns 0.0. Evaluated left to right. Operands can be numbers, hold names, or builtin results.