Show HN: I built a tensor library from scratch in C++/CUDA
a year ago
- #machine-learning
- #tensor-library
- #PyTorch-compatible
- DSC is a PyTorch-compatible tensor library and inference framework for machine learning models.
- Features an intuitive API similar to NumPy/PyTorch with usability improvements.
- Includes built-in neural networks support with nn.Module, making porting from PyTorch trivial.
- Supports multiple backends (CPU, CUDA) with seamless switching via dsc.set_default_device().
- Minimal external dependencies; core operations written in portable C++ for efficiency and portability.
- No runtime allocations due to a custom memory allocator; supports linear allocator for reduced overhead.
- Requirements: C++20 compatible compiler and GNU Make for building.
- Installation involves cloning the repository, setting up a virtual environment, and building the C++ library.
- Supports CUDA backend for GPU acceleration; requires CUDA Toolkit for NVIDIA GPUs.
- Includes pytest for unit testing against NumPy as a correctness reference.