Source-linked AI summary

XMDS2: Fast, scalable simulation of coupled stochastic partial differential equations

Graham R. Dennis, Joseph J. Hope, Mattias T. Johnsson

arXiv:1204.4255v2physics.comp-phquant-ph

TL;DR

Numerical simulation faces a trade-off between rapidly developed high-level descriptions and fast, customizable low-level implementations. XMDS2 uses XML problem descriptions to generate efficient C++ simulations, including parallel and stochastic systems, while supporting transitions across dimensionality and execution scale. Its spectral-method approach is broad but is constrained by lattice, boundary-condition, and smoothness requirements.

  • Problem

    Numerical integration requires choosing between easy-to-develop high-level tools and faster, more customizable low-level code.

  • Method

    XMDS2 translates XML descriptions of coupled differential-equation systems into fast C++ simulations with stochastic and parallel capabilities.

  • Results

    XMDS2 supports transitions from low- to higher-dimensional, deterministic to stochastic, and single-processor to distributed simulations with minimal input-script changes.

  • Takeaways & Limitations

    XMDS2 reduces development effort while producing code that is typically as fast as, or faster than, hand-written code.

  • Takeaways & Limitations

    Spectral methods are better suited to smooth solutions; shocks and spatial discontinuities are better handled by local numerical methods.

Abstract

from arXiv · show

XMDS2 is a cross-platform, GPL-licensed, open source package for numerically integrating initial value problems that range from a single ordinary differential equation up to systems of coupled stochastic partial differential equations. The equations are described in a high-level XML-based script, and the package generates low-level optionally parallelised C++ code for the efficient solution of those equations. It combines the advantages of high-level simulations, namely fast and low-error development, with the speed, portability and scalability of hand-written code. XMDS2 is a complete redesign of the XMDS package, and features support for a much wider problem space while also producing faster code.

Program summary

XMDS2 is implemented in Python and C++ for Unix-like systems, with memory use depending on the problem size.

  • XMDS2 uses Python and C++ and runs on Unix-like systems with a C++ compiler.The documented computer requirements include any Unix-like system and roughly 50 bytes per grid point, depending on the problem.

1. Introduction

XMDS2 addresses the trade-off between easy-to-develop high-level simulations and fast, customizable low-level code. Users describe differential-equation problems in XML, from which XMDS2 generates efficient C++ and optionally parallelized simulations across a broad problem space.

  • XMDS2 combines high-level development speed and reduced coding errors with the performance and customizability of low-level code.
  • Users describe initial-value ordinary and partial differential-equation systems in XML, and XMDS2 generates fast C++ simulations.The generated code is typically as fast as, or faster than, hand-written code while substantially reducing production time.
  • XMDS2 supports coupled, stochastic, multidimensional differential equations and can generate parallelized programs for modern architectures or distributed clusters.
  • The XMDS2 script is a self-contained XML language rather than editable shell code.
  • XMDS2 evolved from the original XMDS package, which was released in 1997 and later completely rewritten in Python while continuing to generate low-level C++.

2. Problem class

XMDS2 solves broad systems of initial-value differential equations, including coupled, multidimensional, integral, and stochastic systems. Its spectral methods provide efficient, accurate computation but require tensor-product lattices, compatible boundary conditions, and smooth solutions without spatial discontinuities.

  • XMDS2 solves initial-value differential equations with differing dimensions, integral couplings, and stochastic elements.These capabilities include coupling partial and ordinary differential equations and using moments or nonlocal quantities.
  • XMDS2 uses spectral methods on tensor-product lattices with boundary conditions compatible with the selected method.Supported boundary conditions include periodic, even, odd, and zero conditions.
  • Spectral methods represent solutions with global basis functions and are most accurate for smooth problems.
  • Problems with shocks or spatial discontinuities are better served by local finite-difference or finite-element methods.
  • Subject to these caveats, XMDS2 applies broadly and uses efficient, accurate algorithms.

3. Algorithms employed

XMDS2 combines spectral spatial discretisation, fast spatial-to-spectral transforms, parallel decomposition, and explicit or interaction-picture temporal integration. These algorithms support accurate derivatives, efficient transformations, distributed simulations, and reduced timestep dependence on spatial resolution.

  • Spectral spatial discretisation: XMDS2 uses spectral methods to represent solutions with basis functions and approximate spatial derivatives analytically.The solution is represented by coefficients in a spectral basis, linked to spatial values by linear transformations.
  • Spectral spatial discretisation: O(1/N^(N−k)) asymptotic error gives spectral spatial derivatives exponential convergence for a k-order derivative.Spectral methods use all grid points, so their effective order increases with the number of points.
  • Spectral spatial discretisation: Supported basis choices include Fourier, cosine, sine, Bessel, and Hermite-Gauss functions, with different boundary conditions and symmetry assumptions.XMDS2 permits different spectral methods in each dimension, including mixed decompositions such as Hermite-Gauss and Fourier.
  • Fast spatial-to-spectral transforms: O(N log N) one-dimensional transforms are available through FFTs, while parity-based PMMT reduces direct-transform cost to O(N^2/2).The parity-based reduction can significantly improve simulations dominated by spatial-to-spectral transforms, although it does not change overall scaling.
  • Parallelisation: Tensor-product lattices enable distributed parallelism by decomposing dimensions and linking them with distributed transpose operations.Factorisation makes transforms local along some dimensions, while transposition enables transforms across the distributed dimension.
  • Temporal integration: Interaction-picture integration makes the required timestep independent of spatial resolution, whereas explicit derivative calculation requires ∆t ∝1/N^2.The method solves the spatial derivative term exactly; Figure 3 reports that explicit-method step counts increase quadratically with resolution.

4. Examples

The examples show how XMDS2 scripts support nonlinear PDE simulation, dimensional extension, alternative transforms, parallel execution, non-local interactions, and stochastic noise. These changes are made by editing XML elements while XMDS2 generates the executable simulation code.

  • Nonlinear Schrödinger equation: A one-dimensional Bose–Einstein condensate simulation uses an adaptive fourth-fifth order Runge–Kutta method over one trap period.The simulation samples the wavefunction 50 times and outputs its real and imaginary parts at every grid point.
  • Script-based configuration: Changing domains, grid points, sampling, integration intervals, algorithms, or precision requires editing XML tags and regenerating the executable.The same workflow also supports extending the simulation in more complex ways.
  • Higher dimensions: A two-dimensional simulation requires adding dimensions, changing the sampling basis, and modifying the potential, initial condition, and kinetic-energy operator.The example adds a transverse coordinate and corresponding y-dependent terms.
  • Different transforms: Using a discrete cosine transform exploits symmetry about x = 0, requiring only half the interval and half the grid points for the same accuracy.The change is implemented by modifying the transverse_dimensions element.
  • MPI parallelization: Two- or higher-dimensional deterministic simulations and stochastic simulations can be parallelized by adding a distributed-mpi driver to the script.The runtime scaling of the deterministic example is illustrated with MPI on a computer and a supercomputer.
  • Non-local terms: XMDS2 represents non-local interactions as convolutions evaluated efficiently with fast Fourier transforms through computed_vector elements.The example uses this approach for an additional charged-particle potential.

5. Software used

XMDS2-generated simulations rely on external libraries for transforms, random numbers, communication, data handling, and special functions. The Python generator uses libraries for templating, parsing, XML processing, numerical computation, and array/data support.

  • C++ simulation libraries: Generated C++ simulations use FFTW3 for Fourier transforms and MPI distributed transpose operations.
  • C++ simulation libraries: Generated simulations use dSFMT for random-number generation, MPI for inter-process communication, and HDF5 for data input and output.
  • C++ simulation libraries: The generated simulations use the GNU Scientific Library for special-function evaluation.
  • Python generation libraries: XMDS2 uses Cheetah, pyparsing, lxml, h5py, mpmath, and numpy when generating simulations.

6. Conclusion

XMDS2 accelerates simulation development while preserving fast execution and a self-documenting workflow. Its minimal-change scaling supports experimentation across dimensions, stochasticity, and computing environments.

  • XMDS2 accelerates development, produces extremely fast code, and wraps output data with the XML used to generate it.
  • Minimal input-script changes support transitions from low-dimensional to higher-dimensional, deterministic to stochastic, and single-processor to distributed simulations.
  • Simpler test simulations can expose input-script problems quickly before scaling to the full problem.
  • The documentation, installers, and examples are available online and in the distribution's documentation directory.
Loading 1204.4255v2…