Skip to content

Commit

Permalink
OpenCL support in VkFFT
Browse files Browse the repository at this point in the history
-This update adds OpenCL backend in VkFFT (VKFFT_BACKEND 3)
-OpenCL backend has similar performance compared to other backends
-devices key works on all backends now
-Major release
  • Loading branch information
DTolm committed Apr 13, 2021
1 parent c890960 commit 15fd2ed
Show file tree
Hide file tree
Showing 4 changed files with 1,150 additions and 313 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(Vulkan_FFT)
set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
set(VKFFT_BACKEND 0)#0 - Vulkan, 1 - CUDA, 2 - HIP
set(VKFFT_BACKEND 0)#0 - Vulkan, 1 - CUDA, 2 - HIP, 3 - OpenCL

if(${VKFFT_BACKEND} EQUAL 1)
option(build_VkFFT_cuFFT_benchmark "Build VkFFT cuFFT benchmark" ON)
Expand Down Expand Up @@ -59,6 +59,8 @@ elseif(${VKFFT_BACKEND} EQUAL 2)
set_target_properties(hiprt PROPERTIES
INTERFACE_LINK_LIBRARIES ${HIP_hiprtc_LIBRARY}
)
elseif(${VKFFT_BACKEND} EQUAL 3)
find_package(OpenCL REQUIRED)
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC -DVK_API_VERSION=11)#10 - Vulkan 1.0, 11 - Vulkan 1.1, 12 - Vulkan 1.2
if(${VKFFT_BACKEND} EQUAL 0)
Expand All @@ -78,6 +80,8 @@ elseif(${VKFFT_BACKEND} EQUAL 1)
target_link_libraries(${PROJECT_NAME} PUBLIC cuda ${CUDA_NVRTC_LIB} VkFFT half)
elseif(${VKFFT_BACKEND} EQUAL 2)
target_link_libraries(${PROJECT_NAME} PUBLIC hip::host VkFFT half)
elseif(${VKFFT_BACKEND} EQUAL 3)
target_link_libraries(${PROJECT_NAME} PUBLIC OpenCL::OpenCL VkFFT half)
endif()

if(build_VkFFT_FFTW_precision)
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.com/DTolm/VkFFT.svg?token=nMgUQeqx7PXMeCFaXqsb&branch=master)](https://travis-ci.com/github/DTolm/VkFFT)
# VkFFT - Vulkan/CUDA/HIP Fast Fourier Transform library
VkFFT is an efficient GPU-accelerated multidimensional Fast Fourier Transform library for Vulkan/CUDA/HIP projects. VkFFT aims to provide community with an open-source alternative to Nvidia's cuFFT library, while achieving better performance. VkFFT is written in C language and supports Vulkan, CUDA and HIP as backends.
VkFFT is an efficient GPU-accelerated multidimensional Fast Fourier Transform library for Vulkan/CUDA/HIP/OpenCL projects. VkFFT aims to provide community with an open-source alternative to Nvidia's cuFFT library, while achieving better performance. VkFFT is written in C language and supports Vulkan, CUDA, HIP and OpenCL as backends.

## Join my panel at Nvidia's GTC 2021 in Higher Education and Research category on April 13th, 2021: https://gtc21.event.nvidia.com/

Expand All @@ -23,7 +23,7 @@ VkFFT is an efficient GPU-accelerated multidimensional Fast Fourier Transform li
- Multiple feature/batch convolutions - one input, multiple kernels
- Multiple input/output/temporary buffer split. Allows to use data split between different memory allocations and mitigate 4GB single allocation limit.
- Works on Nvidia, AMD and Intel GPUs (tested on Nvidia RTX 3080, GTX 1660 Ti, AMD Radeon VII and Intel UHD 620)
- VkFFT supports Vulkan, CUDA and HIP as backend to cover wide range of APIs
- VkFFT supports Vulkan, CUDA, HIP and OpenCL as backend to cover wide range of APIs
- Header-only library with Vulkan interface, which allows to append VkFFT directly to user's command buffer. Shaders are compiled once during the plan creation stage
## Future release plan
- ##### Planned
Expand All @@ -41,6 +41,9 @@ CUDA/HIP:
Include the vkFFT.h file and make sure your system has NVRTC/HIPRTC built. Provide the library with correctly chosen VKFFT_BACKEND definition. Only single/double precision for now.\
To build CUDA/HIP version of benchmark, replace VKFFT_BACKEND in CMakeLists (line 5) with the correct one and optionally enable FFTW. VKFFT_BACKEND=1 for CUDA, VKFFT_BACKEND=2 for HIP.

OpenCL:
Include the vkFFT.h file. Provide the library with correctly chosen VKFFT_BACKEND definition. Only single/double precision for now.\
To build OpenCL version of benchmark, replace VKFFT_BACKEND in CMakeLists (line 5) with the value 3 and optionally enable FFTW.
## Command-line interface
VkFFT has a command-line interface with the following set of commands:\
-h: print help\
Expand Down
Loading

0 comments on commit 15fd2ed

Please sign in to comment.