Skip to Content
PhysicsPhysics
  • Article
  • Open Access

7 May 2026

16 Pages

JefiFast: Accelerating Jefimenko’s Equations with Memory-Centric Optimizations and Multi-GPU Parallelism

,
,
,
,
,
and
College of Missile Engineering, Rocket Force University of Engineering, Xi’an 710025, China
*
Author to whom correspondence should be addressed.

Abstract

As a foundation for numerical solvers in computational electromagnetics, particularly for multiphysics and electromagnetic compatibility applications, Jefimenko’s equations offer a generalized solution to Maxwell’s equations, enabling the direct computation of electromagnetic fields from time-dependent source distributions without the boundary-condition artifacts inherent to grid-based methods. However, the numerical integration of these equations is computationally intensive, typically scaling as O ( N s N o ) for N s source points and N o observation points. In this paper, we present JefiFast, a highly optimized graphics processing unit (GPU) implementation that significantly outperforms the state-of-the-art JefiGPU algorithm. We identify that previous implementations are strictly memory-bound due to inefficient global memory transactions and a lack of data reuse. JefiFast addresses these bottlenecks through four key optimizations: (i) a packed memory layout (PML) using an array-of-structures approach to ensure coalesced memory access for source densities and their derivatives; (ii) geometry-aware shared memory tiling strategies that maximize L2 (level-2) cache hit rates and on-chip data reuse; (iii) pre-computation of time derivatives to minimize redundant arithmetic operations; and (iv) a robust observation domain decomposition strategy that enables linear scaling across multiple GPUs. Benchmarks demonstrate that JefiFast achieves speedups ranging from 4.08 times (for 30 3 grids on a single NVIDIA V100 graphic processor) to 84.51 times (for 50 3 grids on 4 NVIDIA V100 processors) compared to the baseline. Notably, for a 50 3 grid on a single GPU, JefiFast reduces execution time from about 51 min to just about 2.6 min ( 19.54 times speedup). These performance advances make high-resolution relativistic heavy-ion collision simulations feasible in near real-time.

1. Introduction

The numerical solution of classical electromagnetic fields is a cornerstone of computational physics, essential for simulating phenomena ranging from plasma dynamics to relativistic heavy-ion collisions. Traditionally, Maxwell’s equations are solved using grid-based differential methods, such as the finite element method (FEM) [1,2], the finite-difference time-domain (FDTD) method [3,4,5], or hybrid approaches [6]. While robust, these techniques often require complex mesh generation and rigorous boundary conditions (for instance, perfectly matched layers) to prevent artificial reflections, which can be computationally prohibitive for open-boundary problems.
The integral solution to Maxwell’s equations, known as Jefimenko’s equations [7,8], offers a distinct advantage over grid-based methods. By directly calculating fields from charge ( ρ ) and current ( J ) densities using retarded time, Jefimenko’s equations inherently satisfy open boundary conditions. This makes them especially suitable for multi-scale problems where the observer is far from the source, such as calculating electromagnetic fields for radio emissions from atmospheric streamers [9].
However, the numerical cost of these integrals scales with the product of source and observation points ( N s × N o ), creating a massive computational bottleneck. Furthermore, the temporal dimension adds significant complexity: because the retarded time t r = t − | r − r ′ | / c (with r the observation field point and c the speed of light) varies for every source–observer pair, the interaction matrix becomes dense and irregular. For instance, a modest 3D grid of size 50 3 for both sources and observers over 100 time steps requires evaluating over 1.5 × 10 12 interactions.
To address this, JefiGPU [10] was introduced as a Python coding based implementation that offloads the integration to graphics processing units (GPUs). This acceleration enabled new classes of simulation, most notably JefiPIC [11], a 3D particle-in-cell code that mitigates grid-heating artifacts by using Jefimenko’s exact integrals. Despite this success, the computational demands of JefiGPU remain prohibitive for large-scale parameter scans. For example, processing a 50 3 grid for 410 time steps takes approximately one hour on a single NVIDIA V100 GPU. As grid dimensions exceed 100 3 , computational costs in frameworks like JefiPIC increase drastically [11]. While machine learning approximations like JefiAtten [12] offer speed, they cannot always guarantee the rigorous error bounds required for precision physics.
Therefore, there is a critical need for a numerically exact solver capable of maximizing the hardware throughput of modern GPUs. In this paper, we present JefiFast, a highly optimized implementation of Jefimenko’s equations that significantly outperforms the original JefiGPU. The architectural analysis suggests that previous approaches were likely limited by memory latency and introduce several key optimizations.
  • A packed memory layout (PML) that utilizes an array-of-structures (AoS) approach to ensure coalesced memory access for source densities and their derivatives.
  • Shared memory tiling strategies to maximize cache reuse.
  • Reduced thread computation by minimizing redundant calculations within each GPU thread.
  • Multi-GPU observation domain decomposition to allow for linear scaling across hardware resources.
The benchmarks obtained demonstrate that JefiFast speeds up field calculations by a significantly large margin on standard test cases without compromising numerical accuracy. This performance leap makes it feasible to couple Jefimenko solvers with real-time relativistic transport codes like RBG (relativistic Boltzmann equations on GPUs) for large-scale production runs.

2. Jefimenko’s Equations and Discretization

To maintain consistency with the application domain of relativistic heavy-ion collisions and the previous JefiGPU implementation [10], we adopt natural units (specifically the rationalized Heaviside–Lorentz convention):  ℏ = c = k B = ϵ 0 = μ 0 = 1 for the reduced Planck constant, the speed of light, the Boltzmann constant, the vacuum pemitivity, and the vacuum permeability, respectively.
Under these conventions, Jefimenko’s equations for the electric field E and magnetic field B simplify to
E ( r , t ) = 1 4 π ∫ V ρ ( r ′ , t r ) R 3 R + ρ ˙ ( r ′ , t r ) R 2 R − J ˙ ( r ′ , t r ) R , d 3 r ′ ,
B ( r , t ) = 1 4 π ∫ V J ( r ′ , t r ) × R R 3 + J ˙ ( r ′ , t r ) × R R 2 d 3 r ′ ,
where R = r − r ′ , R = | R | , and the retarded time is just t r = t − R (since c = 1 ). Here, ρ ˙ and J ˙ denote partial derivatives with respect to time evaluated at t r . The integration is performed over the volume V containing the source distributions ρ and J .
For numerical implementation, we discretize the source volume V into a grid of cells with volume Δ V . Following the approach in JefiGPU [10], the continuous integrals are replaced by summations over the source grid points indexed by j. The time derivatives ρ ˙ and J ˙ are approximated using backward finite differences with a time step Δ t .
The discretized equations for the electric and magnetic fields at an observation point r are
E ( r , t ) ≈ Δ V 4 π ∑ j [ R j R j 3 ρ ( r j ′ , t r ) + R j R j 2 ρ ( r j ′ , t r ) − ρ ( r j ′ , t r − Δ t ) Δ t − 1 R j J ( r j ′ , t r ) − J ( r j ′ , t r − Δ t ) Δ t ] ,
B ( r , t ) ≈ Δ V 4 π ∑ j [ J ( r j ′ , t r ) × R j R j 3 + 1 R j 2 J ( r j ′ , t r ) − J ( r j ′ , t r − Δ t ) Δ t × R j ] ,
where R j = r − r j ′ is the vector from the jth source point to the observation point, R j = | R j | , and the retarded time is t r = t − R j . The summation runs over all source grid cells.
Given the discretized Equations (3) and (4), the computational complexity per time step is O ( N s N o ) . However, the original JefiGPU implementation faces several critical hardware-specific bottlenecks beyond pure arithmetic intensity. First, the dependency of t r on the distance R j creates irregular memory access patterns; combined with a non-optimized data layout, this forces the GPU to perform multiple, non-coalesced global memory transactions to retrieve ρ , J , and their derivatives for a single interaction. Second, the absence of shared memory tiling prevents efficient data reuse, causing the solver to be severely bound by global memory latency. Third, redundant arithmetic operations within individual threads limit the effective compute throughput. Finally, the lack of a distributed domain decomposition (ODD) strategy restricts the simulation scale to the memory capacity of a single GPU. Section 3 details how JefiFast addresses these four limitations to maximize hardware utilization.

3. Methodology and Optimization

To overcome the performance limitations of previous implementations, JefiFast introduces a redesigned computational architecture focused on maximizing memory bandwidth utilization and instruction throughput. This section details the four primary optimization strategies: the PML, geometry-aware shared memory tiling, pre-computation with kernel fusion, and scalable domain decomposition.

3.1. Packed Memory Layout (PML)

One of the most significant bottlenecks in Jefimenko solvers is the memory access pattern required to retrieve source terms at the retarded time t r . In the standard structure-of-arrays (SoA) layout used by JefiGPU, the physical quantities ( ρ , J ) and their time derivatives are stored in separate global memory arrays.
Because t r varies for every source–observer pair, the memory access is non-sequential. Therefore, the data structure is accessed in a scattered manner, leading to multiple uncoalesced memory transactions (Figure 1). To evaluate Equations (3) and (4), a single thread must issue distinct load instructions for ρ and components of J . JefiFast implements a PML using an AoS approach. We define a composite data structure containing all necessary source terms for a single space–time point:
S ( x , y , z , t ) = { ρ , J x , J y , J z } .
The structures defined in Equation (5) are stored contiguously in global memory. When a thread requests the charge density ρ at a specific retarded time, the GPU’s memory controller fetches a 128-byte aligned cache line. In our packed layout, this single transaction automatically retrieves the associated current densities required for the same calculation, which is intended to improve L2 cache utilization by consolidating related data into a single memory transaction.
Figure 1. Comparison of memory layouts for Jefimenko’s equations. Upper (baseline): structure-of-arrays (SoA) requires four separate global memory loads to retrieve charge and density components { ρ , J x , J y , J z } at retarded time t r , leading to memory access patterns that typically result in uncoalesced global memory transactions. Lower (JefiFast): packed memory layout (PML) stores all source terms contiguously in an array-of-structures (AoS) format, enabling a single 128-byte cache-line fetch to retrieve the complete data needed for one interaction.

3.2. Geometry-Aware Shared Memory Tiling

While PML optimizes the retrieval of time-dependent physics data, the retrieval of source coordinates ( r ′ ) also consumes significant bandwidth. JefiFast utilizes shared memory tiling to optimize these geometric access patterns.
We partition the source volume into blocks (tiles) of size T (typically integer multiples of 32). The integration proceeds tile-by-tile.
  • Collaborative Loading. Threads within a CUDA block collaborate to load the coordinates ( x ′ , y ′ , z ′ ) of the current source tile from global memory into on-chip shared memory.
  • Synchronization. A syncthreads() routine barrier ensures the geometric tile is fully populated.
  • Computation. Each thread iterates through the cached coordinates in shared memory to compute the distance R = | r − r ′ | .
Crucially, because the source positions are time-invariant and shared across all observation points in a block, moving them to shared memory is designed to reduce the volume of global memory traffic (Figure 2). The time-dependent data from Equation (5) is then fetched from global memory (accelerated by PML) using the distance computed from the shared memory tile.
Figure 2. Shared memory tiling strategy in JefiFast.

3.3. Pre-Computation and Kernel Fusion

A major inefficiency in the baseline JefiGPU implementation arises from the on-the-fly reconstruction of simulation data within the critical path. The baseline kernel repeatedly performs two costly operations for every observer–source pair: (i) mapping 1D memory indices to 3D physical coordinates, and (ii) calculating finite difference time derivatives.
JefiFast addresses these bottlenecks by decoupling data generation from the integration process.
  • Coordinate Pre-computation. In the baseline, converting a linear thread index to a physical position ( x , y , z ) required expensive integer division and modulus operations (to unravel the 3D index) followed by floating-point arithmetic. JefiFast performs this mapping once during initialization, storing the explicit coordinate arrays in global memory. The solver kernel simply loads the pre-calculated positions, eliminating the arithmetic overhead of grid generation inside the O ( N o × N s ) loop.
  • Derivative Pre-computation ( O ( N s ) ). We introduce a lightweight update kernel that runs once per time step. It computes the time derivatives for charge and current densities (for example, ρ ˙ ≈ [ ρ ( t ) − ρ ( t − Δ t ) ] / Δ t ) and stores them alongside the raw values. This optimization eliminates four divisions and four subtractions per interaction and reduces register pressure by removing the need to fetch data from the previous time step ( t − Δ t ) during the integration phase.
Figure 3 illustrates the GPU memory hierarchy and data flow in JefiFast.
Figure 3. GPU memory hierarchy and data flow in JefiFast. Memory hierarchy shown from slowest (top) to fastest (bottom). Each level has decreasing latency and capacity highly degrading from host level to global level to L2 cache and finally to registers.

3.4. Multi-GPU Observation Domain Decomposition

To scale beyond a single device, we employ an ODD strategy. The total volume of observation points V O is partitioned into N GPU sub-volumes (Figure 4). Each GPU maintains a full copy of the source history but computes fields only for its assigned slice of observation points.
Figure 4. Multi-GPU observation domain decomposition strategy in JefiFast. The source volume (containing ρ and J for all timesteps and N s points) is replicated across all GPUs. The observation volume is partitioned into N GPU equal slices, with each GPU computing electromagnetic fields for its assigned subset of N o / N GPU observation points. If an observation slice exceeds GPU VRAM, automatic batching streams results to/from host memory.
Furthermore, to handle cases where the observation grid exceeds the available VRAM of a single GPU, JefiFast implements an intelligent batching mechanism. The solver automatically detects memory constraints and subdivides the observation slice into smaller batches, streaming results back to the host memory sequentially. This allows for the simulation of arbitrarily large observation grids limited only by host RAM, not GPU VRAM.

4. Correctness Validation of JefiFast

Before comparing with JefiGPU, we have first conducted a validation test to ensure the correctness of the implementation used.
Assuming there is an oscillating electric dipole located at the origin,
p ( t ) = p 0 cos ( ω t ) z ^ ,
wherein p ( t ) is the instantaneous electric dipole moment vector, p 0 is its amplitude, ω is the angular frequency, and z ^ is the unit vector in the z-direction. The formula (6) corresponds to two point charges ± q separated by distance d, oscillating such that p 0 = q d .
In discrete grid representation, one can approximate this asa relatively small region
  • at z = + δ / 2 with charge density ρ ( t ) = ρ 0 cos ( ω t ) or
  • at z = − δ / 2 with charge density ρ ( t ) = − ρ 0 cos ( ω t ) .
For observation points in the far-field ( r ≫ λ = 2 π / ω ), the fields are
E ( r , t ) = ω 2 p 0 4 π ϵ 0 c 2 r sin θ cos ω ( t − r / c ) θ ^ ,
B ( r , t ) = ω 2 p 0 4 π ϵ 0 c 3 r sin θ cos ω ( t − r / c ) ϕ ^ ,
where r represents the distance from the origin, θ is the angle from the z-axis, and ( θ ^ , ϕ ^ ) are the unit vectors’ spherical coordinates.
Thus,
E = ω 2 p 0 sin θ cos ( ω t r ) 4 π r cos θ cos ϕ x ^ + cos θ sin ϕ y ^ − sin θ z ^ ,
B = ω 2 p 0 sin θ cos ( ω t r ) 4 π c r − sin ϕ x ^ + cos ϕ y ^ .
We used grid sizes of 7 3 , 11 3 , 15 3 , 21 3 , and 31 3 for comparison between the implementation we have applied and the analytical results. Figure 5 well visualizes quite a high level of agreement between the implementation and the analytical solution, with the relative errors of less than 1% for all grid sizes, validating the correctness of the implementation we apply.
Figure 5. Comparison of JefiFast results with analytical solution for an oscillating electric dipole source.
For other grid sizes, the results are shown in Figure 6. It is apparent that the relative errors are quite small for different grid sizes. But the convergence cannot be seen from Figure 6. This is not surprising because float32 format is used in the implementation, and the numerical errors are dominated by the precision rather than the grid resolution. We show the convergence below.
Figure 6. Convergence study of JefiFast results against analytical solution for the oscillating electric dipole source.

5. Performance Benchmarks and Validation

To evaluate the efficiency and accuracy of JefiFast, we have conducted a series of benchmarks comparing it against the original JefiGPU implementation. All experiments were performed on a computing node equipped with 4 × NVIDIA Tesla V100 GPUs (16 GB VRAM each). The original JefiGPU code is obtained from the public repository [13]. While JefiGPU allows for multi-GPU scaling via the Ray library [14], it requires manual handling of the Ray API. JefiFast only depends on the Numba library [15] for multi-GPU support, simplifying deployment. To facilitate comparison, we ran JefiGPU on a single GPU, whereas JefiFast was tested on both single and multiple GPUs.

5.1. Experimental Setup

To ensure a fair comparison and maintain numerical stability, JefiFast adopts several specific implementation strategies. All experimental settings, including data types (single precision), grid sizes, and time steps, are kept identical to the original JefiGPU implementation.
First, we employed a coarse screening technique [16] to avoid numerical divergence at R = 0 in overlapping source and observation regions. Specifically, source and observer grid pairs that fall within a defined distance threshold were omitted from the summation. While this prevents infinite field values, it implies that highly near-field physics (within a single grid cell) is not explicitly resolved.
Second, to maintain causality, source contributions were only calculated for t r ≥ 0 . Any source points for which the retarded time is negative—indicating the signal has not yet reached the observer—were skipped. To optimize memory throughput, the continuous retarded time t r was mapped to the discrete source history via truncation to the nearest integer index. These choices represent a deliberate trade-off between absolute numerical precision and the computational efficiency required for large-scale GPU acceleration. For further implementation specifics, let us refer to the JefiFast source code repository [17].
For fair comparison, we have adopted the same two source distributions as used in the original JefiGPU study [10,13].

5.1.1. Constant Source

A step-function distribution where ρ and J are activated at t = 0 and remain constant. This tests the solver’s ability to handle static field saturation. For constant source, the source and observation regions are overlapped to validate the capability of handling near-field contributions. By changing the numbers of grids, one can obtain different scales of fields. The integration domain is [ − 3 GeV − 1 , 3 GeV − 1 ] 3 . The detail expression of ρ and J are
ρ ( x , y , z , t ) = 0 if t < 0 , 1 if t ≥ 0 ; J ( x , y , z , t ) = 0 if t < 0 , 1 if t ≥ 0 ,
where 0 = ( 0 , 0 , 0 ) and 1 = ( 1 , 1 , 1 ) .

5.1.2. Sinusoidal Source

A time-varying distribution ρ and J to stress the retardation logic as fields fluctuate continuously. Two different domains for the source and observational regions are chosen for field calculation without scanning the distance. The observational region is [ − 3 GeV − 1 , 3 GeV − 1 ] 2 × [ 10 GeV − 1 , 16 GeV − 1 ] , where [ 10 GeV − 1 , 16 GeV − 1 ] is the interval in the z direction and the source region is [ − 3 GeV − 1 , 3 GeV − 1 ] 3 . The detailed expression of ρ and J are
ρ ( x , y , z , t ) = 0 if t < 0 , 3 ( cos ( t ) − 1 ) cos ( x + y + z ) if t ≥ 0 ; J ( x , y , z , t ) = 0 if t < 0 , ( j x , j y , j z ) if t ≥ 0 ,
where j x = j y = j z = sin ( x + y + z ) sin ( t ) . Equation (8) satisfies the continuum relation ∇ · J + ∂ ρ / ∂ t = 0 .
For all tests, the source grid resolution matches the observation grid resolution ( N s = N o ). To follow the original JefiGPU setup, we used 410 time snapshots ranging from t = 0 to t = 20.5 GeV − 1 with a time step of Δ t = 0.05 GeV − 1 . By leveraging different numbers of N s , different scales of integration results can be obtained.

5.2. Numerical Validation

To ensure a consistent comparison with the original study, we have adopted the error analysis methodology defined in JefiGPU [10]. We quantified the accuracy by calculating the Euclidean norm of the deviation vector between the JefiFast results ( F fast ) and the baseline reference ( F base ), with F representing E or B . Let us note that in Ref. [10], the z-component of the fields was neglected for numerical convenience.
Let F i , n denote the field vector at observational spatial grid index i and time step t i , where i ∈ { 1 , … , N o } and t i ∈ { 1 , … , T } . The pointwise deviation δ i , t i and the aggregate error metrics are defined as follows:
δ i , t i = F base , i , t i − F fast , i , t i 2 ,
E max = max i , t i ( δ i , t i ) , E mean = 1 T · S ∑ t i = 1 T ∑ i = 1 S δ i , t i , E rel = E max max i , t i ∥ F base , i , t i ∥ .
Table 1 and Table 2 summarize the error metrics E max , E mean , and E rel for different numbers of grids ( N o ). The results indicate that E max generally falls within the range of 10 − 1 to 10 − 3 , with larger values of N o leading to smaller errors. This suggests that for both JefiGPU and JefiFast, employing at least a moderate number of grids is beneficial for obtaining higher accuracy. A similar trend is observed for the other metrics, where E mean ranges from 10 − 4 to 10 − 5 and E rel ranges from 10 − 2 to 10 − 3 . These results confirm that JefiFast retains the single-precision accuracy of the original solver and also validate the convergence of JefiFast.
Table 1. Validation results using the error norms defined in Equation (10) for the constant source test case.
Table 2. Validation results using the error norms defined in Equation (10) for the sinusoidal source test case.

5.3. Performance and Scaling

Having established the accuracy of the proposed method, the computational performance of JefiFast is now compared against the original JefiGPU implementation. Table 3 details the execution times and speedups measured on a single NVIDIA V100 GPU and four NVIDIA V100 GPUs.
Table 3. Performance comparison of JefiGPU (Baseline) versus JefiFast (proposed). Speedup is calculated as baseline time divided by JefiFast time. JefiFast-1 and JefiFast-4 denote single-GPU and four-GPU executions, respectively.

5.3.1. Single-GPU Performance

For a grid size of 30 3 , JefiFast achieves speedups of 6.87 times and 6.31 times for constant and sinusoidal sources, respectively. The performance advantage was observed to become increasingly pronounced as the problem size grows; at a grid size of 50 3 , the speedups rise to 19.54 times and 26.73 times. This substantial scaling improvement highlights the effectiveness of the memory access method utilized in JefiFast. As larger grids demand higher memory transaction rates, the baseline JefiGPU typically encounters bandwidth bottlenecks due to inefficient access patterns. In contrast, JefiFast maintains reletrively high throughput by leveraging coalesced reads and optimizing cache reuse.

5.3.2. Multi-GPU Scaling

For a small number of grids, such as 15 3 , 20 3 and 30 3 , the overhead of inter-GPU communication and kernel launch latency limits the benefits of parallelization. However, as the grid size increases to 40 3 and 50 3 , JefiFast demonstrates near-linear strong scaling on four GPUs. For the large-scale 50 3 case, using four GPUs reduces the execution time from 156.70 s (single GPU JefiFast) to 50.93 s (four-GPU JefiFast, speedup 3.10 times), or 3061.98 s (JefiGPU) to 50.93 s (speedup 60.12 times) for constant source. Similarly, for sinusoidal source at 50 3 , the time decreases from 106.62 s (single GPU JefiFast) to 33.73 s (four-GPU JefiFast, speedup 3.19 times), or from 2850.47 s (JefiGPU) to 33.73 s (speedup 84.51 times).
Once N s = N o = 100 3 , for JefiGPU, the execution times for constant and sinusoidal sources are estimated to be 1.26 × 10 6 s and 5.52 × 10 5 s, respectively, based on the observed scaling trends (Figure 7). However, the predicted execution times for JefiFast are only 8.87 × 10 3 s (constant source) and 5.38 × 10 3 s (sinusoidal source) on a single GPU (Figure 8). According to Table 3, JefiFast is approximately three times faster when running on four GPUs compared to a single GPU. Thus, one can anticipate that when utilizing four GPUs, these times further reduce to 2.96 × 10 3 s and 1.79 × 10 3 s, respectively. Interestingly, the real execution times of JefiFast on 100 3 with four GPUs are found to be 2.21 × 10 3 s (constant source) and 1.53 × 10 3 s (sinusoidal source), which happen to be even faster than the predicted values. Table 4 summarizes the performance comparison at this scale, revealing speedups of 570.14 times and 360.78 times for constant and sinusoidal sources, respectively.
Figure 7. Execution times of JefiGPU on N s = N o = 100 3 for constant (left) and sinusoidal (right) sources, extrapolated from benchmark data.
Figure 8. Execution times of JefiFast on N s = N o = 100 3 for constant and sinusoidal sources, extrapolated from benchmark data.
Table 4. Performance comparison of JefiGPU (baseline) versus JefiFast (proposed) on N s = N o = 100 3 grids. Note that JefiGPU time is predicted based on extrapolation from smaller grid sizes. Speedup is calculated as baseline time divided by JefiFast-4 (four-GPU execution) time.
The parallel efficiency is found to make JefiFast suitable for large-scale simulations that require high-resolution field evaluations. The results demonstrate that JefiFast effectively alleviates the Jefimenko solver’s memory-latency-bound problem. To further improve the computational capacity, JefiFast is designed to automatically detect the number of available GPUs and configures the domain decomposition without further outside intervention.

5.4. Ablation Study Analysis

To isolate the factors contributing to the performance improvements, we applied optimizations incrementally. Table 5 details the execution time and stepwise speedup after each stage.
  • Pre-computation. The initial strategy attempted to offload arithmetic from the main loop by pre-computing coordinate mappings and derivatives. However, this resulted in a performance regression, yielding speedups of only 0.44 (constant) and 0.72 (sinusoidal) times for N o = 40 3 . These results highlight a critical hardware trade-off: we effectively replaced inexpensive, register-based arithmetic instructions with high-latency global memory transactions. These results support the hypothesis that the baseline implementation is primarily limited by memory bandwidth rather than computational throughput.
  • Packed Memory Layout. Reorganizing the data structures to ensure coalesced global memory access yielded the most significant single performance recovery (1.80 and 3.08 times stepwise speedup). This validates our hypothesis that memory bandwidth is the primary bottleneck. Crucially, when the packed layout is combined with pre-computation, the cumulative speedups surge to 3.21 (constant) and 10.23 (sinusoidal) times. These results demonstrate that pre-computation becomes beneficial only when the memory subsystem is optimized; the packed layout increases effective bandwidth enough to accommodate the additional data streams required by the pre-computed derivatives.
  • Shared Memory Tiling. Finally, to further mitigate the bandwidth bottleneck, we have introduced cache blocking via shared memory. This optimization drastically reduced the frequency of global memory transactions by maximizing data reuse within the streaming multiprocessors (SMs). Consequently, substantial additional speedups of 2.31 (constant) and 3.52 (sinusoidal) times were observed, shifting the kernel’s balance toward higher computational throughput.
Table 5. Ablation study of JefiFast optimizations ( N s = N o = 40 3 ) for pre-computation (①), packed memory layout (②) and shared memory tilling (③) stages (see text for details). Note the synergy between ① and ②: pre-computation only yields performance gains when coupled with optimized memory layout.

6. Potential for Real-Time Coupling with Kinetic Transport

The primary motivation for developing JefiFast is to provide a feasible path toward self-consistent simulations of relativistic heavy-ion collisions. In these high-energy systems, the electromagnetic fields generated by the plasma are expected to significantly influence the dynamics of charged particles (the quark–gluon plasma).
Traditionally, kinetic transport codes (such as RBG [10]) relied on Jefimenko solvers to update fields at discrete time steps. However, the computational cost of the original JefiGPU implementation represented a significant bottleneck. For a typical simulation grid of 50 3 , the field evaluation alone required nearly an hour per time step on a single GPU. Given that a meaningful physical evolution requires hundreds or thousands of time steps, this latency has historically made self-consistent field feedback computationally challenging.
With the performance improvements achieved by JefiFast, the calculation time for a 50 3 grid is reduced to approximately 50 s (using four GPUs) or 2.5 min (using one GPU). This enhancement suggests that the field solver’s runtime may be brought into closer parity with particle transport steps. Consequently, JefiFast offers a promising framework for future coupling with relativistic transport modules. This could potentially allow for high-resolution studies of phenomena such as the chiral magnetic effect and plasma instabilities, providing a higher-fidelity alternative to approximate field models in future production-scale workflows.

7. Conclusions

In this paper, we presented JefiFast, an optimized GPU-accelerated numerical solver for Jefimenko’s equations. The architectural analysis presented suggests that previous implementations were limited by memory latency due to the non-sequential access patterns inherent to retarded time integration.
By implementing a PML, we designed the data structures to facilitate more efficient coalesced access to physical source terms. We further optimized performance through geometry-aware shared memory tiling to improve data reuse and by pre-computing time derivatives to reduce redundant thread arithmetic. Finally, we introduced an ODD scheme with memory batching, which demonstrates near-linear scaling across multi-GPU systems in the tests performed.
The benchmarks obtained show a speedup of up to 60.7 times compared to the previous JefiGPU code. This performance improvement significantly reduces the computational overhead of integral-based electromagnetism, suggesting that exact, open-boundary field solutions may become a competitive alternative to grid-based differential methods for certain large-scale physics problems.
While JefiFast represents a significant performance leap, the O ( N s N o ) computational complexity remains a fundamental scaling limitation of direct Jefimenko solvers. In the future work, we consider focusing on exploring algorithm-level optimizations to reduce this scaling and on demonstrating the solver’s stability within fully coupled, production-scale kinetic transport simulations.

Author Contributions

Conceptualization, B.H. and X.S.; methodology, B.H., S.P. and N.S.; software, S.P., N.S. and G.L.; validation, G.L. and X.Z.; formal analysis, P.X.; writing—original draft preparation, B.H. and S.P.; writing—review and editing, N.S. and X.S.; visualization, G.L.; supervision, X.S.; funding acquisition, B.H. and S.P. All authors have read and agreed to the published version of the manuscript.

Funding

This work is supported by National Key Laboratory of Intense Pulsed Radiation Simulation and Effect, China (Grant No. NKLIPR2310).

Data Availability Statement

The code is available at the JefiFast source code repository [17].

Acknowledgments

We would like to thank the support from Junjie Zhang and Mingyan Sun for their kind help on reproducing the JefiGPU code.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AoSarray-of-structures
APIapplication programming interface
CUDACompute Unified Device Architecture
FDTDfinite-difference time-domain (method)
FEMfinite element method
float32single-precision floating-point computer number of 32 bits
GPUgraphic processing unit
L2level 2
NVIDIANvidia (stylized)
ODDobservation domain decomposition
PICparticle-in-cell (programming code)
PMLpacked memory layout
RAMrandom-access memory (data storage device)
RBGrelativistic Boltzmann equations on GPUs
SMstreaming multiprocessor
SoAstructure-of-arrays
VRAMvideo RAM
V100version 100
1D, 3D1-, 3-dimensional

References

  1. Assous, F.; Degond, P.; Heintze, E.; Raviart, P.A.; Segré, J. On a finite-element method for solving the three-dimensional Maxwell equations. J. Comput. Phys. 1993, 109, 222–237. [Google Scholar] [CrossRef] [Scilit]
  2. Monk, P. Analysis of a finite element method for Maxwell’s equations. SIAM J. Numer. Anal. 1992, 29, 714–729. [Google Scholar] [CrossRef] [Scilit]
  3. Yee, K.S.; Chen, J.S. The finite-difference time-domain (FDTD) and the finite-volume time-domain (FVTD) methods in solving Maxwell’s equations. IEEE Trans. Anten. Propag. 2002, 45, 354–363. [Google Scholar] [CrossRef] [Scilit]
  4. Teixeira, F.; Sarris, C.; Zhang, Y.; Na, D.Y.; Berenger, J.P.; Su, Y.; Okoniewski, M.; Chew, W.; Backman, V.; Simpson, J.J. Finite-difference time-domain methods. Nat. Rev. Meth. Prim. 2023, 3, 75. [Google Scholar] [CrossRef] [Scilit]
  5. Yee, K. Numerical solution of initial boundary value problems involving Maxwell’s equations in isotropic media. IEEE Trans. Anten. Propag. 1966, 14, 302–307. [Google Scholar]
  6. Teixeira, F.L. Time-domain finite-difference and finite-element methods for Maxwell equations in complex media. IEEE Trans. Anten. Propag. 2008, 56, 2150–2166. [Google Scholar] [CrossRef] [Scilit]
  7. Griffiths, D.J. Introduction to Electrodynamics; Cambridge University Press: Cambridge, UK, 2023. [Google Scholar] [CrossRef] [Scilit]
  8. Jefimenko, O.D. Presenting electromagnetic theory in accordance with the principle of causality. Eur. J. Phys. 2004, 25, 287. [Google Scholar] [CrossRef] [Scilit]
  9. Malla, H.; Guo, Y.; Hare, B.M.; Cummer, S.; Malagón-Romero, A.; Ebert, U.; Nijdam, S.; Teunissen, J. Calculating radio emissions of positive streamer phenomena using 3D simulations. J. Geophys. Res. Atmos. 2024, 129, e2024JD041385. [Google Scholar] [CrossRef] [Scilit]
  10. Zhang, J.J.; Chen, J.N.; Peng, G.L.; Du, T.J.; Xie, H.Y. JefiGPU: Jefimenko’s equations on GPU. Comput. Phys. Commun. 2022, 276, 108328. [Google Scholar] [CrossRef] [Scilit]
  11. Chen, J.-N.; Zhang, J.-J.; Li, X.-M.; Qiao, H.-L.; Zhao, Y.-T. JefiPIC: A 3-D full electromagnetic particle-in-cell simulator based on Jefimenko’s equations on GPU. Commun. Comput. Phys. 2024, 35, 1387–1417. [Google Scholar] [CrossRef] [Scilit]
  12. Sun, M.Y.; Xu, P.; Zhang, J.J.; Du, T.J.; Wang, J.G. JefiAtten: An attention-based neural network model for solving Maxwell’s equations with charge and current sources. Mach. Learn. Sci. Technol. 2024, 5, 035055. [Google Scholar] [CrossRef] [Scilit]
  13. Zhang, J.-J.; Chen, J.-N.; Peng, G.-L.; Du, T.-J.; Xie, H.-Y. Jefimenko’s Equations on GPU. Version 1.0: Code. Available online: https://codeocean.com/capsule/0744578/tree/v1 (accessed on 26 March 2026).
  14. Moritz, P.; Nishihara, R.; Wang, S.; Tumanov, A.; Liaw, R.; Liang, E.; Elibol, M.; Yang, Z.; Paul, W.; Jordan, M.I.; et al. Ray: A distributed framework for emerging AI applications. In OSDI’18: Proceedings of the 13th USENIX Conference on Operating Systems Design and Implementation; Arpaci-Dusseau, A., Voelker, G., Eds.; USENIX Association: Berkeley, CA, USA, 2018; pp. 561–577. Available online: https://dl.acm.org/doi/10.5555/3291168.3291210 (accessed on 26 March 2026).
  15. Lam, S.K.; Pitrou, A.; Seibert, S. Numba: A LLVM-based Python JIT compiler. In LLVM’15: Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC; Finkel, H., Ed.; Association for Computing Machinery: New York, NY, USA, 2015; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  16. Peskin, M.E. An Introduction to Quantum Field Theory; CRC Press/Taylor & Francis Group: Boca Raton, FL, USA, 2018. [Google Scholar] [CrossRef] [Scilit]
  17. JefiFast: Accelerating Jefimenko’s Equation with Memory-Centric Optimizations and Multi-GPU Parallelism. Available online: https://github.com/Jerry-peng03/JefiFast (accessed on 26 March 2026).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.