---
title: "onegpu cookbook"
url: https://recursiveai.org/onegpu/cookbook/
description: "7 OneGpu recipes, each with complete code."
version: "1.0.0"
---

# onegpu cookbook

## Compute basics

- [Run a compute shader in C#](https://recursiveai.org/onegpu/cookbook/run-a-compute-shader-in-csharp/index.md): Compile HLSL at build time, bind a typed buffer, dispatch a Vulkan compute shader and read its output in C# with OneGpu. Includes a runnable example.
- [Read a GPU buffer back to the CPU in C#](https://recursiveai.org/onegpu/cookbook/read-back-a-gpu-buffer/index.md): Copy a OneGpu buffer into a C# array with ReadAsync or Read. Run a complete Vulkan example, read a subrange and understand when the result is ready.
- [Choose a Vulkan physical device in C#](https://recursiveai.org/onegpu/cookbook/pick-a-vulkan-device/index.md): Enumerate Vulkan adapters and select a discrete or integrated GPU in C# with OneGpu. Includes name matching, environment overrides and a runnable example.

## Matrix operations

- [GPU matrix multiplication in C#](https://recursiveai.org/onegpu/cookbook/multiply-matrices-on-the-gpu/index.md): Multiply float32 matrices on the GPU from C# with OneGpu Gemm. Includes row-major inputs, CPU comparison, transpose and batch examples you can run.

## Compute

- [Get deterministic GPU compute results in C#](https://recursiveai.org/onegpu/cookbook/deterministic-gpu-results/index.md): Get repeatable floating-point GPU results in C# with OneGpu’s deterministic mode. Includes a runnable matrix product and bitwise comparison.
- [Measure GPU compute shader time in C#](https://recursiveai.org/onegpu/cookbook/time-a-compute-pass/index.md): Measure a GPU compute pass in nanoseconds with OneGpu timestamp queries. Includes capability checks, a runnable example and real Vulkan output.
- [Run WebGPU compute in Blazor WebAssembly](https://recursiveai.org/onegpu/cookbook/webgpu-compute-in-blazor-webassembly/index.md): Run a GPU matrix product in a .NET 10 Blazor WebAssembly app with OneGpu. Includes async device creation, readback and a downloadable app.
