Skip to main content

Fast and accurate EMRI Waveforms.

Project description

few: Fast EMRI Waveforms

This package contains the highly modular framework for fast and accurate extreme mass ratio inspiral (EMRI) waveforms from arxiv.org/2104.04582 and arxiv.org/2008.06071. The waveforms in this package combine a variety of separately accessible modules to form EMRI waveforms on both CPUs and GPUs. Generally, the modules fall into four categories: trajectory, amplitudes, summation, and utilities. Please see the documentation for further information on these modules. The code can be found on Github here. The data necessary for various modules in this package will automatically download the first time it is needed. If you would like to view the data, it can be found on Zenodo. The current and all past code release zip files can also be found on Zenodo here. Please see the citation section below for information on citing FEW.

This package is a part of the Black Hole Perturbation Toolkit.

If you use all or any parts of this code, please cite arxiv.org/2104.04582 and arxiv.org/2008.06071. See the documentation to properly cite specific modules.

Getting started

To install the latest pre-compiled version of fastemriwaveforms, simply run:

# For CPU-only version
pip install --pre fastemriwaveforms

# For GPU-enabled versions with CUDA 11.Y.Z
pip install --pre fastemriwaveforms-cuda11x

# For GPU-enabled versions with CUDA 12.Y.Z
pip install --pre fastemriwaveforms-cuda12x

The --pre- flag means that you are installing a pre-release version of the project. This flag will not be necessary once version 2.0 is officially released.

To know your CUDA version, run the tool nvidia-smi in a terminal a check the CUDA version reported in the table header:

$ nvidia-smi
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15              Driver Version: 550.54.15      CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
...

Now, in a python file or notebook:

import few

You may check the currently available backends:

>>> for backend in ["cpu", "cuda11x", "cuda12x", "cuda", "gpu"]: print(f" - Backend '{backend}': {"un" if not few.has_backend(backend) else ""}available")
 - Backend 'cpu': available
 - Backend 'cuda11x': unavailable
 - Backend 'cuda12x': unavailable
 - Backend 'cuda': unavailable
 - Backend 'gpu': unavailable

Note that the cuda backend is an alias for either cuda11x or cuda12x. If any is available, then the cuda backend is available. Similarly, the gpu backend is (fpr now) an alias for cuda.

If you expected a backend to be available but it is not, run the following command to obtain an error message which can guide you to fix this issue:

>>> import few
>>> few.get_backend("cuda12x")
ModuleNotFoundError: No module named 'few_backend_cuda12x'

The above exception was the direct cause of the following exception:
...

few.cutils.BackendNotInstalled: The 'cuda12x' backend is not installed.

The above exception was the direct cause of the following exception:
...

few.cutils.MissingDependencies: FastEMRIWaveforms CUDA plugin is missing.
    If you are using few in an environment managed using pip, run:
        $ pip install fastemriwaveforms-cuda12x

The above exception was the direct cause of the following exception:
...

few.cutils.BackendAccessException: Backend 'cuda12x' is unavailable. See previous error messages.

Once FEW is working and the expected backends are selected, you may see examples notebook on how to start with this software.

Installing from sources

Prerequisites

To install this software from source, you will need:

  • A C++ compiler (g++, clang++, ...)
  • A Python version supported by scikit-build-core (>=3.7 as of Jan. 2025)

Some installation steps require the external library LAPACK along with its C-bindings provided by LAPACKE. If these libraries and their header files (in particular lapacke.h) are available on your system, they will be detected and used automatically. If they are available on a non-standard location, see below for some options to help detecting them. Note that by default, if LAPACKE is not available on your system, the installation step will attempt to download its sources and add them to the compilation tree. This makes the installation a bit longer but a lot easier.

If you want to enable GPU support in FEW, you will also need the NVIDIA CUDA Compiler nvcc in your path as well as the CUDA toolkit (with, in particular, the libraries CUDA Runtime Library, cuBLAS and cuSPARSE).

There are a set of files required for total use of this package. They will download automatically the first time they are needed. Files are generally under 10MB. However, there is a 100MB file needed for the slow waveform and the bicubic amplitude interpolation. This larger file will only download if you run either of those two modules. The files are hosted on the Black Hole Perturbation Toolkit Download Server.

Running the installation

To start the from-source installation, ensure the pre-requisite are met, clone the repository, and then simply run a pip install command:

# Clone the repository
git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
cd FastEMRIWaveforms

# Run the install
pip install .

Many options are available to change the installation behaviour. These can be set by adding --config-settings=cmake.define.OPTION_NAME=OPTION_VALUE to the pip command. Available options are:

  • FEW_LAPACKE_FETCH=ON|OFF|[AUTO]: Whether LAPACK and LAPACKE should be automatically fetched from internet.
    • ON: ignore pre-installed LAPACK(E) and always fetch and compile their sources
    • OFF: disable LAPACK(E) fetching and only use pre-installed library and headers (install will fail if pre-installed lib and headers are not available)
    • AUTO (default): try to detect pre-installed LAPACK(E) and their headers. If found, use them, otherwise fetch LAPACK(E).
  • FEW_LAPACKE_DETECT_WITH=[CMAKE]|PKGCONFIG: How LAPACK(E) should be detected
    • CMAKE: LAPACK(E) will be detected using the cmake FindPackage command. If your LAPACK(E) install provides lapacke-config.cmake in a non-standard location, add its path to the CMAKE_PREFIX_PATH environment variable.
    • PKGCONFIG: LAPACK(E) will be detected using pkg-config by searching for the files lapack.pc and lapacke.pc . If these files are provided by your LAPACK(E) install in a non-standard location, add their path to the environment variable PKG_CONFIG_PATH
    • AUTO (default): attempt both CMake and PkgConfig approaches
  • FEW_WITH_GPU=ON|OFF|[AUTO]: Whether GPU-support must be enabled
    • ON: Forcefully enable GPU support (install will fail if GPU prerequisites are not met)
    • OFF: Disable GPU support
    • AUTO (default): Check whether nvcc and the CUDA Toolkit are available in environment and enable/disable GPU support accordingly.
  • FEW_CUDA_ARCH: List of CUDA architectures that will be targeted by the CUDA compiler using CMake CUDA_ARCHITECTURES syntax. (Default = all).

Example of custom install with specific options to forcefully enable GPU support with support for the host's GPU only (native architecture) using LAPACK fetched from internet:

pip install . \
  --config-settings=cmake.define.FEW_WITH_GPU=ON \
  --config-settings=cmake.define.FEW_CUDA_ARCH="native" \
  --config-settings=cmake.define.FEW_LAPACKE_FETCH=ON

If you enabled GPU support (or it was automatically enabled by the AUTO mode), you will also need to install the nvidia-cuda-runtime package corresponding to the CUDA version detected by nvidia-smi as explained in the Getting Started section above. You will also need to manually install cupy-cuda11x or cupy-cuda12x according to your CUDA version.

Please contact the developers if the installation does not work.

Running the Tests

The tests require a few dependencies which are not installed by default. To install them, add the [testing] label to FEW package name when installing it. E.g:

# For CPU-only version with testing enabled
pip install fastemriwaveforms[testing]

# For GPU version with CUDA 12.Y and testing enabled
pip install fastemriwaveforms-cuda12x[testing]

# For from-source install with testing enabled
git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
cd FastEMRIWaveforms
pip install '.[testing]'

To run the tests, open a terminal in a directory containing the sources of FEW and then run the unittest module in discover mode:

$ git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
$ cd FastEMRIWaveforms
$ python -m unittest discover
...
----------------------------------------------------------------------
Ran 20 tests in 71.514s
OK

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

If you want to develop FEW and produce documentation, install few from source with the [dev] label and in editable mode:

$ git clone https://github.com/BlackHolePerturbationToolkit/FastEMRIWaveforms.git
$ cd FastEMRIWaveforms
pip install -e '.[dev, testing]'

This will install necessary packages for building the documentation (sphinx, pypandoc, sphinx_rtd_theme, nbsphinx) and to run the tests.

The documentation source files are in docs/source. To compile the documentation, change to the docs directory and run make html.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors/Developers

  • Michael Katz
  • Lorenzo Speri
  • Christian Chapman-Bird
  • Alvin J. K. Chua
  • Niels Warburton
  • Scott Hughes

Contributors

  • Philip Lynch
  • Soichiro Isoyama
  • Ryuichi Fujita
  • Monica Rizzo
  • Ollie Burke
  • Maxime Pigou

License

This project is licensed under the GNU License - see the LICENSE file for details.

Citation

Please make sure to cite FEW papers and the FEW software on Zenodo. There are other papers that require citation based on the classes used. For most classes this applies to, you can find these by checking the citation attribute for that class. All references are detailed in the CITATION.cff file.

Acknowledgments

  • This research resulting in this code was supported by National Science Foundation under grant DGE-0948017 and the Chateaubriand Fellowship from the Office for Science & Technology of the Embassy of France in the United States.
  • It was also supported in part through the computational resources and staff contributions provided for the Quest/Grail high performance computing facility at Northwestern University.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

fastemriwaveforms_cuda12x-2.0.0rc0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.27+ x86-64

fastemriwaveforms_cuda12x-2.0.0rc0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.27+ x86-64

fastemriwaveforms_cuda12x-2.0.0rc0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.27+ x86-64

fastemriwaveforms_cuda12x-2.0.0rc0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.27+ x86-64

fastemriwaveforms_cuda12x-2.0.0rc0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64manylinux: glibc 2.27+ x86-64

File details

Details for the file fastemriwaveforms_cuda12x-2.0.0rc0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for fastemriwaveforms_cuda12x-2.0.0rc0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 e13326ce485479be519d28c3963a5e1e61d26d04c8b77e091765fc8c9645ee7c
MD5 04d68e7e3a6fbe145d46087446d643d3
BLAKE2b-256 15859a76546cb6a8f9154c76eb31ff818159daf044d73700768cd09ac65ae57f

See more details on using hashes here.

File details

Details for the file fastemriwaveforms_cuda12x-2.0.0rc0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for fastemriwaveforms_cuda12x-2.0.0rc0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 9a2ef747c8c19395a523840450e0862fa4b965caa492d9ffe1d799589042f202
MD5 278bb881daa3c57bfda1170e6fb80f1f
BLAKE2b-256 c55df0d6063254bb6138306c0b5a886ee8e8cd8a56c371f205edb70d0b710c5f

See more details on using hashes here.

File details

Details for the file fastemriwaveforms_cuda12x-2.0.0rc0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for fastemriwaveforms_cuda12x-2.0.0rc0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 b1f8ac76a87f9c7127bed2500c9a09d07aed9f67b8a022e55ae46e5ba5e3ac85
MD5 d4599ec28381aaaddcf2e42c0ad38f2a
BLAKE2b-256 195ec7ae4dfafa52897d255b0b143cda77646547f16fa72ff99b1d82e9011d5b

See more details on using hashes here.

File details

Details for the file fastemriwaveforms_cuda12x-2.0.0rc0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for fastemriwaveforms_cuda12x-2.0.0rc0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 c08b569394a85fe8e9132b69c0d5fff80f05bb3c259d4bfd3047e32ba570ba1c
MD5 7e300c389130c85146e9d88a173dc6a5
BLAKE2b-256 84946659043769087b519ba5e078500b544cfe9f9847298989af66efd6247930

See more details on using hashes here.

File details

Details for the file fastemriwaveforms_cuda12x-2.0.0rc0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for fastemriwaveforms_cuda12x-2.0.0rc0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 6bb518bbdd79ca865adcbe53db489c0d1201a9aae0faf38b50a097606a13e568
MD5 5296c8932e3197da670622b59b928721
BLAKE2b-256 8d62212cc120b22c8e29c87f402c5dcbbc370476f5a74b41ffa109930c3a7388

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