getkeops/keops
KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
What it solves
KeOps addresses the memory bottleneck in large-scale mathematical computations on GPUs. Standard dense matrices often exceed GPU memory (RAM), and sparse matrices are often inefficient on GPUs due to random memory access. KeOps allows the computation of reductions of large arrays—such as kernel matrix-vector products, K-nearest neighbors, and N-body interactions—without needing to store the full matrix in memory, preventing memory overflows.
How it works
KeOps introduces the concept of "symbolic matrices" (or LazyTensors). Instead of storing a full matrix of values, it represents the matrix as a mathematical formula $F(x_i, y_j)$ based on two smaller data arrays. It uses efficient C++ routines and CUDA registers to bypass costly memory transfers, calculating values on-the-fly during reduction operations (like .sum(), .logsumexp(), or .argmin()). This transforms the memory footprint from quadratic to linear, providing a 10x-100x speed-up over standard PyTorch GPU baselines.
Who it’s for
Researchers and developers working in geometric deep learning, shape analysis, Gaussian processes, computational biology, and physics, as well as anyone needing to perform large-scale kernel operations on GPUs with automatic differentiation support.
Highlights
- Linear Memory Footprint: Avoids quadratic memory growth for large-scale computations.
- Automatic Differentiation: Full support for gradients and derivatives of arbitrary orders.
- Multi-Language Support: Integrates with Python (PyTorch, NumPy), Matlab, and R.
- Broad Reduction Support: Includes Sum, LogSumExp, Min, Max, ArgMin, ArgMax, and K-min reductions.
- Hardware Optimization: Specifically optimized for CUDA registers to maximize GPU throughput.
Related
- Project
- Project
- Project
- Dispatch
- Project