TorchedUp
ProblemsPremium
TorchedUp
Arithmetic IntensityEasy
ProblemsPremium

Arithmetic Intensity

Arithmetic intensity is the ratio of FLOPs performed to bytes of memory accessed. It tells you whether a kernel is compute-bound or memory-bound on a given accelerator.

Signature: def arithmetic_intensity(flops: int, bytes_accessed: int) -> float

Return flops / bytes_accessed as a float.

Examples:

  • GEMM (M=128, N=128, K=128) in fp32: flops = 2 * 128**3, bytes = 3 * 128**2 * 4 (read A, B; write C) → ~21.33
  • Elementwise add of N fp32 elements: flops = N, bytes = 12 * N (read A, read B, write C) → ~0.083

Math

Asked at

Python (numpy)0/3 runs today

Test Results

○GEMM 128x128x128 fp32
○elementwise add fp32
○large GEMM fp16🔒 Premium
Advertisement