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 point charges and the Laplacian kernel.
  • uses real basis functions computed via recurrence relations.
  • uses rotation-based O(p^3) M2M/M2L/L2L transformations by computing rotation matrices on-the-fly with fast recursions.
  • 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 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. This explains the feature set and design decisions mentioned above.

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

  • distributed parallelism via jax.sharding.
  • varying parameters locally for better performance (particularly the number of splits per axis and level).
  • investigating kernel-independent/volume FMM.

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.1.1.tar.gz (22.5 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.1.1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jaxfmm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b7c460437f5f0b257295c2181a87a5326ec69fb8a4fa9a6d997589e4a4cc6d22
MD5 3b9a6afec67916279d2b426a16fd412f
BLAKE2b-256 cbb8ee172bd868853e96bdf1f1f4f53ea4f68759d9f91c9625e9180e44992acb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaxfmm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2904852f6d743e02ff6376e98de9320f8f8c685390a4748ecf829e118eab8ba0
MD5 853d6c637adf9c6da043479777682446
BLAKE2b-256 a0552383efc6b12198b74f6789270d30e3161f1983db8014d74bfcf0a4c5bb4d

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