{"id":13314631,"url":"https://github.com/kokkos/kokkos-fft","last_synced_at":"2025-06-12T08:06:25.130Z","repository":{"id":218105265,"uuid":"723997478","full_name":"kokkos/kokkos-fft","owner":"kokkos","description":"A shared-memory FFT for the Kokkos ecosystem","archived":false,"fork":false,"pushed_at":"2025-06-03T07:16:09.000Z","size":17736,"stargazers_count":36,"open_issues_count":17,"forks_count":9,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-06-03T18:57:20.453Z","etag":null,"topics":["fft","fft-library","kokkos"],"latest_commit_sha":null,"homepage":"https://kokkosfft.readthedocs.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kokkos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSES/Apache-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-27T07:27:13.000Z","updated_at":"2025-06-03T07:16:08.000Z","dependencies_parsed_at":"2025-04-24T15:22:01.499Z","dependency_job_id":"004fe5d1-0031-4a9c-a081-61b00f853af5","html_url":"https://github.com/kokkos/kokkos-fft","commit_stats":null,"previous_names":["cexa-project/kokkos-fft","kokkos/kokkos-fft"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kokkos/kokkos-fft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-fft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-fft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-fft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-fft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kokkos","download_url":"https://codeload.github.com/kokkos/kokkos-fft/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-fft/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259426977,"owners_count":22855554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fft","fft-library","kokkos"],"created_at":"2024-07-29T18:11:50.420Z","updated_at":"2025-06-12T08:06:25.121Z","avatar_url":"https://github.com/kokkos.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: (C) The kokkos-fft development team, see COPYRIGHT.md file\n\nSPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception\n--\u003e\n\n# kokkos-fft\n\n[![CI](https://github.com/kokkos/kokkos-fft/actions/workflows/build_test.yaml/badge.svg)](https://github.com/kokkos/kokkos-fft/actions)\n[![Nightly builds](https://github.com/kokkos/kokkos-fft/actions/workflows/build_nightly.yaml/badge.svg)](https://github.com/kokkos/kokkos-fft/actions/workflows/build_nightly.yaml)\n[![docs](https://readthedocs.org/projects/kokkosfft/badge/?version=latest)](https://kokkosfft.readthedocs.io/en/latest/?badge=latest)\n\n\u003e [!WARNING]\n\u003e EXPERIMENTAL FFT interfaces for Kokkos C++ Performance Portability Programming EcoSystem\n\nkokkos-fft implements local interfaces between [Kokkos](https://github.com/kokkos/kokkos) and de facto standard FFT libraries, including [FFTW](http://www.fftw.org), [cufft](https://developer.nvidia.com/cufft), [hipfft](https://github.com/ROCm/hipFFT) ([rocfft](https://github.com/ROCm/rocFFT)), and [oneMKL](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html). \"Local\" means not using MPI, or running within a single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html)-like interfaces adapted for [Kokkos](https://github.com/kokkos/kokkos).\nA key concept is that **\"As easy as numpy, as fast as vendor libraries\"**. Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. A fft library dedicated to Kokkos Device backend (e.g. [cufft](https://developer.nvidia.com/cufft) for CUDA backend) is automatically used. If something is wrong with runtime values (say `View` extents), it will raise runtime errors (C++ `std::runtime_error`). See [documentations](https://kokkosfft.readthedocs.io/) for more information.\n\nHere is an example for 1D real to complex transform with `rfft` in kokkos-fft.\n```C++\n#include \u003cKokkos_Core.hpp\u003e\n#include \u003cKokkos_Complex.hpp\u003e\n#include \u003cKokkos_Random.hpp\u003e\n#include \u003cKokkosFFT.hpp\u003e\nusing execution_space = Kokkos::DefaultExecutionSpace;\ntemplate \u003ctypename T\u003e using View1D = Kokkos::View\u003cT*, execution_space\u003e;\nconstexpr int n = 4;\n\nView1D\u003cdouble\u003e x(\"x\", n);\nView1D\u003cKokkos::complex\u003cdouble\u003e \u003e x_hat(\"x_hat\", n/2+1);\n\nKokkos::Random_XorShift64_Pool\u003c\u003e random_pool(12345);\nKokkos::fill_random(x, random_pool, 1);\nKokkos::fence();\n\nKokkosFFT::rfft(execution_space(), x, x_hat);\n```\n\nThis is equivalent to the following python code.\n\n```python3\nimport numpy as np\nx = np.random.rand(4)\nx_hat = np.fft.rfft(x)\n```\n\nThere are two major differences: [`execution_space`](https://kokkos.org/kokkos-core-wiki/API/core/execution_spaces.html) argument and output value (`x_hat`) is an argument of API (not returned value from API). As imagined, kokkos-fft only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from `execution_space` are statically checked (compilation errors if not accessible).\n\nDepending on a View dimension, it automatically uses the batched plans as follows\n```C++\n#include \u003cKokkos_Core.hpp\u003e\n#include \u003cKokkos_Complex.hpp\u003e\n#include \u003cKokkos_Random.hpp\u003e\n#include \u003cKokkosFFT.hpp\u003e\nusing execution_space = Kokkos::DefaultExecutionSpace;\ntemplate \u003ctypename T\u003e using View2D = Kokkos::View\u003cT**, execution_space\u003e;\nconstexpr int n0 = 4, n1 = 8;\n\nView2D\u003cdouble\u003e x(\"x\", n0, n1);\nView2D\u003cKokkos::complex\u003cdouble\u003e \u003e x_hat(\"x_hat\", n0, n1/2+1);\n\nKokkos::Random_XorShift64_Pool\u003c\u003e random_pool(12345);\nKokkos::fill_random(x, random_pool, 1);\nKokkos::fence();\n\n// FFT along -1 axis and batched along 0th axis\nint axis = -1;\nKokkosFFT::rfft(execution_space(), x, x_hat, KokkosFFT::Normalization::backward, axis);\n```\n\nThis is equivalent to\n\n```python3\nimport numpy as np\nx = np.random.rand(4, 8)\nx_hat = np.fft.rfft(x, axis=-1)\n```\n\nIn this example, the 1D batched `rfft` over 2D View along `axis -1` is executed. Some basic examples are found in [examples](examples).\n\n## Using kokkos-fft\nFor the moment, there are two ways to use kokkos-fft: including as a subdirectory in CMake project or installing as a library. First of all, you need to clone this repo.\n```bash\ngit clone --recursive https://github.com/kokkos/kokkos-fft.git\n```\n\n### Prerequisites\nTo use kokkos-fft, we need the following:\n* `CMake 3.22+`\n* `Kokkos 4.4+`\n* `gcc 8.3.0+` (CPUs)\n* `IntelLLVM 2023.0.0+` (CPUs, Intel GPUs)\n* `nvcc 11.0.0+` (NVIDIA GPUs)\n* `rocm 5.3.0+` (AMD GPUs)\n\n### CMake\nSince kokkos-fft is a header-only library, it is enough to simply add as a subdirectory. It is assumed that kokkos and kokkos-fft are placed under `\u003cproject_directory\u003e/tpls`.\n\nHere is an example to use kokkos-fft in the following CMake project.\n```\n---/\n |\n └──\u003cproject_directory\u003e/\n    |--tpls\n    |    |--kokkos/\n    |    └──kokkos-fft/\n    |--CMakeLists.txt\n    └──hello.cpp\n```\n\nThe `CMakeLists.txt` would be\n```CMake\ncmake_minimum_required(VERSION 3.23)\nproject(kokkos-fft-as-subdirectory LANGUAGES CXX)\n\nadd_subdirectory(tpls/kokkos)\nadd_subdirectory(tpls/kokkos-fft)\n\nadd_executable(hello-kokkos-fft hello.cpp)\ntarget_link_libraries(hello-kokkos-fft PUBLIC Kokkos::kokkos KokkosFFT::fft)\n```\n\nFor compilation, we basically rely on the CMake options for Kokkos. For example, the compile options for A100 GPU is as follows.\n```\ncmake -B build \\\n      -DCMAKE_CXX_COMPILER=g++ \\\n      -DCMAKE_BUILD_TYPE=Release \\\n      -DKokkos_ENABLE_CUDA=ON \\\n      -DKokkos_ARCH_AMPERE80=ON\ncmake --build build -j 8\n```\nThis way, all the functionalities are executed on A100 GPUs. For installation, details are provided in the [documentation](https://kokkosfft.readthedocs.io/en/latest/intro/building.html#install-kokkosfft-as-a-library).\n\n## Support\n\nFind us on [Slack channel](https://kokkosteam.slack.com/archives/C07NM5SD3FD) or open a GitHub issue.\n\n## Contributing\n\nPlease see [this page](https://kokkosfft.readthedocs.io/en/latest/developer_guide.html) for details on how to contribute.\n\n## LICENSE\n\n[![License](https://img.shields.io/badge/License-Apache--2.0_WITH_LLVM--exception-blue)](https://spdx.org/licenses/LLVM-exception.html)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nkokkos-fft is distributed under either the MIT license, or at your option, the Apache-2.0 license with LLVM exception.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkokkos%2Fkokkos-fft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkokkos%2Fkokkos-fft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkokkos%2Fkokkos-fft/lists"}