Frontiers in Applied Mathematics and Statistics

A convolutional formulation of explicit finite-difference schemes for variable-coefficient linear partial differential equations in machine-learning frameworks

Mohammad Akram, Khaleel Ahmad, Umar Ishtiaq, Ioan-Lucian Popa

Key points

From the paper's conclusion
  • Explicit finite-difference solvers for linear partial differential equations with constant coefficients map directly onto these primitives, but a position-dependent coefficient produces a stencil whose weights vary from point to point, which a shared convolution kernel cannot express.

Abstract

Machine-learning frameworks expose a small set of tensor primitives, including fixed-kernel convolution, elementwise product, padding, and addition, and compile them for the processors they support. Explicit finite-difference solvers for linear partial differential equations with constant coefficients map directly onto these primitives, but a position-dependent coefficient produces a stencil whose weights vary from point to point, which a shared convolution kernel cannot express. This study shows that every explicit finite-difference update with position-dependent weights of bounded support is a finite sum of fixed-kernel convolutions scaled by precomputed coefficient fields, and that the minimal number of fields, which sets the memory traffic of the update when each field is streamed once per step, equals the rank of the weight matrix. Three realizations of this single algebraic class are developed: scaled convolutions, whose fields are samples of the equation's coefficients; blended kernel banks, whose fields are masks that select a scheme such as upwinding; and position-dependent kernels, whose fields are generated from the local grid geometry. For the schemes used in the experiments, we prove consistency, stability, and convergence with variable coefficients: an exact-arithmetic operator identity for the conservative diffusion stencil, a maximum principle and a total-variation bound for the blended upwind scheme, Gershgorin-based stability of the explicit variable-diffusivity update, and energy conservation of the variable-speed wave leapfrog and energy dissipation of the variable-damping telegraph leapfrog in one and two dimensions, together with a weighted-energy stability bound for leapfrog advection with second- and fourth-order stencils. A reference implementation reproduces the predicted convergence orders, conserves the discrete wave energy to a relative deviation of 10 −15 , separates stagnation from roundoff in bfloat16 arithmetic, and quantifies the benefit of harmonic face averaging across a discontinuous diffusivity. Measurements on a two-core CPU compare the formulation written in PyTorch, with and without graph compilation, against a NumPy baseline and the Devito stencil compiler, and place every implementation on a roofline built from measured bandwidth and throughput; all variants are memory bound, the compiled shift-based graph reaches about half of the Devito throughput, and the eager convolution primitive is the slowest option. The formulation expresses exact classical schemes in the frameworks' primitive set, so that their compilers, batching, and device support apply to the schemes without custom kernels. Mathematics Subject Classification (2020) 65M06; 65M12; 65Y10; 68T07; 35K20.

Read the paper

Discussion

Science Skim's AI key points, plus readers' public thoughts

Readers' thoughts

No reader thoughts yet.

Related papers

A convolutional formulation of explicit finite-difference schemes for variable-coefficient linear partial differential equations in machine-learning frameworks — Science Skim