Skip to main content
Alpha Cyanea is in public alpha. We're building in the open — expect rough edges and rapid iteration. See what's live

cyanea-gpu

v0.1.0 Platform

Offload heavy computation to the GPU with WebGPU.

Platform layer Apache-2.0

GPU-accelerated compute kernels via wgpu. Pairwise alignment, k-mer counting, and matrix operations on GPU hardware.

Overview

cyanea-gpu provides GPU-accelerated compute kernels for bioinformatics workloads that benefit from massive parallelism. It uses wgpu — a cross-platform GPU abstraction that works on Vulkan, Metal, DX12, and WebGPU — to dispatch compute shaders for pairwise alignment, k-mer counting, and matrix operations.

On a modern GPU, pairwise alignment of 10,000 × 10,000 short sequences completes in under a second — a 50–100x speedup over single-threaded CPU alignment.

Key Concepts

WebGPU and wgpu

WebGPU is the next-generation graphics and compute API for the web, replacing WebGL. wgpu is a Rust implementation that provides the same API on native platforms. cyanea-gpu writes compute shaders in WGSL (WebGPU Shading Language) and dispatches them through wgpu, achieving portability across desktop, server, and browser environments.

Compute Shader Architecture

Each kernel is a WGSL compute shader that processes data in workgroups. For example, the pairwise alignment kernel assigns one workgroup per sequence pair and uses shared memory for the scoring matrix. The input sequences and output scores are passed via GPU buffers.

Kernel Library

KernelDescriptionTypical Speedup
pairwise_alignAll-vs-all Smith-Waterman50–100x
kmer_countParallel k-mer frequency tables10–30x
matmulDense matrix multiplication20–50x
distance_matrixPairwise Euclidean/cosine distances30–60x

Integration

cyanea-gpu integrates transparently with the rest of the ecosystem. CPU-based crates (e.g., cyanea-align) fall back to GPU kernels when available, with zero API changes for the caller.

Code Examples

Rust

use cyanea_gpu::{GpuContext, pairwise_align};

let ctx = GpuContext::new().await?;
let scores = pairwise_align(&ctx, &queries, &targets, AlignMode::Local).await?;

Python

import cyanea

ctx = cyanea.GpuContext()
scores = ctx.pairwise_align(queries, targets, mode="local")

Requirements

  • A GPU with Vulkan 1.2, Metal 3, or DX12 support
  • For browser use: Chrome 113+ or Firefox 121+ with WebGPU enabled
  • cyanea-gpu is not included in the WASM playground because WebGPU support in WASM is still experimental

Use Cases

  • Large-scale alignment — Align millions of short reads against a panel of references.
  • Metagenomics — Build k-mer frequency matrices for thousands of samples in seconds.
  • Single-cell analysis — Accelerate distance matrix computation for clustering pipelines.

Depends on

Depended on by

Tags

GPU WebGPU wgpu Acceleration Compute Shaders