Skip to main content

Adaptive Fast Multipole Method with Laplace kernel in JAX.

Project description

jaxFMM

jaxFMM is an open source implementation of the Fast Multipole Method in JAX. The goal is to offer an easily readable/maintainable FMM implementation with good performance that runs on CPU/GPU and supports autodiff. This is enabled through JAX's just-in-time compiler.

Installation and Usage

jaxFMM depends only on JAX and can be installed from pypi or by downloading the source as follows:

pip install jaxfmm

If you want to run jaxFMM on GPUs, the easiest way is to use NVIDIA CUDA and cuDNN from pip wheels by instead typing:

pip install jaxfmm[cuda]

Using a custom, self-installed CUDA with jax is described in the JAX documentation.

The unitcube demo is a short and simple example demonstrating how to use jaxFMM.

Features

There are many flavors of FMM implementations. In short, jaxFMM currently:

  • only supports the Laplacian kernel.
  • only supports point charges.
  • uses real basis functions computed via recurrence relations.
  • uses "nested sum" O(p^4) M2M/M2L/L2L transformations.
  • uses a non-uniform 2^N-ary tree hierarchy (directly inspired by a work of A. Goude and S. Engblom), allowing arbitrary shape of the boxes in the hierarchy and guaranteeing balanced trees but requiring storage of interaction lists.
  • has jit-compiled functions and autodiff for every substep of the algorithm except for the generation of interaction lists.

In summary, jaxFMM in its current state can do adaptive point charge FMM for Laplace kernels with good performance for lower expansion orders (p <= 3), constant particle positions and reasonably homogenous distributions. For more details, consider reading the preprint on arXiv.

Citing

A preprint describing jaxFMM is available on arXiv, which can be cited with the following BibTeX entry:

@misc{kraft2025jaxfmmadaptivegpuparallelimplementation,
    title={jaxFMM: An Adaptive, GPU-Parallel Implementation of the Fast Multipole Method in JAX}, 
    author={Robert Kraft and Florian Bruckner and Dieter Suess and Claas Abert},
    year={2025},
    eprint={2511.15269},
    archivePrefix={arXiv},
    primaryClass={physics.comp-ph},
    url={https://arxiv.org/abs/2511.15269}, 
}

TODOs

jaxFMM is primarily developed for my PhD project, where I am working on a GPU FMM stray field evaluation routine for finite-element micromagnetics. Alongside the early state that it is in, this explains the feature set and design decisions mentioned above.

Contributions are always welcome however and improvements to jaxFMM are in development, such as:

  • faster rotation-based M2M/M2L/L2L transformations via on-the-fly Wigner matrix computation. This should improve jit-compilation times and runtimes, especially for higher expansion orders.
  • distributed parallelism via jax.sharding.
  • varying parameters locally for better performance.

Stray Field Evaluation

As mentioned above, jaxFMM is developed for rapid stray field evaluation in finite-element micromagnetics. The strayfield branch features stray field evaluation functions for P1-FEM meshes and the corresponding strayfield unitcube demo shows how they are used. Note that this is still work in progress and currently only gives accurate results for meshes of good quality (i.e. all tetrahedra have low aspect ratio).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxfmm-0.0.7.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxfmm-0.0.7-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file jaxfmm-0.0.7.tar.gz.

File metadata

  • Download URL: jaxfmm-0.0.7.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for jaxfmm-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e658e6c47abb101324e304a70516ae0bd94d70fa25487abe81f685812be84ec4
MD5 13d2f1ae5dbf51d08475f6b307b7e79d
BLAKE2b-256 7b1d8ac8324879718610106bcf3a7f5ea7610d5f36edf633853de3f5e35027ee

See more details on using hashes here.

File details

Details for the file jaxfmm-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: jaxfmm-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for jaxfmm-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d5dea0436be5299fc3dbb53f971c7dcf3b7732dba9da112f171af2684e9f8b
MD5 5dc9eaf29dd2beccc357988618282cad
BLAKE2b-256 1e9962829c365d6f1c47020aa8365aed630fdf2e5b5e5bb3592383eb326136db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page