Wandering Giants Compute · Learn
Guide

What Is GPU Parallel Processing? Explained for AI Developers

The short answer

GPU parallel processing means running the same instruction on thousands of data elements at once. Threads execute in warps of 32 on streaming multiprocessors (an H100 PCIe has 114), and tensor cores multiply small matrix tiles in one step. Neural networks are mostly independent multiply-adds, so they map onto this design almost perfectly.

Execution model
SIMT: single instruction, multiple threads
Warp size
32 threads executing together
Streaming multiprocessors
A100 108 · H100 PCIe 114 · H100 SXM 132
Tensor cores
Matrix multiply-accumulate units for BF16, FP8, FP4
Memory hierarchy
Registers → shared memory/L1 → L2 → HBM/GDDR
FLOPs per token (inference)
~2 × model parameters

"GPUs are good at parallel work" is true but not very useful when your training loop runs at half the speed you expected. Knowing how a GPU actually executes your code (how threads are grouped, where data lives, what tensor cores do) explains most of the performance advice you will read, and why some of it matters more than the rest.

This guide explains GPU parallel processing for developers who work in Python and PyTorch rather than CUDA C. It is part of our series on GPU cloud computing.

What is GPU parallel processing?

GPU parallel processing is the execution of one program across thousands of lightweight threads at the same time, each working on a different piece of data. NVIDIA calls the model SIMT (single instruction, multiple threads): groups of threads run the same instruction in lockstep on different values.

A CPU runs a handful of threads, each very fast and able to do something different. A GPU runs tens of thousands of threads, each slower and simpler, all doing much the same thing. If the job is "add these two lists of ten million numbers", the GPU gives each pair of numbers its own thread and finishes in one sweep. For the broader comparison, see GPU vs CPU: what's the difference and when you need each.

How is a GPU organised?

A GPU is organised as an array of streaming multiprocessors (SMs), each containing scalar cores, tensor cores, registers and a block of fast shared memory, all connected to a large L2 cache and to the GPU's main memory. Your work is spread across every SM at once.

UnitWhat it doesExample figures
Streaming multiprocessor (SM)Runs blocks of threads; the GPU's basic building blockA100: 108 · H100 PCIe: 114 · H100 SXM: 132 · RTX 4090: 128 · L40S: 142
Warp32 threads issued together, same instructionFixed at 32 on NVIDIA GPUs
CUDA coresScalar FP32/INT operationsThousands per GPU
Tensor coresMultiply-accumulate on small matrix tilesSeveral per SM; BF16, FP8, FP4 depending on generation
RegistersPer-thread working storage, fastestTens of thousands per SM
Shared memory / L1On-chip scratchpad shared by a blockUp to a few hundred KB per SM
L2 cacheShared by all SMsTens of MB
HBM / GDDRMain GPU memory (VRAM)24–288 GB at 0.86–8 TB/s

The key relationship is between the last row and the rest. Main memory is big but, relative to the arithmetic units, slow. Most GPU performance work is about reading each byte from main memory as few times as possible and reusing it on-chip. NVIDIA's CUDA C++ Programming Guide describes the hierarchy in full.

How does code run on all those cores?

Code runs on a GPU as kernels: functions launched over a grid of thread blocks. Each block is assigned to an SM, split into warps of 32 threads, and the SM's schedulers switch between warps every cycle so that while one warp waits for memory, another computes.

That switching is how GPUs hide memory latency. A single read from main memory takes hundreds of cycles. Rather than wait, the SM runs other warps that are ready. This only works if there are enough warps in flight, a property called occupancy. A kernel with too little work leaves SMs idle no matter how fast the GPU is.

You can see the model directly in Triton, which lets you write GPU kernels in Python. A vector add:

python
import torch
import triton
import triton.language as tl

@triton.jit
def add_kernel(x_ptr, y_ptr, out_ptr, n, BLOCK: tl.constexpr):
    pid = tl.program_id(0)                     # which block am I?
    offs = pid * BLOCK + tl.arange(0, BLOCK)   # the elements this block handles
    mask = offs < n                            # don't run past the end
    x = tl.load(x_ptr + offs, mask=mask)
    y = tl.load(y_ptr + offs, mask=mask)
    tl.store(out_ptr + offs, x + y, mask=mask)

n = 10_000_000
x = torch.rand(n, device="cuda")
y = torch.rand(n, device="cuda")
out = torch.empty_like(x)
grid = (triton.cdiv(n, 1024),)                 # about 9,766 blocks
add_kernel[grid](x, y, out, n, BLOCK=1024)

Each block handles 1,024 elements. Nearly ten thousand blocks are queued, and the GPU spreads them across its SMs. This kernel is entirely memory-bound: it reads 8 bytes and writes 4 for each single addition. Most of deep learning is the opposite case, as the next section shows.

Why does AI map so well onto GPUs?

AI maps well onto GPUs because neural networks are dominated by matrix multiplications, and every element of a matrix product can be computed independently. That gives millions of parallel, identical multiply-add operations, which is exactly what thousands of threads and tensor cores are built for.

Take one linear layer in a transformer: a weight matrix of 8,192 × 8,192 multiplied by the activations of a batch of tokens. Each output value is the dot product of one row of weights with one token's activations, 8,192 multiply-adds, independent of every other output value. For a batch of 4,000 prompt tokens that is 8,192 × 4,000 independent dot products, about 268 billion multiply-adds, in one layer.

Matrix multiplication also reuses data heavily. Each weight is used once for every token in the batch. A well-written kernel loads a tile of weights into shared memory once and applies it to many tokens, so arithmetic per byte read is high. That is why prompt processing and training run close to the GPU's compute limit, while generating one token for one user, with no reuse, is limited by memory bandwidth. GPU memory bandwidth, FLOPS and compute performance puts numbers on this.

What do tensor cores add?

Tensor cores add dedicated hardware for small matrix multiply-accumulate operations, so a whole tile of a matrix product is computed in one instruction instead of many scalar ones. They are where nearly all of a modern GPU's AI throughput comes from.

Each generation has added lower-precision formats, each roughly doubling throughput over the previous:

GenerationExample GPUsTensor-core precisions relevant to AI
AmpereA100TF32, BF16, FP16, INT8
Ada LovelaceRTX 4090, L40SAdds FP8
HopperH100, H200FP8 with Transformer Engine
BlackwellRTX PRO 6000, B200, B300Adds FP4

Frameworks use tensor cores automatically when shapes and data types allow. Two practical consequences: train and serve in BF16 or lower rather than FP32, and prefer matrix dimensions that are multiples of 8 or 16, which tile cleanly.

Which parts of an AI workload run in parallel?

Within one GPU, almost everything inside a single forward pass runs in parallel: the elements of each matrix product, the attention heads, the samples in a batch and, during prompt processing, every prompt token. What does not run in parallel is generation across time, because each new token depends on the last.

WorkParallel?Why
Elements of a matrix productYesIndependent dot products
Attention headsYesIndependent computations, combined at the end
Samples or users in a batchYesIndependent inputs
Prompt tokens (prefill)YesAll known in advance
Generated tokens (decode)No, across timeToken n+1 depends on token n
Layers of a networkNo, within one passEach layer needs the previous output
Diffusion denoising stepsNo, across stepsEach step refines the previous

This table explains a lot about LLM serving. Because decode is sequential per user, one user cannot use a big GPU's full power. Serving many users at once restores the parallelism: each decode step processes a token for every active user. Techniques like speculative decoding guess several tokens ahead and check them in parallel. The two phases are covered in prefill vs decode. When one GPU is not enough, the same ideas extend across cards, covered in what multi-GPU computing is.

Why does memory hierarchy matter so much?

Memory hierarchy matters because the arithmetic units can process data far faster than main GPU memory can deliver it. The fastest kernels keep data in registers and shared memory and touch main memory as little as possible.

FlashAttention is the best-known example. Standard attention computes a full matrix of scores between every pair of tokens and writes it to main memory, then reads it back. For long sequences that matrix is huge. FlashAttention splits the work into tiles that fit in on-chip memory, computes the softmax piece by piece and never stores the full matrix. The result is identical, with much less memory traffic, so attention runs faster and longer contexts fit.

The same principle sits behind kernel fusion. Instead of three kernels that each read and write a tensor (for example, add a bias, apply an activation, then scale), one fused kernel reads once and writes once. torch.compile does much of this automatically.

How do you keep a GPU busy?

Keep a GPU busy by giving it large enough chunks of work, using low-precision tensor-core maths, avoiding unnecessary synchronisation with the CPU, and feeding it data fast enough. An idle GPU costs the same per minute as a busy one.

  • Batch. Larger batches give more parallel work. For inference, use a server that batches continuously, such as vLLM.
  • Use BF16 or lower. FP32 bypasses most tensor-core throughput.
  • Compile. model = torch.compile(model) fuses kernels and reduces launch overhead in many models.
  • Avoid hidden syncs. Calls like .item(), .cpu() or printing a tensor inside the training loop force the CPU to wait for the GPU.
  • Feed it. Use DataLoader(num_workers=..., pin_memory=True) so data is ready before the GPU asks.
  • Use fused attention. PyTorch's scaled_dot_product_attention picks a FlashAttention-style kernel when it can.

A quick way to see the GPU's parallel throughput for yourself (results vary by GPU and software version; this is a test to run, not a published figure):

python
import time, torch

n = 8192
a = torch.randn(n, n, device="cuda", dtype=torch.bfloat16)
b = torch.randn(n, n, device="cuda", dtype=torch.bfloat16)
for _ in range(3):
    a @ b                      # warm-up
torch.cuda.synchronize()
t = time.perf_counter()
for _ in range(20):
    a @ b
torch.cuda.synchronize()
dt = (time.perf_counter() - t) / 20
print(f"{2 * n**3 / dt / 1e12:.0f} TFLOPS achieved in BF16")

A large square matrix product in BF16 is about as parallel as work gets, so the result shows roughly how much of the published dense figure your card reaches. Real models reach less, because not every operation is a big matrix product.

When does renting from Wandering Giants Compute fit?

Renting from Wandering Giants Compute fits when you want to run parallel GPU code without buying hardware: a training script, a Triton experiment, a ComfyUI pipeline or a batch job. With Root access you get the whole machine over SSH or Jupyter, with Ubuntu, CUDA and PyTorch installed, and you can install Triton, FlashAttention or anything else. If you only need a model served, Chat and API modes run it for you.

What you're doingGPUStreaming multiprocessorsMemoryPrice per hour
Learning CUDA/Triton, small modelsRTX 409012824 GB$1.59/hr
Training and fine-tuning on AmpereA100 80GB10880 GB$3.79/hr
FP8 training and inference on HopperH100 PCIe11480 GB$4.99/hr

Billing is by the minute from prepaid credit, so a 20-minute benchmark costs 20 minutes. If credit runs out the machine stops itself, and its disk is kept free for 7 days. For training at scale, start with what GPU model training involves, then see the GPUs and prices.

Frequently asked questions

What is the difference between CUDA cores and tensor cores?

CUDA cores do individual scalar floating-point and integer operations, one per thread per clock. Tensor cores multiply small matrix tiles in one operation, giving many times more throughput for matrix maths at reduced precision such as BF16, FP8 and FP4. Deep learning frameworks route most of their work to tensor cores.

Why can't an LLM generate all its tokens in parallel?

Each new token depends on all the tokens before it, so generation is sequential in time. The parallelism is within each step: all the multiply-adds for one token, and the same step for many users at once. Prompt tokens, which are already known, are processed in parallel.

Do I need to learn CUDA to use a GPU for AI?

No. PyTorch, JAX, vLLM, diffusers and similar tools call optimised GPU kernels for you. Learning the basics helps you understand performance, and tools such as Triton let you write custom kernels in Python if you ever need them.

What is a warp on a GPU?

A warp is a group of 32 threads that the GPU schedules together and that execute the same instruction at the same time. If threads in a warp take different branches, the paths run one after another, which wastes throughput. That is why GPU code avoids branching.

Why is my GPU slow with small batches?

Small batches do not give the GPU enough independent work to fill its thousands of threads, and the fixed cost of launching each kernel becomes significant. Larger batches, CUDA graphs and fused kernels reduce the waste.

What is FlashAttention?

FlashAttention is an attention algorithm that splits the computation into tiles small enough to stay in the GPU's fast on-chip memory, instead of writing large intermediate matrices to main GPU memory. It produces the same result with far less memory traffic, which makes attention faster and lets longer contexts fit.

Wandering Giants Compute

Rent the GPU for this, by the minute.

Put your PyTorch code on thousands of GPU cores in minutes: root access with CUDA ready, billed by the minute.

Prepaid credit, billed by the minute, stops itself when credit runs out. Prices in £, $, €, ¥, CA$, A$, CHF and S$; UK prices include VAT.

Keep reading

About this article. Written by the Wandering Giants Compute team, the people who run Wandering Giants Compute. Hardware figures are the manufacturers’ published specifications. Speeds and costs marked as estimates are worked out from those specifications and our current prices, with the method shown; they are not measured benchmarks. Wandering Giants prices are taken live from our price list each time this page is built.

Last reviewed 25 November 2026.