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.
A modern C++ library for type-safe GPU memory, streams, events, textures, surfaces, and graphs—with predictable RAII lifetimes.
// 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();
Nucleus wraps the CUDA Runtime API without hiding how the GPU works. You keep explicit control while the type system handles the sharp edges.
dev::Ptr<T>, Ptr2<T>, and Ptr3<T> preserve element types and dimensional intent from host code all the way into kernels.
Memory, streams, events, textures, surfaces, and graphs clean themselves up deterministically.
Chain launches, copies, fills, callbacks, and synchronization into readable execution flows.
Host-side translation units use clean Nucleus headers without pulling CUDA headers into every consumer. Keep builds lean and toolchains predictable.
Nucleus builds with CMake and works as a standalone library or an embedded submodule.
CUDA Toolkit11.0 or newer
CMake3.18 or newer
C++ compilerC++20 support
$ git clone https://github.com/WenchaoHuang/Nucleus.git
$ cd Nucleus
$ cmake -B build -DNUCLEUS_BUILD_SHARED_LIB=ON
$ cmake --build build --config Release
nucleus$ git submodule add https://github.com/WenchaoHuang/Nucleus.git third_party/nucleus
# CMakeLists.txt
add_subdirectory(third_party/nucleus)
target_link_libraries(my_app PRIVATE nucleus)
Use only what you need. Each component shares the same ownership model, naming conventions, and device-aware design.
Typed arrays, buffers, spans, and pluggable host or device allocators.
Streams, events, timers, kernel helpers, and reusable CUDA graphs.
Dimension-aware CUDA arrays with texture and surface access.
Device discovery, properties, memory reporting, and diagnostics.