pax_global_header 0000666 0000000 0000000 00000000064 14743207756 0014531 g ustar 00root root 0000000 0000000 52 comment=34391bc8c5e2b8add000e38fdc6ce68896184d10
SpFFT-1.1.1/ 0000775 0000000 0000000 00000000000 14743207756 0012453 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/.clang-format 0000664 0000000 0000000 00000000077 14743207756 0015032 0 ustar 00root root 0000000 0000000 BasedOnStyle: Google
ColumnLimit: 100
AccessModifierOffset: -2
SpFFT-1.1.1/.github/ 0000775 0000000 0000000 00000000000 14743207756 0014013 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/.github/workflows/ 0000775 0000000 0000000 00000000000 14743207756 0016050 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/.github/workflows/ci.yml 0000664 0000000 0000000 00000010320 14743207756 0017162 0 ustar 00root root 0000000 0000000 name: CI
on: [push, pull_request]
jobs:
#########################
# Build and test with GCC
#########################
CPU:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type: [release, debug]
compiler: [g++]
use_omp: [true]
use_mpi: [true, false]
use_float: [true]
include:
- build_type: debug
compiler: clang++
use_omp: false
use_mpi: true
use_float: false
env:
USE_OMP: ${{ matrix.use_omp }}
USE_MPI: ${{ matrix.use_mpi }}
USE_FLOAT: ${{ matrix.use_float }}
BUILD_TYPE: ${{ matrix.build_type }}
COMPILER: ${{ matrix.compiler }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Print build config
run: |
echo "Compiler: ${COMPILER}, Build type: ${BUILD_TYPE}, OpenMP: ${USE_OMP}, MPI: ${USE_MPI}, FLOAT: ${USE_FLOAT}"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfftw3-dev make g++ clang wget git make cmake
- name: Install MPI
if: ${{ matrix.use_mpi }}
run: |
sudo apt-get install -y mpi-default-dev
- name: Build and install
run: |
mkdir -p build
cd build
mkdir -p install_dir
export INSTALL_DIR=$(pwd)/install_dir
CXX=${COMPILER} cmake .. -DSPFFT_BUILD_TESTS=OFF -DSPFFT_OMP=${USE_OMP} -DSPFFT_MPI=${USE_MPI} -DSPFFT_SINGLE_PRECISION=${USE_FLOAT} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
make -j2
make VERBOSE=1 install
test -f ${INSTALL_DIR}/lib/libspfft.so
test -f ${INSTALL_DIR}/include/spfft/spfft.hpp
test -f ${INSTALL_DIR}/include/spfft/spfft.h
- name: Build tests
run: |
cd ${GITHUB_WORKSPACE}
rm -rf build
mkdir -p build
cd build
CXX=${COMPILER} cmake .. -DSPFFT_BUILD_TESTS=ON -DSPFFT_OMP=${USE_OMP} -DSPFFT_MPI=${USE_MPI} -DSPFFT_SINGLE_PRECISION=${USE_FLOAT} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Wno-error=maybe-uninitialized"
make -j2
- name: Run tests
env:
OMPI_MCA_btl_vader_single_copy_mechanism: none
run: ${GITHUB_WORKSPACE}/build/tests/run_local_tests
- name: Run tests with MPI
if: ${{ matrix.use_mpi }}
env:
OMPI_MCA_btl_vader_single_copy_mechanism: none
run: mpirun -n 2 ${GITHUB_WORKSPACE}/build/tests/run_mpi_tests
#################
# Build with CUDA
#################
CUDA:
runs-on: ubuntu-22.04
container: nvidia/cuda:11.0.3-devel-ubuntu20.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y libfftw3-dev make g++ mpi-default-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0-Linux-x86_64.tar.gz && tar -xzvf cmake-3.18.0-Linux-x86_64.tar.gz
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
${HOME}/cmake-3.18.0-Linux-x86_64/bin/cmake .. -DSPFFT_BUILD_TESTS=ON -DSPFFT_GPU_BACKEND=CUDA -DSPFFT_OMP=OFF
make -j2
#################
# Build with ROCm
#################
ROCM:
runs-on: ubuntu-22.04
container: rocm/dev-ubuntu-22.04:5.3-complete
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y libfftw3-dev make g++ mpi-default-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.tar.gz && tar -xzvf cmake-3.21.0-linux-x86_64.tar.gz
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
${HOME}/cmake-3.21.0-linux-x86_64/bin/cmake .. -DSPFFT_BUILD_TESTS=ON -DSPFFT_GPU_BACKEND=ROCM -DCMAKE_PREFIX_PATH=/opt/rocm
make -j2
SpFFT-1.1.1/.readthedocs.yml 0000664 0000000 0000000 00000000453 14743207756 0015543 0 ustar 00root root 0000000 0000000 # Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
sphinx:
configuration: docs/source/conf.py
formats: []
build:
os: ubuntu-22.04
tools:
python: "3.11"
python:
install:
- requirements: docs/requirements.txt
SpFFT-1.1.1/CMakeLists.txt 0000664 0000000 0000000 00000017342 14743207756 0015222 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.18 FATAL_ERROR) # 3.18 for C++17
project(SpFFT LANGUAGES CXX VERSION 1.1.1)
set(SPFFT_SO_VERSION 1)
set(SPFFT_VERSION ${PROJECT_VERSION})
# allow {module}_ROOT variables to be set
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Initialize CMAKE_CUDA_ARCHITECTURES through nvcc if possible
if(POLICY CMP0104)
cmake_policy(SET CMP0104 NEW)
endif()
# set default build type to RELEASE
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo"
)
endif()
# set language and standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_HIP_STANDARD 17)
#add local module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)
include(CMakeDependentOption)
# Options
option(SPFFT_STATIC "Compile as static library" OFF)
option(SPFFT_OMP "Compile with OpenMP support" ON)
option(SPFFT_MPI "Compile with MPI support" ON)
option(SPFFT_GPU_DIRECT "Compile with GPU direct (GPU aware MPI) support." OFF)
option(SPFFT_BUILD_TESTS "Build tests" OFF)
option(SPFFT_SINGLE_PRECISION "Enable single precision support" OFF)
option(SPFFT_INSTALL "Enable CMake install commands" ON)
option(SPFFT_FORTRAN "Compile fortran module" OFF)
option(SPFFT_BUNDLED_LIBS "Use bundled libraries for building tests" ON)
cmake_dependent_option(SPFFT_BUNDLED_GOOGLETEST "Use bundled googletest lib" ON "SPFFT_BUNDLED_LIBS" OFF)
cmake_dependent_option(SPFFT_BUNDLED_JSON "Use bundled json lib" ON "SPFFT_BUNDLED_LIBS" OFF)
cmake_dependent_option(SPFFT_BUNDLED_CLI11 "Use bundled CLI11 lib" ON "SPFFT_BUNDLED_LIBS" OFF)
set(SPFFT_GPU_BACKEND "OFF" CACHE STRING "GPU backend")
set_property(CACHE SPFFT_GPU_BACKEND PROPERTY STRINGS
"OFF" "CUDA" "ROCM"
)
set(SPFFT_FFTW_LIB "AUTO" CACHE STRING "Library providing a FFTW interface")
set_property(CACHE SPFFT_FFTW_LIB PROPERTY STRINGS
"AUTO" "FFTW" "MKL" "ARMPL"
)
# Get GNU standard install prefixes
include(GNUInstallDirs)
# set preferred library type
if (SPFFT_STATIC)
# prefer static over dynamic libraries with the find_library() command by changing the order
set(CMAKE_FIND_LIBRARY_SUFFIXES_SAVE ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .tbd .dylib .so)
elseif(UNIX)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
endif()
set(SPFFT_LIBRARY_TYPE STATIC)
else()
set(SPFFT_LIBRARY_TYPE SHARED)
endif()
set(SPFFT_EXTERNAL_LIBS)
set(SPFFT_INCLUDE_DIRS)
set(SPFFT_EXTERNAL_INCLUDE_DIRS)
set(SPFFT_EXTERNAL_PKG_PACKAGES)
# Options combination check
set(SPFFT_CUDA OFF)
set(SPFFT_ROCM OFF)
if(SPFFT_GPU_BACKEND)
if(SPFFT_GPU_BACKEND STREQUAL "CUDA")
set(SPFFT_CUDA ON)
elseif(SPFFT_GPU_BACKEND STREQUAL "ROCM")
set(SPFFT_ROCM ON)
else()
message(FATAL_ERROR "Invalid GPU backend option")
endif()
endif()
mark_as_advanced(SPFFT_CUDA SPFFT_ROCM)
# Fortran
if(SPFFT_FORTRAN)
enable_language(Fortran)
endif()
# CUDA
if(SPFFT_CUDA)
enable_language(CUDA)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
find_package(CUDAToolkit REQUIRED)
else()
find_library(CUDA_CUDART_LIBRARY cudart PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
find_library(CUDA_CUFFT_LIBRARY cufft PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(NOT TARGET CUDA::cudart)
add_library(CUDA::cudart INTERFACE IMPORTED)
endif()
set_property(TARGET CUDA::cudart PROPERTY INTERFACE_LINK_LIBRARIES ${CUDA_CUDART_LIBRARY})
set_property(TARGET CUDA::cudart PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
if(NOT TARGET CUDA::cufft)
add_library(CUDA::cufft INTERFACE IMPORTED)
endif()
set_property(TARGET CUDA::cufft PROPERTY INTERFACE_LINK_LIBRARIES ${CUDA_CUFFT_LIBRARY})
set_property(TARGET CUDA::cufft PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
endif()
list(APPEND SPFFT_EXTERNAL_LIBS CUDA::cudart CUDA::cufft)
endif()
# ROCM
if(SPFFT_ROCM)
cmake_minimum_required(VERSION 3.21 FATAL_ERROR) # hip support only added in 3.21
enable_language(HIP)
find_package(hip CONFIG REQUIRED)
find_package(rocfft CONFIG REQUIRED)
find_package(hipfft CONFIG) # hipfft within rocfft is deprecated. Use separate hipfft if available (not required).
if(hipfft_FOUND)
# Issue with rocm 4.1.0: Symlink to rocfft provided hipfft.h in /opt/rocm/include.
# Workaround: Only use hipfft include directory with hipfft target and place before other hip targets in lib list
if(HIPFFT_INCLUDE_DIRS)
set_property(TARGET hip::hipfft PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HIPFFT_INCLUDE_DIRS})
endif()
list(APPEND SPFFT_EXTERNAL_LIBS hip::hipfft)
endif()
list(APPEND SPFFT_EXTERNAL_LIBS hip::host roc::rocfft)
# Previously used option for flags.
if(HIP_HCC_FLAGS)
message(WARNING "HIP_HCC_FLAGS has no effect. Use CMAKE_HIP_FLAGS for flags and CMAKE_HIP_ARCHITECTURES for arch instead.")
endif()
endif()
if(SPFFT_MPI)
find_package(MPI COMPONENTS CXX REQUIRED)
list(APPEND SPFFT_EXTERNAL_LIBS MPI::MPI_CXX)
endif()
if(SPFFT_OMP)
find_package(OpenMP COMPONENTS CXX REQUIRED)
list(APPEND SPFFT_EXTERNAL_LIBS OpenMP::OpenMP_CXX)
endif()
if(SPFFT_GPU_DIRECT)
message(STATUS "GPU Direct support enabled: Additional environment variables might have to be set before execution. (e.g \"export MPICH_RDMA_ENABLED_CUDA=1\")")
endif()
# FFTW library must be found if not set to AUTO
set(_SPFFT_FIND_FFTW_LIB_OPTION)
if(NOT ${SPFFT_FFTW_LIB} STREQUAL "AUTO")
set(_SPFFT_FIND_FFTW_LIB_OPTION REQUIRED)
endif()
set(SPFFT_MKL OFF)
set(SPFFT_ARMPL OFF)
set(SPFFT_FFTW OFF)
# Look for MKL first
if(${SPFFT_FFTW_LIB} STREQUAL "AUTO" OR ${SPFFT_FFTW_LIB} STREQUAL "MKL")
# Use MKL if available, otherwise require FFTW3
if(UNIX AND NOT APPLE)
# prefer static MKL in Linux. Together with "-Wl,--exclude-libs,ALL",
# symbols are not visible for linking afterwards and no conflicts with other MKL versions of other libraries should exist.
set(_TMP_SAVE ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
endif()
find_package(MKLSequential ${_SPFFT_FIND_FFTW_LIB_OPTION})
if(UNIX AND NOT APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_TMP_SAVE})
unset(_TMP_SAVE)
endif()
if(TARGET MKL::Sequential)
list(APPEND SPFFT_EXTERNAL_LIBS MKL::Sequential)
list(APPEND SPFFT_EXTERNAL_PKG_PACKAGES mkl-dynamic-lp64-seq)
set(SPFFT_MKL ON)
endif()
endif()
# Look for ARM PL
if(NOT SPFFT_MKL AND ${SPFFT_FFTW_LIB} STREQUAL "AUTO" OR ${SPFFT_FFTW_LIB} STREQUAL "ARMPL")
find_package(ARMPL ${_SPFFT_FIND_FFTW_LIB_OPTION})
if(TARGET ARM::pl)
list(APPEND SPFFT_EXTERNAL_LIBS ARM::pl)
set(SPFFT_ARMPL ON)
endif()
endif()
# Look for FFTW library if required
if(NOT SPFFT_MKL AND NOT SPFFT_ARMPL)
find_package(FFTW REQUIRED)
list(APPEND SPFFT_EXTERNAL_LIBS FFTW::FFTW)
if(SPFFT_SINGLE_PRECISION)
find_package(FFTWF REQUIRED)
list(APPEND SPFFT_EXTERNAL_LIBS FFTWF::FFTWF)
endif()
list(APPEND SPFFT_EXTERNAL_PKG_PACKAGES fftw3)
set(SPFFT_FFTW ON)
endif()
# generate config.h
configure_file(include/spfft/config.h.in ${PROJECT_BINARY_DIR}/spfft/config.h)
list(APPEND SPFFT_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src)
list(APPEND SPFFT_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include)
list(APPEND SPFFT_INCLUDE_DIRS ${PROJECT_BINARY_DIR})
list(APPEND SPFFT_EXTERNAL_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/ext)
#############################################################################
# All include dirs and definitions must be set before sub-directory is added!
#############################################################################
add_subdirectory(src)
# add tests for developement
if(SPFFT_BUILD_TESTS)
add_subdirectory(tests)
endif()
# reset cmake library suffixes
if(SPFFT_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAVE})
endif()
SpFFT-1.1.1/LICENSE 0000664 0000000 0000000 00000002715 14743207756 0013465 0 ustar 00root root 0000000 0000000 Copyright (c) 2019 ETH Zurich, Simon Frasch
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
SpFFT-1.1.1/README.md 0000664 0000000 0000000 00000021371 14743207756 0013736 0 ustar 00root root 0000000 0000000 [](https://github.com/eth-cscs/SpFFT/actions?query=workflow%3ACI)
[](https://anaconda.org/conda-forge/spfft)
[](https://spfft.readthedocs.io/en/latest/?badge=latest)
[](https://raw.githubusercontent.com/eth-cscs/SpFFT/master/LICENSE)
# SpFFT
SpFFT - A 3D FFT library for sparse frequency domain data written in C++ with support for MPI, OpenMP, CUDA and ROCm.
Inspired by the need of some computational material science applications with spherical cutoff data in frequency domain, SpFFT provides Fast Fourier Transformations of sparse frequency domain data. For distributed computations with MPI, slab decomposition in space domain and pencil decomposition in frequency domain (sparse data within a pencil / column must be on one rank) is used.
***Fig. 1:*** Illustration of a transform, where data on each MPI rank is identified by color.
### Design Goals
- Sparse frequency domain input
- Reuse of pre-allocated memory
- Support for shifted indexing with centered zero-frequency
- Optional parallelization and GPU acceleration
- Unified interface for calculations on CPUs and GPUs
- Support of Complex-To-Real and Real-To-Complex transforms, where the full hermitian symmetry property is utilized
- C++, C and Fortran interfaces
### Interface Design
To allow for pre-allocation and reuse of memory, the design is based on two classes:
- **Grid**: Provides memory for transforms up to a given size.
- **Transform**: Created with information on sparse input data and is associated with a *Grid*. Maximum size is limited by *Grid* dimensions. Internal reference counting to *Grid* objects guarantee a valid state until *Transform* object destruction.
A transform can be computed in-place and out-of-place. Addtionally, an internally allocated work buffer can optionally be used for input / output of space domain data.
### New Features in v1.0
- Support for externally allocated memory for space domain data including in-place and out-of-place transforms
- Optional asynchronous computation when using GPUs
- Simplified / direct transform handle creation if no resource reuse through grid handles is required
## Documentation
Documentation can be found [here](https://spfft.readthedocs.io/en/latest/).
## Requirements
- C++ Compiler with C++17 support. Supported compilers are:
- GCC 7 and later
- Clang 5 and later
- ICC 19.0 and later
- CMake 3.18 and later (3.21 for ROCm)
- Library providing a FFTW 3.x interface (FFTW3 or Intel MKL)
- For multi-threading: OpenMP support by the compiler
- For compilation with GPU support:
- CUDA 11.0 and later for Nvidia hardware
- ROCm 5.0 and later for AMD hardware
## Installation
The build system follows the standard CMake workflow. Example:
```console
mkdir build
cd build
cmake .. -DSPFFT_OMP=ON -DSPFFT_MPI=ON -DSPFFT_GPU_BACKEND=CUDA -DSPFFT_SINGLE_PRECISION=OFF -DCMAKE_INSTALL_PREFIX=/usr/local
make -j8 install
```
### CMake options
| Option | Default | Description |
|------------------------|---------|--------------------------------------------------------------|
| SPFFT_MPI | ON | Enable MPI support |
| SPFFT_OMP | ON | Enable multi-threading with OpenMP |
| SPFFT_GPU_BACKEND | OFF | Select GPU backend. Can be OFF, CUDA or ROCM |
| SPFFT_GPU_DIRECT | OFF | Use GPU aware MPI with GPUDirect |
| SPFFT_SINGLE_PRECISION | OFF | Enable single precision support |
| SPFFT_STATIC | OFF | Build as static library |
| SPFFT_FFTW_LIB | AUTO | Library providing a FFTW interface. Can be AUTO, MKL or FFTW |
| SPFFT_BUILD_TESTS | OFF | Build test executables for developement purposes |
| SPFFT_INSTALL | ON | Add library to install target |
| SPFFT_FORTRAN | OFF | Build Fortran interface module |
| SPFFT_BUNDLED_LIBS | ON | Download required libraries for building tests |
**_NOTE:_** When compiling with CUDA or ROCM (HIP), the standard `CMAKE_CUDA_ARCHITECTURES` and `CMAKE_HIP_ARCHITECTURES` options should be defined as well. `HIP_HCC_FLAGS` is no longer in use.
## Examples
Further exmples for C++, C and Fortran can be found in the "examples" folder.
```cpp
#include
#include
#include
#include "spfft/spfft.hpp"
int main(int argc, char** argv) {
const int dimX = 2;
const int dimY = 2;
const int dimZ = 2;
std::cout << "Dimensions: x = " << dimX << ", y = " << dimY << ", z = " << dimZ << std::endl
<< std::endl;
// Use default OpenMP value
const int numThreads = -1;
// Use all elements in this example.
const int numFrequencyElements = dimX * dimY * dimZ;
// Slice length in space domain. Equivalent to dimZ for non-distributed case.
const int localZLength = dimZ;
// Interleaved complex numbers
std::vector frequencyElements;
frequencyElements.reserve(2 * numFrequencyElements);
// Indices of frequency elements
std::vector indices;
indices.reserve(dimX * dimY * dimZ * 3);
// Initialize frequency domain values and indices
double initValue = 0.0;
for (int xIndex = 0; xIndex < dimX; ++xIndex) {
for (int yIndex = 0; yIndex < dimY; ++yIndex) {
for (int zIndex = 0; zIndex < dimZ; ++zIndex) {
// init with interleaved complex numbers
frequencyElements.emplace_back(initValue);
frequencyElements.emplace_back(-initValue);
// add index triplet for value
indices.emplace_back(xIndex);
indices.emplace_back(yIndex);
indices.emplace_back(zIndex);
initValue += 1.0;
}
}
}
std::cout << "Input:" << std::endl;
for (int i = 0; i < numFrequencyElements; ++i) {
std::cout << frequencyElements[2 * i] << ", " << frequencyElements[2 * i + 1] << std::endl;
}
// Create local Grid. For distributed computations, a MPI Communicator has to be provided
spfft::Grid grid(dimX, dimY, dimZ, dimX * dimY, SPFFT_PU_HOST, numThreads);
// Create transform.
// Note: A transform handle can be created without a grid if no resource sharing is desired.
spfft::Transform transform =
grid.create_transform(SPFFT_PU_HOST, SPFFT_TRANS_C2C, dimX, dimY, dimZ, localZLength,
numFrequencyElements, SPFFT_INDEX_TRIPLETS, indices.data());
///////////////////////////////////////////////////
// Option A: Reuse internal buffer for space domain
///////////////////////////////////////////////////
// Transform backward
transform.backward(frequencyElements.data(), SPFFT_PU_HOST);
// Get pointer to buffer with space domain data. Is guaranteed to be castable to a valid
// std::complex pointer. Using the internal working buffer as input / output can help reduce
// memory usage.
double* spaceDomainPtr = transform.space_domain_data(SPFFT_PU_HOST);
std::cout << std::endl << "After backward transform:" << std::endl;
for (int i = 0; i < transform.local_slice_size(); ++i) {
std::cout << spaceDomainPtr[2 * i] << ", " << spaceDomainPtr[2 * i + 1] << std::endl;
}
/////////////////////////////////////////////////
// Option B: Use external buffer for space domain
/////////////////////////////////////////////////
std::vector spaceDomainVec(2 * transform.local_slice_size());
// Transform backward
transform.backward(frequencyElements.data(), spaceDomainVec.data());
// Transform forward
transform.forward(spaceDomainVec.data(), frequencyElements.data(), SPFFT_NO_SCALING);
// Note: In-place transforms are also supported by passing the same pointer for input and output.
std::cout << std::endl << "After forward transform (without normalization):" << std::endl;
for (int i = 0; i < numFrequencyElements; ++i) {
std::cout << frequencyElements[2 * i] << ", " << frequencyElements[2 * i + 1] << std::endl;
}
return 0;
}
```
## Acknowledgements
This work was supported by:
| | [**Swiss Federal Institute of Technology in Zurich**](https://www.ethz.ch/) |
|:----:|:----:|
| | [**Swiss National Supercomputing Centre**](https://www.cscs.ch/) |
| | [**MAterials design at the eXascale**](http://www.max-centre.eu)
(Horizon2020, grant agreement MaX CoE, No. 824143) |
SpFFT-1.1.1/cmake/ 0000775 0000000 0000000 00000000000 14743207756 0013533 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/cmake/SpFFT.pc.in 0000664 0000000 0000000 00000000536 14743207756 0015412 0 ustar 00root root 0000000 0000000 prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
external_packages=
Name: SpFFT
Description: Sparse 3D FFT library with MPI, OpenMP, CUDA and ROCm support
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lspfft
Cflags: -I${includedir}
Requires.private: @SPFFT_EXTERNAL_PKG_PACKAGES@
SpFFT-1.1.1/cmake/SpFFTConfig.cmake 0000664 0000000 0000000 00000000313 14743207756 0016602 0 ustar 00root root 0000000 0000000
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedConfig.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedConfig.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTStaticConfig.cmake")
endif()
SpFFT-1.1.1/cmake/SpFFTConfigVersion.cmake 0000664 0000000 0000000 00000000370 14743207756 0020153 0 ustar 00root root 0000000 0000000
# Prefer shared library
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedConfigVersion.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedConfigVersion.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTStaticConfigVersion.cmake")
endif()
SpFFT-1.1.1/cmake/SpFFTSharedConfig.cmake 0000664 0000000 0000000 00000002764 14743207756 0017745 0 ustar 00root root 0000000 0000000 include(CMakeFindDependencyMacro)
macro(find_dependency_components)
if(${ARGV0}_FOUND AND ${CMAKE_VERSION} VERSION_LESS "3.15.0")
# find_dependency does not handle new components correctly before 3.15.0
set(${ARGV0}_FOUND FALSE)
endif()
find_dependency(${ARGV})
endmacro()
# options used for building library
set(SPFFT_OMP @SPFFT_OMP@)
set(SPFFT_MPI @SPFFT_MPI@)
set(SPFFT_STATIC @SPFFT_STATIC@)
set(SPFFT_GPU_DIRECT @SPFFT_GPU_DIRECT@)
set(SPFFT_SINGLE_PRECISION @SPFFT_SINGLE_PRECISION@)
set(SPFFT_FFTW_LIB @SPFFT_FFTW_LIB@)
set(SPFFT_GPU_BACKEND @SPFFT_GPU_BACKEND@)
set(SPFFT_CUDA @SPFFT_CUDA@)
set(SPFFT_ROCM @SPFFT_ROCM@)
set(SPFFT_MKL @SPFFT_MKL@)
set(SPFFT_ARMPL @SPFFT_ARMPL@)
set(SPFFT_FFTW @SPFFT_FFTW@)
# add version of package
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedConfigVersion.cmake")
# add library target
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedTargets.cmake")
# SpFFT only has MPI as public dependency, since the mpi header is
# part of the public header file
if(SPFFT_MPI)
# only look for MPI if interface for language may be used
get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
if("CXX" IN_LIST _LANGUAGES)
find_dependency_components(MPI COMPONENTS CXX)
target_link_libraries(SpFFT::spfft INTERFACE MPI::MPI_CXX)
endif()
if("C" IN_LIST _LANGUAGES)
find_dependency_components(MPI COMPONENTS C)
target_link_libraries(SpFFT::spfft INTERFACE MPI::MPI_C)
endif()
# Fortran interface does not depend on MPI -> no linking for shared library required
endif()
SpFFT-1.1.1/cmake/SpFFTStaticConfig.cmake 0000664 0000000 0000000 00000006120 14743207756 0017754 0 ustar 00root root 0000000 0000000 include(CMakeFindDependencyMacro)
macro(find_dependency_components)
if(${ARGV0}_FOUND AND ${CMAKE_VERSION} VERSION_LESS "3.15.0")
# find_dependency does not handle new components correctly before 3.15.0
set(${ARGV0}_FOUND FALSE)
endif()
find_dependency(${ARGV})
endmacro()
# options used for building library
set(SPFFT_OMP @SPFFT_OMP@)
set(SPFFT_MPI @SPFFT_MPI@)
set(SPFFT_STATIC @SPFFT_STATIC@)
set(SPFFT_GPU_DIRECT @SPFFT_GPU_DIRECT@)
set(SPFFT_SINGLE_PRECISION @SPFFT_SINGLE_PRECISION@)
set(SPFFT_FFTW_LIB @SPFFT_FFTW_LIB@)
set(SPFFT_GPU_BACKEND @SPFFT_GPU_BACKEND@)
set(SPFFT_CUDA @SPFFT_CUDA@)
set(SPFFT_ROCM @SPFFT_ROCM@)
set(SPFFT_MKL @SPFFT_MKL@)
set(SPFFT_ARMPL @SPFFT_ARMPL@)
set(SPFFT_FFTW @SPFFT_FFTW@)
# make sure CXX is enabled
get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
if(SpFFT_FIND_REQUIRED AND NOT "CXX" IN_LIST _LANGUAGES)
message(FATAL_ERROR "SpFFT requires CXX language to be enabled for static linking.")
endif()
# Only look for modules we installed and save value
set(_CMAKE_MODULE_PATH_SAVE ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
if(SPFFT_MKL)
find_dependency(MKLSequential)
endif()
if(SPFFT_ARMPL)
find_dependency(ARMPL)
endif()
if(SPFFT_FFTW)
find_dependency(FFTW)
endif()
if(SPFFT_OMP AND NOT TARGET OpenMP::OpenMP_CXX)
find_dependency_components(OpenMP COMPONENTS CXX)
endif()
if(SPFFT_MPI AND NOT TARGET MPI::MPI_CXX)
find_dependency_components(MPI COMPONENTS CXX)
endif()
if(SPFFT_CUDA)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
find_dependency(CUDAToolkit)
else()
enable_language(CUDA)
find_library(CUDA_CUDART_LIBRARY cudart PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
find_library(CUDA_CUFFT_LIBRARY cufft PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(NOT TARGET CUDA::cudart)
add_library(CUDA::cudart INTERFACE IMPORTED)
endif()
set_property(TARGET CUDA::cudart PROPERTY INTERFACE_LINK_LIBRARIES ${CUDA_CUDART_LIBRARY})
set_property(TARGET CUDA::cudart PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
if(NOT TARGET CUDA::cufft)
add_library(CUDA::cufft INTERFACE IMPORTED)
endif()
set_property(TARGET CUDA::cufft PROPERTY INTERFACE_LINK_LIBRARIES ${CUDA_CUFFT_LIBRARY})
set_property(TARGET CUDA::cufft PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
endif()
endif()
if(SPFFT_ROCM)
find_dependency(hip CONFIG)
find_dependency(rocfft CONFIG)
find_dependency(hipfft CONFIG)
endif()
set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH_SAVE}) # restore module path
# add version of package
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTStaticConfigVersion.cmake")
# add library target
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTStaticTargets.cmake")
# Make MPI dependency public to compile interface depending on enabled languages
if(SPFFT_MPI)
if("CXX" IN_LIST _LANGUAGES)
target_link_libraries(SpFFT::spfft INTERFACE MPI::MPI_CXX)
endif()
if("C" IN_LIST _LANGUAGES)
if(NOT TARGET MPI::MPI_C)
find_dependency_components(MPI COMPONENTS C)
endif()
target_link_libraries(SpFFT::spfft INTERFACE MPI::MPI_C)
endif()
endif()
SpFFT-1.1.1/cmake/SpFFTTargets.cmake 0000664 0000000 0000000 00000000346 14743207756 0017014 0 ustar 00root root 0000000 0000000
# Prefer shared library
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTSharedTargets.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/SpFFTStaticTargets.cmake")
endif()
SpFFT-1.1.1/cmake/modules/ 0000775 0000000 0000000 00000000000 14743207756 0015203 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/cmake/modules/FindARMPL.cmake 0000664 0000000 0000000 00000006222 14743207756 0017663 0 ustar 00root root 0000000 0000000 # Copyright (c) 2019 ETH Zurich, Simon Frasch
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#.rst:
# FindARMPL
# -----------
#
# This module searches for the sequential 32-bit integer ARM library.
#
#
# The following variables are set
#
# ::
#
# ARMPL_FOUND - True if double precision fftw library is found
# ARMPL_LIBRARIES - The required libraries
# ARMPL_INCLUDE_DIRS - The required include directory
#
# The following import target is created
#
# ::
#
# ARM::pl
# set paths to look for ARM
set(_ARMPL_PATHS ${ARMPL_ROOT} $ENV{ARMPL_ROOT} $ENV{ARMPL_DIR})
set(_ARMPL_DEFAULT_PATH_SWITCH)
if(_ARMPL_PATHS)
# do not look at any default paths if a custom path was set
set(_ARMPL_DEFAULT_PATH_SWITCH NO_DEFAULT_PATH)
else()
set(_ARMPL_PATHS /opt/arm)
endif()
# find all ARM libraries / include directories
find_library(
ARMPL_LIBRARIES
NAMES "armpl_lp64"
HINTS ${_ARMPL_PATHS}
PATH_SUFFIXES "lib" "lib64"
${_ARMPL_DEFAULT_PATH_SWITCH}
)
find_path(ARMPL_INCLUDE_DIRS
NAMES "fftw3.h"
HINTS ${_ARMPL_PATHS}
PATH_SUFFIXES "include" "include/fftw" "fftw"
${_ARMPL_DEFAULT_PATH_SWITCH}
)
# check if found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ARMPL REQUIRED_VARS ARMPL_LIBRARIES ARMPL_INCLUDE_DIRS)
# add target to link against
if(ARMPL_FOUND)
# create interface target
if(NOT TARGET ARM::pl)
add_library(ARM::pl INTERFACE IMPORTED)
endif()
set_property(TARGET ARM::pl PROPERTY INTERFACE_LINK_LIBRARIES ${ARMPL_LIBRARIES})
set_property(TARGET ARM::pl PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ARMPL_INCLUDE_DIRS})
endif()
# prevent clutter in gui
MARK_AS_ADVANCED(ARMPL_LIBRARIES ARMPL_INCLUDE_DIRS)
SpFFT-1.1.1/cmake/modules/FindFFTW.cmake 0000664 0000000 0000000 00000006444 14743207756 0017564 0 ustar 00root root 0000000 0000000 # Copyright (c) 2019 ETH Zurich, Simon Frasch
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#.rst:
# FindFFTW
# -----------
#
# This module looks for the fftw3 library.
#
# The following variables are set
#
# ::
#
# FFTW_FOUND - True if double precision fftw library is found
# FFTW_LIBRARIES - The required libraries
# FFTW_INCLUDE_DIRS - The required include directory
#
# The following import target is created
#
# ::
#
# FFTW::FFTW
# set paths to look for library
set(_FFTW_PATHS ${FFTW_ROOT} $ENV{FFTW_ROOT})
set(_FFTW_INCLUDE_PATHS)
set(_FFTW_DEFAULT_PATH_SWITCH)
if(_FFTW_PATHS)
# disable default paths if ROOT is set
set(_FFTW_DEFAULT_PATH_SWITCH NO_DEFAULT_PATH)
else()
# try to detect location with pkgconfig
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKG_FFTW QUIET "fftw3")
endif()
set(_FFTW_PATHS ${PKG_FFTW_LIBRARY_DIRS})
set(_FFTW_INCLUDE_PATHS ${PKG_FFTW_INCLUDE_DIRS})
endif()
find_library(
FFTW_LIBRARIES
NAMES "fftw3"
HINTS ${_FFTW_PATHS}
PATH_SUFFIXES "lib" "lib64"
${_FFTW_DEFAULT_PATH_SWITCH}
)
find_path(FFTW_INCLUDE_DIRS
NAMES "fftw3.h"
HINTS ${_FFTW_PATHS} ${_FFTW_INCLUDE_PATHS}
PATH_SUFFIXES "include" "include/fftw"
${_FFTW_DEFAULT_PATH_SWITCH}
)
# check if found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTW REQUIRED_VARS FFTW_INCLUDE_DIRS FFTW_LIBRARIES )
# add target to link against
if(FFTW_FOUND)
if(NOT TARGET FFTW::FFTW)
add_library(FFTW::FFTW INTERFACE IMPORTED)
endif()
set_property(TARGET FFTW::FFTW PROPERTY INTERFACE_LINK_LIBRARIES ${FFTW_LIBRARIES})
set_property(TARGET FFTW::FFTW PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${FFTW_INCLUDE_DIRS})
endif()
# prevent clutter in cache
MARK_AS_ADVANCED(FFTW_FOUND FFTW_LIBRARIES FFTW_INCLUDE_DIRS pkgcfg_lib_PKG_FFTW_fftw3)
SpFFT-1.1.1/cmake/modules/FindFFTWF.cmake 0000664 0000000 0000000 00000006557 14743207756 0017677 0 ustar 00root root 0000000 0000000 # Copyright (c) 2019 ETH Zurich, Simon Frasch
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#.rst:
# FindFFTWF
# -----------
#
# This module looks for the fftw3f library.
#
# The following variables are set
#
# ::
#
# FFTWF_FOUND - True if single precision fftw library is found
# FFTWF_LIBRARIES - The required libraries
# FFTWF_INCLUDE_DIRS - The required include directory
#
# The following import target is created
#
# ::
#
# FFTWF::FFTWF
# set paths to look for library
set(_FFTWF_PATHS ${FFTW_ROOT} $ENV{FFTW_ROOT} ${FFTWF_ROOT} $ENV{FFTWF_ROOT})
set(_FFTWF_INCLUDE_PATHS)
set(_FFTWF_DEFAULT_PATH_SWITCH)
if(_FFTWF_PATHS)
# disable default paths if ROOT is set
set(_FFTWF_DEFAULT_PATH_SWITCH NO_DEFAULT_PATH)
else()
# try to detect location with pkgconfig
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKG_FFTWF QUIET "fftw3")
endif()
set(_FFTWF_PATHS ${PKG_FFTWF_LIBRARY_DIRS})
set(_FFTWF_INCLUDE_PATHS ${PKG_FFTWF_INCLUDE_DIRS})
endif()
find_library(
FFTWF_LIBRARIES
NAMES "fftw3f"
HINTS ${_FFTWF_PATHS}
PATH_SUFFIXES "lib" "lib64"
${_FFTWF_DEFAULT_PATH_SWITCH}
)
find_path(FFTWF_INCLUDE_DIRS
NAMES "fftw3.h"
HINTS ${_FFTWF_PATHS} ${_FFTWF_INCLUDE_PATHS}
PATH_SUFFIXES "include" "include/fftw"
${_FFTWF_DEFAULT_PATH_SWITCH}
)
# check if found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTWF REQUIRED_VARS FFTWF_INCLUDE_DIRS FFTWF_LIBRARIES )
# add target to link against
if(FFTWF_FOUND)
if(NOT TARGET FFTWF::FFTWF)
add_library(FFTWF::FFTWF INTERFACE IMPORTED)
endif()
set_property(TARGET FFTWF::FFTWF PROPERTY INTERFACE_LINK_LIBRARIES ${FFTWF_LIBRARIES})
set_property(TARGET FFTWF::FFTWF PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${FFTWF_INCLUDE_DIRS})
endif()
# prevent clutter in cache
MARK_AS_ADVANCED(FFTWF_FOUND FFTWF_LIBRARIES FFTWF_INCLUDE_DIRS pkgcfg_lib_PKG_FFTWF_fftw3)
SpFFT-1.1.1/cmake/modules/FindMKLSequential.cmake 0000664 0000000 0000000 00000013133 14743207756 0021465 0 ustar 00root root 0000000 0000000 # Copyright (c) 2019 ETH Zurich, Simon Frasch
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#.rst:
# FindMKLSequential
# -----------
#
# This module searches for the sequential 32-bit integer MKL library.
# Only looks for static libraries by default.
#
#
# The following variables are set
#
# ::
#
# MKLSequential_FOUND - True if double precision fftw library is found
# MKLSequential_LIBRARIES - The required libraries
# MKLSequential_INCLUDE_DIRS - The required include directory
# MKLSequential_FFTW_INCLUDE_DIRS - The required fftw interface include directory
#
# The following import target is created
#
# ::
#
# MKL::Sequential
# set paths to look for MKL
set(_MKLSequential_PATHS ${MKLSequential_ROOT} $ENV{MKLROOT})
set(_MKLSequential_INCLUDE_PATHS)
set(_MKLSequential_DEFAULT_PATH_SWITCH)
if(_MKLSequential_PATHS)
# do not look at any default paths if a custom path was set
set(_MKLSequential_DEFAULT_PATH_SWITCH NO_DEFAULT_PATH)
else()
# try to detect location with pkgconfig
if(NOT MKLSequential_ROOT)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
# look for dynmic module, such that a -L flag can be parsed
pkg_check_modules(PKG_MKL QUIET "mkl-dynamic-lp64-seq")
set(_MKLSequential_PATHS ${PKG_MKL_LIBRARY_DIRS})
set(_MKLSequential_INCLUDE_PATHS ${PKG_MKL_INCLUDE_DIRS})
endif()
endif()
endif()
# find all MKL libraries / include directories
find_library(
_MKLSequential_INT_LIB
NAMES "mkl_intel_lp64"
HINTS ${_MKLSequential_PATHS}
PATH_SUFFIXES "intel64_lin" "intel64" "lib/intel64_lin" "lib/intel64"
${_MKLSequential_DEFAULT_PATH_SWITCH}
)
find_library(
_MKLSequential_SEQ_LIB
NAMES "mkl_sequential"
HINTS ${_MKLSequential_PATHS}
PATH_SUFFIXES "intel64_lin" "intel64" "lib/intel64_lin" "lib/intel64"
${_MKLSequential_DEFAULT_PATH_SWITCH}
)
find_library(
_MKLSequential_CORE_LIB
NAMES "mkl_core"
HINTS ${_MKLSequential_PATHS}
PATH_SUFFIXES "intel64_lin" "intel64" "lib/intel64_lin" "lib/intel64"
${_MKLSequential_DEFAULT_PATH_SWITCH}
)
find_path(MKLSequential_INCLUDE_DIRS
NAMES "mkl.h"
HINTS ${_MKLSequential_PATHS} ${_MKLSequential_INCLUDE_PATHS}
PATH_SUFFIXES "include"
${_MKLSequential_DEFAULT_PATH_SWITCH}
)
find_path(MKLSequential_FFTW_INCLUDE_DIRS
NAMES "fftw3.h"
HINTS ${_MKLSequential_PATHS} ${_MKLSequential_INCLUDE_PATHS}
PATH_SUFFIXES "include" "include/fftw" "fftw"
${_MKLSequential_DEFAULT_PATH_SWITCH}
)
# check if found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKLSequential REQUIRED_VARS _MKLSequential_INT_LIB
_MKLSequential_SEQ_LIB _MKLSequential_CORE_LIB MKLSequential_INCLUDE_DIRS MKLSequential_FFTW_INCLUDE_DIRS)
# add target to link against
if(MKLSequential_FOUND)
# libries have inter-dependencies, therefore use link group on Linux
if(UNIX AND NOT APPLE)
set(MKLSequential_LIBRARIES "-Wl,--start-group" ${_MKLSequential_INT_LIB} ${_MKLSequential_SEQ_LIB} ${_MKLSequential_CORE_LIB} "-Wl,--end-group")
else()
set(MKLSequential_LIBRARIES ${_MKLSequential_INT_LIB} ${_MKLSequential_SEQ_LIB} ${_MKLSequential_CORE_LIB})
endif()
# external libries required on unix
if(UNIX)
list(APPEND MKLSequential_LIBRARIES -lpthread -lm -ldl)
endif()
# create interface target
if(NOT TARGET MKL::Sequential)
add_library(MKL::Sequential INTERFACE IMPORTED)
endif()
set_property(TARGET MKL::Sequential PROPERTY INTERFACE_LINK_LIBRARIES ${MKLSequential_LIBRARIES})
set_property(TARGET MKL::Sequential PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MKLSequential_INCLUDE_DIRS} ${MKLSequential_FFTW_INCLUDE_DIRS})
endif()
# prevent clutter in gui
MARK_AS_ADVANCED(MKLSequential_FOUND MKLSequential_LIBRARIES MKLSequential_INCLUDE_DIRS
_MKLSequential_INT_LIB _MKLSequential_SEQ_LIB _MKLSequential_CORE_LIB MKLSequential_FFTW_INCLUDE_DIRS
_MKLSequential_DEFAULT_PATH_SWITCH _MKLSequential_PATHS)
MARK_AS_ADVANCED(pkgcfg_lib_PKG_MKL_dl pkgcfg_lib_PKG_MKL_m pkgcfg_lib_PKG_MKL_mkl_core
pkgcfg_lib_PKG_MKL_mkl_sequential pkgcfg_lib_PKG_MKL_mkl_intel_lp64 pkgcfg_lib_PKG_MKL_pthread)
SpFFT-1.1.1/docs/ 0000775 0000000 0000000 00000000000 14743207756 0013403 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/docs/Doxyfile 0000664 0000000 0000000 00000000754 14743207756 0015117 0 ustar 00root root 0000000 0000000 PROJECT_NAME = "SpFFT"
XML_OUTPUT = xml
INPUT = ../include
INCLUDE_PATH = ../include ../src
GENERATE_LATEX = NO
GENERATE_MAN = NO
GENERATE_RTF = NO
CASE_SENSE_NAMES = NO
GENERATE_HTML = NO
GENERATE_XML = YES
RECURSIVE = YES
QUIET = YES
JAVADOC_AUTOBRIEF = YES
WARN_IF_UNDOCUMENTED = NO
MACRO_EXPANSION = YES
PREDEFINED = "SPFFT_MPI" "SPFFT_SINGLE_PRECISION" "SPFFT_EXPORT"
EXTRACT_PRIVATE = NO
EXTRACT_ALL = YES
SpFFT-1.1.1/docs/Makefile 0000664 0000000 0000000 00000001111 14743207756 0015035 0 ustar 00root root 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
SpFFT-1.1.1/docs/images/ 0000775 0000000 0000000 00000000000 14743207756 0014650 5 ustar 00root root 0000000 0000000 SpFFT-1.1.1/docs/images/logo_cscs.png 0000664 0000000 0000000 00000021137 14743207756 0017335 0 ustar 00root root 0000000 0000000 PNG
IHDR ' ? tEXtSoftware Adobe ImageReadyqe<