Sizing RBF-FD Stencils for Modern CPU Caches

One of the benefits of the RBF-FD methods compared to grid-based finite differences is it is straightforward to change the order of accuracy via the augmented polynomials. The number of monomials terms in the augmented polynomial basis is given by the triangular numbers in 2-d and the tetrahedral numbers in 3-d. The number of terms can also be read from Pascal’s triangle/pyramid.

For the RBF stencil size a common heuristic is to use twice the number of polynomials terms. This heuristic originates from the work of Grady Wright. While this rule of thumb is a standard starting point for stencil sizing, the relationship between accuracy, computational time, and monomial augmentation remains an active area of research. Readers can find more information in the analysis by Jančič, Slak, and Kosec (2021) and citing works.

The tables below show how the RBF-FD matrix dimensions varies for 2-D and 3-D RBF-FD approximation. We also include the storage size of the matrices for 32- and 64-bit floats.

2-D RBF-FD approximation

Poly orderNumber of monomialsMatrix size (RBF + poly)Storage - fp32 (KB)Storage - fp64 (KB)
1130.0350.070
2390.3160.633
36181.2662.531
410303.5167.031
515457.91015.820
6216315.50431.008
7288427.56355.125
83610845.56391.125
94513571.191142.383
1055165106.348212.695

3-D RBF-FD approximation

Poly orderNumber of monomialsMatrix size (RBF + poly)Storage - fp32 (KB)Storage - fp64 (KB)
1130.0350.070
24120.5631.125
310303.5167.031
4206014.06328.125
53510543.06686.133
656168110.250220.500
784252248.063496.125
8120360506.2501012.500
9165495957.1291914.258
102206601701.5633403.125

When computing the RBF-FD approximation weights via LU factorization or other forms of factorization (i.e. block Cholesky) the matrix will reside in the L1 or L2 cache. The maximum matrix size that fits in cache also depends on the number of right-hand sides (operators) being solved simultaneously, as those vectors must also share the cache.

Here are the L1 data cache sizes of a few recent CPU architectures:

CPUL1D Cache Size (KB)
Apple M-series (P-core)128
Nvidia Grace64
Fujitsu A64FX64
Intel Granite Rapids48
Intel Sapphire Rapids48
Intel Core 13th/14th Gen48
Intel Core 11th Gen48
AMD Zen 548
AMD Zen 432

The figure below plots the matrix storage against polynomial order up to 12, with the L1 data cache sizes drawn as horizontal references. Storage scales with the square of the number of polynomial terms, so the vertical axis is logarithmic.

Log-scale plot of RBF-FD system-matrix storage in kilobytes versus polynomial order from 1 to 12, for 2-D and 3-D approximations in single and double precision, with horizontal lines marking the 32, 64 and 128 KB L1 data cache sizes of recent CPUs.
System-matrix storage vs. polynomial order for the twice the number of polynomial terms stencil heuristic, in single (fp32) and double (fp64) precision. Horizontal lines mark representative L1 data cache sizes. Interactive: hover to read off values, and click a legend entry to toggle a curve.

For polynomials below order 7 in 2D (or 5 in 3D) the RBF-FD matrices fit comfortably in the lowest cache level. The Apple M-series and recent ARM servers like the Nvidia Grace or Fujitsu A64FX have a slight advantage due to the larger L1 cache sizes. Intel and AMD CPUs used 32 KB L1 data caches for more than a decade. AMD increased the size only recently with the Zen 5 series launched in 2024. Intel made the upgrade from 32 KB to 48 KB in the Sunny Cove architecture launched in 2019.

(Note: Apples’s efficiency cores (E-cores) use smaller 64 kB L1D caches. Intel’s efficiency cores have remained at 32 kB L1 data caches. )

#Rbf-Fd   #Numerical-Methods   #Hpc   #Cpu-Cache   #Linear-Algebra