Open source · C++20 · CUDA 11+

CUDA resources,
under control.

A modern C++ library for type-safe GPU memory, streams, events, textures, surfaces, and graphs—with predictable RAII lifetimes.

RAIIby default
Typeddevice pointers
ZeroCUDA header leaks
vector_add.cu
// Typed GPU memory with RAII
ns::Array<float> out(allocator, count);

stream
  .fill(out.data(), 0.0f, out.size())
  .launch(kernel, grid, block)(out, count)
  .sync();
dev::Ptr<T>
ns::Stream
Built around TYPE SAFETY RESOURCE OWNERSHIP COMPOSABLE APIS CUDA PERFORMANCE
01 — WHY NUCLEUS

Safer abstractions.
Native performance.

Nucleus wraps the CUDA Runtime API without hiding how the GPU works. You keep explicit control while the type system handles the sharp edges.

01

Typed device pointers

dev::Ptr<T>, Ptr2<T>, and Ptr3<T> preserve element types and dimensional intent from host code all the way into kernels.

dev::Ptr<const float>compile-time checked
02

RAII everywhere

Memory, streams, events, textures, surfaces, and graphs clean themselves up deterministically.

03

Fluent stream API

Chain launches, copies, fills, callbacks, and synchronization into readable execution flows.

04

CUDA header isolation

Host-side translation units use clean Nucleus headers without pulling CUDA headers into every consumer. Keep builds lean and toolchains predictable.

YOUR APP→NUCLEUS→CUDA
02 — QUICK START

From clone to kernel in minutes.

Nucleus builds with CMake and works as a standalone library or an embedded submodule.

01

CUDA Toolkit11.0 or newer

02

CMake3.18 or newer

03

C++ compilerC++20 support

powershell / bash
$ git clone https://github.com/WenchaoHuang/Nucleus.git
$ cd Nucleus
$ cmake -B build -DNUCLEUS_BUILD_SHARED_LIB=ON
$ cmake --build build --config Release
✓ Ready to link nucleus
03 — THE TOOLKIT

One coherent model
for the CUDA runtime.

Use only what you need. Each component shares the same ownership model, naming conventions, and device-aware design.

01

Memory

Typed arrays, buffers, spans, and pluggable host or device allocators.

Array<T>BufferAllocator
02

Execution

Streams, events, timers, kernel helpers, and reusable CUDA graphs.

StreamEventGraph
03

Images

Dimension-aware CUDA arrays with texture and surface access.

Image2DTextureSurface
04

Runtime

Device discovery, properties, memory reporting, and diagnostics.

RuntimeDeviceLogger
BUILD CLOSER TO THE METAL

Give your CUDA code
a stronger foundation.

Explore on GitHub