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.
  • only supports evaluation positions that are the same as the source positions.
  • 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 this 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) and reasonably homogenous distributions. Autodiff only works if the particle positions remain constant. A first benchmark of uniformly distributed charges in the unit cube, computed on Google Cloud g2-standard-8 (GPU timings) and c3d-highmem-16 (CPU timings) machines can be found below:

unitcube benchmark

TODOs

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

Contributions are always welcome however, and I plan to still improve jaxFMM. Topics that come to mind here are:

  • volume FMM.
  • other kernels or even a kernel-independent formulation.
  • independent evaluation and source positions.
  • distributed parallelism via jax.sharding.
  • faster M2M/M2L/L2L transformations.
  • faster jit-compilation, especially for large systems, higher orders and gradient computations.
  • jit-compilable (and differentiable) interaction list generation, if possible.
  • various other performance improvements.
  • some degree of autotuning for the parameters.

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.2.tar.gz (153.3 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.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jaxfmm-0.0.2.tar.gz
  • Upload date:
  • Size: 153.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for jaxfmm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7f77bdb94bb894d3eb98851abf1eab13313609af029362e766444d5c9046de7b
MD5 c6501d8d76654a3dd4bd8374bdfbf1f3
BLAKE2b-256 0e1ee8fe5c3b43fe2dea023a1b4594cf696d3fb8cc4bbef33500c5170c419b24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaxfmm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for jaxfmm-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e5e6f34c2ddb6f062fe393553e88496225e802f5b41ddd4e0c0c273b645575b
MD5 94ffbbe7bd8cdc142617377cc704ed6a
BLAKE2b-256 84173ce79b5c7b7d4d6eed1250157b1a81a34b4036ececd664ab58da6a45faf4

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