GPU-accelerated analytical operators for DuckDB on NVIDIA CUDA and Apple Silicon Metal. First SQL execution engine that targets Apple Silicon GPUs.
Installing and Loading
INSTALL gpudb FROM community;
LOAD gpudb;
Example
LOAD gpudb;
-- Drop-in streaming aggregates (BIGINT and DOUBLE overloads)
SELECT gpu_sum(value::BIGINT) FROM range(1000000) AS t(value);
-- v0.4.0: resident columns — upload once, then reductions run on the GPU
-- with zero per-query transfer
SELECT gpu_upload('v', value::BIGINT) FROM range(1000000) AS t(value);
SELECT gpu_sum_resident('v');
SELECT gpu_last_stats(); -- which backend ran + kernel time
About gpudb
gpudb has two SQL surfaces:
Streaming aggregates — drop-in gpu_sum / gpu_min / gpu_max
(BIGINT and DOUBLE overloads; smaller integers widen implicitly).
They work in plain aggregation, GROUP BY, and window frames, match
native DuckDB semantics (SQL NULL for empty/all-NULL input, NaN-aware
total order for DOUBLE min/max), and run at parity with native — by
design, since per-query GPU round-trips lose through this interface.
Resident columns (v0.4.0) — the path where the GPU wins. Upload a column to device memory once, then reductions run on-GPU with zero per-query transfer:
gpu_upload(name, col)— one-time upload (BIGINT or DOUBLE)gpu_sum_resident/gpu_min_resident/gpu_max_resident(BIGINT)gpu_sum_resident_f64(DOUBLE)gpu_resident_info,gpu_last_stats,gpu_build_info,gpu_drop_resident
Measured on TPC-H lineitem (DuckDB v1.5.5, 5-run medians, results
verified equal to native; full grid with reproduction steps in the
project's append-only BENCHMARK.md): SF50 SUM 99 ms native vs 4 ms
resident on an RTX 4090 Laptop (25×, kernel at 563 GB/s ≈ VRAM
bandwidth); SF100 (600M rows) 99 ms vs 10 ms on an Apple M4 Max
(9.9×, Metal kernel at 503 GB/s). The speedup grows with data size.
Honest trade-offs are documented alongside: whole-column min/max on
stored tables stays a native win (zonemap statistics), one-shot cold
queries favor native, and the one-time upload breaks even after roughly
100 repeated queries.
Community binaries ship the full Metal path on Apple Silicon and a clean
CPU fallback on Linux (same SQL surface either way — LOAD never fails
on GPU-less machines). The Linux build is CUDA-ready: it auto-enables the
CUDA backend with a statically linked runtime when built with the CUDA
toolchain, and SELECT gpu_build_info(); reports which backends a given
binary carries.
Source: https://github.com/singhpratech/duckdbgpumetaldbram
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| gpu_build_info | scalar | NULL | NULL | |
| gpu_drop_resident | scalar | NULL | NULL | |
| gpu_last_stats | scalar | NULL | NULL | |
| gpu_max | aggregate | NULL | NULL | |
| gpu_max_resident | scalar | NULL | NULL | |
| gpu_min | aggregate | NULL | NULL | |
| gpu_min_resident | scalar | NULL | NULL | |
| gpu_resident_info | scalar | NULL | NULL | |
| gpu_sum | aggregate | NULL | NULL | |
| gpu_sum_resident | scalar | NULL | NULL | |
| gpu_sum_resident_f64 | scalar | NULL | NULL | |
| gpu_upload | aggregate | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.