Skip to content

Commit

Permalink
Merge pull request #33 from eth-cscs/release/0.9.11
Browse files Browse the repository at this point in the history
Release 0.9.11
  • Loading branch information
AdhocMan authored Jun 15, 2020
2 parents 0a02ef6 + 8f59406 commit 7917698
Show file tree
Hide file tree
Showing 31 changed files with 1,414 additions and 742 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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-18.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@v2


- 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
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzvf cmake-3.11.4-Linux-x86_64.tar.gz
- 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} ${HOME}/cmake-3.11.4-Linux-x86_64/bin/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} ${HOME}/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPFFT_BUILD_TESTS=ON -DSPFFT_OMP=${USE_OMP} -DSPFFT_MPI=${USE_MPI} -DSPFFT_SINGLE_PRECISION=${USE_FLOAT} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
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-18.04
container: nvidia/cuda:9.2-devel-ubuntu18.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2

- name: Install dependencies
run: |
apt-get update
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.14.6/cmake-3.14.6-Linux-x86_64.tar.gz && tar -xzvf cmake-3.14.6-Linux-x86_64.tar.gz
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
${HOME}/cmake-3.14.6-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-18.04
container: adhocman/master:ubuntu18.04_rocm

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2

- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
/root/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPFFT_BUILD_TESTS=ON -DSPFFT_GPU_BACKEND=ROCM
make -j2
69 changes: 0 additions & 69 deletions CI/azure_templates/ubuntu_build_test.yml

This file was deleted.

15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.11 FATAL_ERROR) # 3.11 to avoid issues with OpenMP + CUDA
project(SpFFT LANGUAGES CXX VERSION 0.9.10)
project(SpFFT LANGUAGES CXX VERSION 0.9.11)
set(SPFFT_SO_VERSION 0)
set(SPFFT_VERSION ${PROJECT_VERSION})

Expand Down Expand Up @@ -110,10 +110,15 @@ endif()

# ROCM
if(SPFFT_ROCM)
find_package(ROCM REQUIRED COMPONENTS rocfft)
list(APPEND SPFFT_EXTERNAL_INCLUDE_DIRS ${ROCM_INCLUDE_DIRS})
list(APPEND SPFFT_EXTERNAL_LIBS ${ROCM_LIBRARIES})
list(APPEND SPFFT_EXTERNAL_COMPILE_OPTIONS ${ROCM_DEFINITIONS})
if(NOT HIP_HCC_FLAGS)
message(STATUS "Using default AMD gpu targets: gfx803, gfx900, gfx906. Set HIP_HCC_FLAGS to override.")
set(HIP_HCC_FLAGS ${HIP_HCC_FLAGS} --amdgpu-target=gfx803 --amdgpu-target=gfx900 --amdgpu-target=gfx906)
endif()
find_package(HIP REQUIRED)
find_package(HIPLIBS REQUIRED)
find_package(ROCFFT REQUIRED)
list(APPEND SPFFT_EXTERNAL_LIBS HIPLIBS::hiplibs ROCFFT::rocfft)
list(APPEND SPFFT_EXTERNAL_COMPILE_OPTIONS -D__HIP_PLATFORM_HCC__) # required for parsing HIP headers with another compiler
endif()


Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[![Build Status](https://dev.azure.com/zeadreamplay/SpFFT/_apis/build/status/eth-cscs.SpFFT?branchName=master)](https://dev.azure.com/zeadreamplay/SpFFT/_build/latest?definitionId=3&branchName=master)
[![CI](https://github.com/eth-cscs/SpFFT/workflows/CI/badge.svg)](https://github.com/eth-cscs/SpFFT/actions?query=workflow%3ACI)
[![Documentation](https://readthedocs.org/projects/spfft/badge/?version=latest)](https://spfft.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](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.

It was originally intended for transforms of data with spherical cutoff in frequency domain, as required by some computational material science codes.
For distributed computations, SpFFT uses a slab decomposition in space domain and pencil decomposition in frequency domain (all sparse data within a pencil must be on one rank).
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.

<img src="docs/images/sparse_to_dense.png" alt="" width=70% />

Expand All @@ -15,17 +14,17 @@ For distributed computations, SpFFT uses a slab decomposition in space domain an
### Design Goals
- Sparse frequency domain input
- Reuse of pre-allocated memory
- Support of negative indexing for frequency domain data
- 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.
- Support of Complex-To-Real and Real-To-Complex transforms, where the full hermitian symmetry property is utilized
- C++, C and Fortran interfaces
- Parallelization and acceleration are optional

### Interface Design
To allow for pre-allocation and reuse of memory, the design is based on two classes:

- **Grid**: Allocates memory for transforms up to a given size in each dimension.
- **Transform**: Is associated with a *Grid* and can have any size up to the *Grid* dimensions. A *Transform* holds a counted reference to the underlying *Grid*. Therefore, *Transforms* created with the same *Grid* share memory, which is only freed, once the *Grid* and all associated *Transforms* are destroyed.
- **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.

The user provides memory for storing sparse frequency domain data, while a *Transform* provides memory for space domain data. This implies, that executing a *Transform* will override the space domain data of all other *Transforms* associated with the same *Grid*.

Expand Down Expand Up @@ -159,3 +158,12 @@ int main(int argc, char** argv) {
return 0;
}
```
## Acknowledgements
This work was supported by:
|![ethz](docs/images/logo_ethz.png) | [**Swiss Federal Institute of Technology in Zurich**](https://www.ethz.ch/) |
|:----:|:----:|
|![cscs](docs/images/logo_cscs.png) | [**Swiss National Supercomputing Centre**](https://www.cscs.ch/) |
|![max](docs/images/logo_max.png) | [**MAterials design at the eXascale**](http://www.max-centre.eu) <br> (Horizon2020, grant agreement MaX CoE, No. 824143) |
69 changes: 0 additions & 69 deletions azure-pipelines.yml

This file was deleted.

Loading

0 comments on commit 7917698

Please sign in to comment.