Every time you open an app, train an AI model, or render a video, your device is doing math. Compute power is simply a measure of how much work a computer can do in a given amount of time. In this post we explain the idea step by step and use Python to measure it on your own machine.
1. What Is Compute Power?
Compute power (also called computing power or processing power) describes the speed at which a system can execute instructions and calculations. It depends on several things working together:
- Clock speed – how many cycles per second a processor runs (measured in GHz).
- Number of cores – how many tasks can truly run in parallel.
- Instructions per cycle (IPC) – how much work is done in each cycle.
- Vector / SIMD units – hardware that applies one operation to many numbers at once.
- Memory bandwidth – how fast data reaches the processor. A fast CPU waiting on slow RAM is wasted.
- Accelerators – GPUs and TPUs, built for massive parallel math.
2. Units Used to Measure It
| Unit | Meaning | Typical Device |
|---|---|---|
| MIPS | Million instructions per second | Old CPUs, microcontrollers |
| GFLOPS | 109 floating-point operations per second | Laptop / desktop CPU |
| TFLOPS | 1012 FLOPS | Gaming / AI GPUs |
| PFLOPS | 1015 FLOPS | Supercomputer racks |
| EFLOPS | 1018 FLOPS | Exascale supercomputers |
3. Step 1 – Inspect Your Machine
Let us start by asking Python what hardware it is running on. This uses only the standard library.
import os
import platform
print("System :", platform.system(), platform.release())
print("Machine :", platform.machine())
print("Processor :", platform.processor())
print("Python :", platform.python_version())
print("CPU cores (logical):", os.cpu_count())
Note that os.cpu_count() reports logical cores (threads). A 4-core CPU with hyper-threading shows 8.
4. Step 2 – Theoretical Peak Performance
The theoretical peak is the best case, if every unit is busy every cycle:
Peak FLOPS = cores × clock speed (Hz) × FLOPs per cycle per core
def peak_gflops(cores, clock_ghz, flops_per_cycle):
"""Theoretical peak performance in GFLOPS."""
return cores * clock_ghz * flops_per_cycle
# Example: 8 cores, 3.5 GHz, AVX2 with FMA
# (4 doubles x 2 ops (multiply+add) x 2 FMA units = 16 FLOPs per cycle)
print(peak_gflops(8, 3.5, 16), "GFLOPS") # 448.0 GFLOPS
Real programs almost never reach this number, which is why we measure.
5. Step 3 – Measure Real GFLOPS with NumPy
Multiplying two n × n matrices takes about 2n³ floating-point operations. If we time it, we get a practical estimate. Install NumPy first with pip install numpy.
import time
import numpy as np
def measure_gflops(n=2000, repeats=3):
a = np.random.rand(n, n)
b = np.random.rand(n, n)
a @ b # warm-up run
best = float("inf")
for _ in range(repeats):
start = time.perf_counter()
a @ b
best = min(best, time.perf_counter() - start)
flops = 2 * n ** 3
return flops / best / 1e9
print(f"Measured: {measure_gflops():.1f} GFLOPS")
NumPy calls an optimized BLAS library that uses SIMD instructions and multiple cores, so this number is usually close to your machine's true capability.
6. Step 4 – Why Libraries Matter: Python vs NumPy
Plain Python loops are slow because each operation goes through the interpreter. Compare the same task done two ways:
import time
import numpy as np
N = 5_000_000
# Pure Python
start = time.perf_counter()
total = 0
for i in range(N):
total += i * i
py_time = time.perf_counter() - start
# NumPy (vectorized)
start = time.perf_counter()
arr = np.arange(N, dtype=np.int64)
np_total = int((arr * arr).sum())
np_time = time.perf_counter() - start
print(f"Pure Python: {py_time:.3f} s")
print(f"NumPy : {np_time:.3f} s")
print(f"Speedup : {py_time / np_time:.0f}x")
Typical result: NumPy is 20 to 100 times faster. The hardware is identical; only the way we use it changed. Efficient software is part of compute power.
7. Step 5 – Using Multiple Cores
Python's multiprocessing module runs work on separate processes, each able to use its own core.
import os
import time
from multiprocessing import Pool
def work(n):
s = 0
for i in range(n):
s += i * i
return s
def run(workers, total=40_000_000):
chunk = total // workers
start = time.perf_counter()
with Pool(workers) as pool:
pool.map(work, [chunk] * workers)
return time.perf_counter() - start
if __name__ == "__main__": # required on Windows and macOS
base = run(1)
print(f"1 worker : {base:.2f} s")
w = 2
while w <= os.cpu_count():
t = run(w)
print(f"{w} workers: {t:.2f} s (speedup {base / t:.2f}x)")
w *= 2
You should see the time drop as workers increase, until you run out of physical cores.
8. Step 6 – Amdahl's Law: The Limit of Parallelism
Adding cores never speeds up the part of a program that must run sequentially. Amdahl's Law gives the maximum speedup:
Speedup = 1 / ((1 − p) + p / n)
where p is the fraction of the program that can run in parallel and n is the number of processors.
def amdahl(p, n):
return 1 / ((1 - p) + p / n)
for cores in [1, 2, 4, 8, 16, 64, 1024]:
print(f"{cores:5d} cores -> {amdahl(0.90, cores):5.2f}x speedup")
With 90% parallel code, even 1,024 cores give less than a 10x speedup. This is why software design matters as much as raw hardware.
9. Step 7 – GPU Compute (Optional)
GPUs have thousands of simple cores, ideal for matrix math in AI. If you have an NVIDIA GPU and PyTorch installed:
import time
import torch
if torch.cuda.is_available():
print("GPU:", torch.cuda.get_device_name(0))
n = 4096
a = torch.rand(n, n, device="cuda")
b = torch.rand(n, n, device="cuda")
a @ b
torch.cuda.synchronize() # wait for the warm-up to finish
start = time.perf_counter()
for _ in range(10):
a @ b
torch.cuda.synchronize()
elapsed = (time.perf_counter() - start) / 10
print(f"GPU: {2 * n ** 3 / elapsed / 1e12:.2f} TFLOPS")
else:
print("No CUDA GPU found.")
Compare the TFLOPS here with the GFLOPS from Step 3. The gap usually shows why GPUs dominate AI training.
10. Real-World Scale
- Smartphone: roughly hundreds of GFLOPS to a few TFLOPS (CPU + GPU + NPU).
- Gaming PC GPU: tens of TFLOPS.
- Data-center AI accelerator: hundreds to thousands of TFLOPS at low precision.
- Top supercomputers: exascale, above 1018 operations per second.
Key Takeaways
- Compute power is the amount of work done per unit of time, measured in FLOPS.
- Peak FLOPS comes from cores × clock × FLOPs per cycle, but real results are lower.
- Optimized libraries (NumPy, BLAS) unlock hardware that plain Python cannot.
- Parallelism helps, but Amdahl's Law caps the gains.
- GPUs trade flexibility for enormous parallel throughput.
Try the scripts above, post your GFLOPS result in the comments, and see how your machine compares!

0 Comments