kandi X-RAY | gpyfft Summary
kandi X-RAY | gpyfft Summary
A Python wrapper for the OpenCL FFT library clFFT.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gpyfft
gpyfft Key Features
gpyfft Examples and Code Snippets
Community Discussions
Trending Discussions on gpyfft
QUESTION
General Overview of Program: The majority of the code here creates the FrameProcessor object. This object is initialized with some data shape, generally 2048xN, and can then be called to process the data using a series of kernels (proc_frame). For each vector of length 2048 the program will:
- Apply a Hanning window (elementwise multiplication 2048*2048)
- Do a linear interpolation to remap values (to map to linear-in-wavenumber space from non-linear spectrometer bins which signal is derived from--not too important of a detail but I figured it would be good to include in case it was unclear)
- Apply an FFT
Problem: I want to go faster! The code below is not performing poorly, but for this project I need it to be as fast as it can possibly be. However, I am unsure on how I might make further improvements to this code. So, I'm looking for suggestions on relevant reading, alternate libraries which I should use, changes to code structure, etc.
Current Performance: On my rig with a GeForce RTX 2080 the benchmarks I get (with n=60, which seems to give best performance) are:
...ANSWER
Answered 2020-Jan-17 at 01:42Copying my reply in the Reikna group for reference.
- Create a reikna Thread object from whatever pyopencl queue you want it to use (probably the one associated with the arrays you want to pass to FFT)
- Create an FFT computation based on this Thread
- Pass your pyopencl arrays to it without any conversion. (you can create a reikna array based on the buffer from a pyopencl array, by passing it as
base_data
keyword, but if using FFT is all you need, that is not necessary).Reikna threads are wrappers on top of pyopencl context + queue, and reikna arrays are subclasses of pyopencl arrays, so the interop should be pretty simple.
Applying this (in a quick and dirty way, feel free to improve), I get: https://gist.github.com/fjarri/f781d3695b7c6678856110cced95be40 . Basically, the changes are:
- creating a
Thread
out of the existingqueue
(self.thr = self.api.Thread(self.queue)
) - using the PyOpenCL buffer in FFT without copying it to CPU.
The results I get:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gpyfft
You can use gpyfft like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page