Skip to content

Tack User's Guide

Learn how to compute on scientific datasets, build visualization pipelines, and write the kernels that extend them. Tack's mesh algorithms and your own kernels run on CPU, Metal, CUDA, HIP and Level Zero, within each backend's capabilities.

tack-core provides the language, arrays and algorithms; tack-vis adds datasets and scientific visualization. The guide describes the current checkout. See Getting Started for installation and the relationship to released APIs.

Start with kernels

  1. Run one kernel. Getting Started takes you from installation to a checked result on the CPU. Then choose your GPU backend.
  2. Understand a program. From Python to a Tack program explains which code runs in Python, which code is compiled, and how to order calculation stages.
  3. Build a simulation. Heat diffusion combines arrays, a stencil, buffer swapping and an independent NumPy check in one complete script.

You can follow this path before reading the language chapters in detail. Keep the quick reference nearby as you write your own program.

Find the task you have

I want to… Start with
Turn a NumPy expression into a kernel One operation per element
Allocate arrays and exchange data with NumPy Arrays and Types
Store positions, colours or local matrices Vectors and Matrices
Update a grid over many timesteps Heat diffusion and stable stencil inputs
Combine contributions from many particles Gather and scatter, then MPM
Filter items into a variable-size output Count, scan, write
Organize several kernels around shared state Templates and trail-following agents
Understand a discontinuous solution or a face flux Fields and Spaces
Sample a mesh at measurement locations Probing
Share memory with another library Sharing arrays
Investigate wrong results or slow calls Debugging and Timing

If you already write GPU kernels, read Kernels, Memory and Parallel Correctness, and Backend capabilities. The N-body tutorial shows workgroup cooperation with a portable CPU path.

Language and program structure

Chapter What it explains
Getting Started Install and run the first kernel
From Python to a Tack program Host/device boundary, stages and compilation
Arrays and Types Storage, NumPy exchange, scalar types and precision
Vectors and matrices Component values, masks, products and arrays
Kernels Parallel ranges, constants, returns and specialization
Control Flow and Math Conditions, sequential loops, casts and numerical helpers
Device Functions Reusable compiled helpers
Templates Device-class objects and generic kernels
Memory and parallel correctness Layout, buffers, aliases, gathering and scattering

Kernel algorithms

Chapter What it explains
Reductions and Scans Statistics, output offsets, sorting and block reductions
Advanced Features Private arrays, random state, atomics, shared memory and textures

Datasets and visualization

Meshes, point clouds, fields and the filters over them (tack.dataset, the tack-vis package) have their own guide: the Visualization Guide. You can use its algorithms before writing a kernel; read the kernel chapters here when you want to initialize data on the device, write a custom operation, or connect a simulation's working arrays to a dataset.

Run and diagnose

Chapter What it explains
Backends Setup, capabilities, queued launches and device differences
Sharing arrays NumPy copies, external pointers, DLPack and VTK
Debugging and timing Independent checks, bounds checks, numerical tolerance and warm measurements
The Kernel Cache Compiled kernels kept on disk, settings and MPI jobs

Worked examples

The tutorial gallery includes six complete programs: heat diffusion, coloured dye, trail-following agents, marching squares, MPM and tiled N-body forces. Each page explains its data and kernels, includes the complete script, shows output generated from that script, and credits its origin. All sources are included in this documentation.

Use the Contracts when you need precise guarantees, and the Design and Implementation pages when you need to understand compilation or runtime internals.