GPGPU Programming (CUDA / OpenGL GLSL)

GPGPU (general-purpose GPU) programming uses the graphics processor’s thousands of parallel cores for non-graphics computation. Dense RGB-D SLAM was the field’s killer app: every stage of a pipeline like KinectFusion — per-pixel depth filtering, per-voxel TSDF fusion, per-pixel raycasting — is an embarrassingly parallel map over pixels or voxels, exactly what GPUs are built for. Real-time dense SLAM at 30 Hz is simply not feasible on a CPU; it became possible the moment these loops were moved to the GPU.

CUDA in a nutshell

CUDA (NVIDIA’s GPGPU platform) exposes the GPU as a grid of lightweight threads all running the same kernel function:

Typical SLAM kernels: bilateral filtering of the depth map, computing vertex and normal maps from depth, TSDF integration (one thread per voxel in the camera frustum, projecting the voxel into the depth image and updating a weighted running average), and raycasting the TSDF for frame-to-model tracking.

Parallel reduction is the other key pattern: projective-data-association ICP computes a 6×66 \times 6 Gauss–Newton system by summing per-pixel terms JiTJiJ_i^T J_i and JiTriJ_i^T r_i over hundreds of thousands of pixels. Each thread computes its local product; a tree-structured reduction in shared memory sums them per block; a final pass (or atomics) combines block results. Only the tiny 6×66 \times 6 system is copied back to the CPU and solved there.

OpenGL GLSL as a compute vehicle

Before and alongside CUDA, GPGPU was done through the graphics pipeline using GLSL shaders, and several influential RGB-D systems (notably ElasticFusion) are written this way — with the bonus that it is vendor-neutral, unlike CUDA:

Practical guidance

Why it matters for SLAM

Hands-on