Parallel and GPU accelerated code for phase-field and reaction-diffusion simulations
Steven A. Silber, Mikko Karttunen
TL;DR
SymPhas 2.0 addresses the need for high-performance, flexible phase-field and reaction-diffusion simulations by combining compile-time symbolic algebra with MPI CPU parallelization and a CUDA GPU backend. It extends the symbolic framework with directional derivatives, symbolic summation, tensor-valued expressions, and free-energy–based model definitions, while enabling compile-time generation of finite-difference stencils and semi-implicit Fourier spectral schemes. A major contribution is the automatic derivation of equations from free-energy functionals via symbolic differentiation, together with end-to-end GPU execution that preserves host-side modeling flexibility. Empirically, the approach delivers substantial speedups (up to around 1000×) for large-scale systems on GPU hardware, making large, complex multicomponent phase-field and reaction-diffusion simulations practical on modern HPC platforms; the code is open source for community use.
Abstract
We present SymPhas 2.0, a major update of the compile-time symbolic algebra simulation framework SymPhas for phase-field and reaction-diffusion models. This release introduces significant expansions and enhancements that enable the definition of a phase-field model directly from the free-energy functional via compile-time evaluated functional differentiation. It also introduces directional derivatives, symbolic summation, tensor-valued expressions, and compile-time derived finite difference stencils of arbitrary order and accuracy. Furthermore, the code has been parallelized for CPUs with MPI, and GPU computing has been added using CUDA (Compute Unified Device Architecture). For the latter, symbolic expressions are compiled into optimized CUDA kernels, allowing large-scale simulations to execute entirely on the GPU. For large systems ($32,768^2$ in 2D and $1,024^3$ in 3D with double precision), speedups up to $\sim \!\!1,000 \times$ were obtained compared to the first version of SymPhas using multi-threaded CPU execution on a single system. These developments establish SymPhas 2.0 as a flexible and scalable framework for efficient implementation of phase-field and reaction-diffusion models on GPU-based high-performance computing platforms.
