Supported Backends

Sarek is designed to be backend-agnostic. You write your kernel once in OCaml, and Sarek compiles it to the appropriate shading language (CUDA C, OpenCL C, GLSL, MSL) or executes it natively on the CPU.

Backend Target Status Requirements
CUDA NVIDIA GPUs Stable NVIDIA Driver + CUDA Toolkit
OpenCL Multi-vendor (AMD, Intel, NVIDIA) Stable OpenCL Runtime / ICD
Vulkan Cross-platform (Linux, Windows, Android) Stable Vulkan SDK + glslangValidator
Metal Apple Silicon & Intel Macs Stable macOS 10.13+
Native CPU (Multicore) Stable OCaml 5.4.0+
Interpreter CPU (Debug) Stable None

CUDA Backend (sarek-cuda)

Targets NVIDIA GPUs using the CUDA Driver API and NVRTC (Runtime Compilation).

opam install sarek-cuda

OpenCL Backend (sarek-opencl)

Targets a wide range of devices including AMD GPUs, Intel integrated graphics, and FPGAs.

opam install sarek-opencl

Vulkan Backend (sarek-vulkan)

Uses GLSL compute shaders and SPIR-V for modern cross-platform GPU support.

opam install sarek-vulkan

Metal Backend (sarek-metal)

Native support for Apple hardware (M1/M2/M3 chips) using Metal Shading Language (MSL).

opam install sarek-metal

Native CPU Backend (sarek.native)

Executes kernels directly on the host CPU without GPU compilation.

Interpreter Backend (sarek.interpreter)

Walks through the Sarek IR (Intermediate Representation) step-by-step.