BHGMC

Side projects · FlopMark

FlopMark

FlopMark is a benchmark running in (and limited by) your browser. Beyond being a nice way to check your device power, this page offers an educational picture of how BLAS and LAPACK routines scale. These routines are used everywhere in scientific computing.

FlopMark Benchmark

 

How does it work? A basic test estimates:

  1. Your computing power (GFLOP/s),
  2. Your memory speed (GB/s).

Then, three standard linear algebra routines are tested:

  1. Matrix-matrix multiplication,
  2. LU decomposition and LU solve,
  3. Poisson solve.

The whole benchmark takes about a minute, and everything is performed directly on your device. The results are indicative only since the performance is limited by your browser’s JS engine.

  • Arithmetic
  • Memory speed
  • Matrix multiply
  • LU solve
  • Poisson solve
  1. Device power
  2. Matrix multiply
  3. LU solve
  4. Poisson solve
Device powerOne core
Arithmetic GFLOP/s GFLOP/s
Memory speed GB/s GB/s
Scaling
Matrix multiply
 
LU solve
 
Poisson solve
 

Keep this tab in front until the benchmark ends. Browsers slow down the tabs you are not looking at, and the numbers would say more about that than about your device.

All of this ran inside a browser tab: the numbers say what JavaScript and WebAssembly reached here, today, not what your device can do at its best. Another browser on the same machine will not agree with this one.

The benchmark stopped.

This tab went to the background, where the browser slows everything down. The rest of the run would have measured that, not your device, so nothing was kept.

The benchmark was stopped before the end, so nothing was kept.

Keep this tab in front.

This browser cannot run the benchmark.

It needs two things from a browser: WebAssembly vector instructions, and a memory the workers can share. A recent Chrome, Firefox or Safari has both.

The benchmark could not finish.

Something in this browser stopped it, and nothing was kept. Restarting usually works; if it does not, another browser will.

Why it stops scaling

Communication is key

Twice the workers, twice as fast?

The figures produced by the benchmark show two curves per chart:

  1. The dashed line shows ideal scaling: twice the workers, twice as fast.
  2. The solid line shows measured scaling: it starts close to ideal scaling, then bends away.

This is not a flaw of the benchmark. It happens everywhere from phones and laptops to supercomputers and clusters on the cloud (where the picture becomes more complex, of course). Below, we briefly explain three reasons. Two of them are directly related to communication: between the workers, and with the memory.

Not all cores are equal

Many modern devices mix two kinds of cores: fast performance cores, and slower efficiency cores that save energy. The first workers usually get the fast ones. Once all performance cores are taken, the slower efficiency cores join the game and the curve bends (even more).

Thermal throttling plays a role too. A warm phone slows itself down, and the system can move workers from one core to another during the run.

Workers on an 8-core CPU device

1 worker
2 workers
4 workers
8 workers
performance coreefficiency core

Each device is different. The picture gets more complex on a distributed system and with hardware accelerators (like GPUs and NPUs).

Someone has to go first

Some steps are sequential by nature: in that case, one worker completes the operation while the others wait for the result. Here are some examples:

  • In the LU solve, choosing the next pivot is performed by only one worker.
  • In the Poisson solve, the workers must stop at every step to sum up their results.

These algorithmic restrictions set a natural limit. In the picture below, if one worker finishes the task in a certain amount of time, then with 8 workers the same task is only 4.7× faster, not 8×. (Illustrative: assuming a tenth of the work is purely sequential.)

Time for the same work

1 worker1.0×
2 workers1.8×
4 workers3.1×
8 workers4.7×
timeperfect scaling

The blue bars get shorter, but not as short as the grey ones: 8 workers take about a fifth of the time, not an eighth.

Everyone waits at the same door

Every core reads and writes its numbers in the same memory, through the same path. Alone, a core has this path to itself. With eight cores, they share it, and each one spends more of its time waiting for numbers.

On many devices the power table shows it: from one core to all of them, arithmetic often grows much more than memory speed. The Poisson solve is more memory-intensive than arithmetic-intensive, so this test shows the memory limit best.

One path to memory

1 core: the path to itself

8 cores: the same path, shared

computingwaiting for numbersmemory bandwidth

One core has more memory bandwidth than each of eight cores sharing it.

What people try

Researchers redesign algorithms so that workers talk less often: fewer meetings, and bigger chunks of work between them. A recent research direction is to exploit randomness to reduce communication between cores by, for example, letting LU skip pivoting (in a clever way).

Another way is to change the question. Instead of solving the same problem faster, the extra cores solve a bigger problem in the same time. This is called weak scaling, and it is often how supercomputers are used.

To learn more

  1. G. M. Amdahl (1967). Validity of the single processor approach to achieving large scale computing capabilities. AFIPS Spring Joint Computer Conference.
  2. J. L. Gustafson (1988). Reevaluating Amdahl's law. Communications of the ACM.
  3. S. Williams, A. Waterman, D. Patterson (2009). Roofline: an insightful visual performance model for multicore architectures. Communications of the ACM.
  4. M. Baboulin, J. Dongarra, J. Herrmann, S. Tomov (2013). Accelerating linear system solutions using randomization techniques. ACM Transactions on Mathematical Software.
  5. G. Ballard, E. Carson, J. Demmel, M. Hoemmen, N. Knight, O. Schwartz (2014). Communication lower bounds and optimal algorithms for numerical linear algebra. Acta Numerica.
  6. P.-G. Martinsson, J. A. Tropp (2020). Randomized numerical linear algebra: foundations and algorithms. Acta Numerica.