keijiro / burstfft Goto Github PK
View Code? Open in Web Editor NEWFFT implementation in C# optimized for Unity's Burst compiler
License: The Unlicense
FFT implementation in C# optimized for Unity's Burst compiler
License: The Unlicense
Thanks for the excellent code keijiro! FWIW, as I was testing your code inside my application I noticed that as fft size continues to be increased the parallel version does eventually become faster than the serial version. For me this was around 16,384 samples (with leak detection off, burst safety checks off, and jobs debugger disabled). I am sharing this in case you want to update your README.
Parallel benchmarks...
BurstFft (length=1024) Millisecond Median:0.10 Min:0.10 Max:0.11 Avg:0.10 Std:0.01 SampleCount: 9 Sum: 0.90
BurstFft (length=8192) Millisecond Median:0.23 Min:0.22 Max:0.24 Avg:0.23 Std:0.00 SampleCount: 9 Sum: 2.04
BurstFft (length=16384) Millisecond Median:0.29 Min:0.28 Max:0.31 Avg:0.29 Std:0.01 SampleCount: 9 Sum: 2.64
BurstFft (length=65536) Millisecond Median:0.53 Min:0.53 Max:0.55 Avg:0.54 Std:0.01 SampleCount: 9 Sum: 4.82
Serial benchmarks...
BurstFft (length=1024) Millisecond Median:0.03 Min:0.03 Max:0.03 Avg:0.03 Std:0.00 SampleCount: 9 Sum: 0.23
BurstFft (length=8192) Millisecond Median:0.14 Min:0.14 Max:0.14 Avg:0.14 Std:0.00 SampleCount: 9 Sum: 1.22
BurstFft (length=16384) Millisecond Median:0.28 Min:0.28 Max:0.28 Avg:0.28 Std:0.00 SampleCount: 9 Sum: 2.49
BurstFft (length=65536) Millisecond Median:1.17 Min:1.17 Max:1.17 Avg:1.17 Std:0.00 SampleCount: 9 Sum: 10.52
Test code...
[Test, Performance]
public void BurstFft()
{
int[] LENGTHS = new int[] { 1024, 8192, 16384, 65536 };
for (var i = 0; i < LENGTHS.Length; ++i) {
var x = new float[LENGTHS[i]];
var spectrum = new float[LENGTHS[i]];
var fft = new BurstFft(x.Length);
var input = new NativeArray<float>(x.Length, Allocator.Persistent);
Measure.Method(() =>
{
AudioListener.GetOutputData(x, 0);
input.CopyFrom(x);
fft.Transform(input);
fft.Spectrum.CopyTo(spectrum);
}).SampleGroup($"BurstFft (length={LENGTHS[i]})").Run();
input.Dispose();
fft.Dispose();
}
}
Hello,
I would like to use this project in the creation of a school project and was wondering if you could add a license to this project or if I could get permission to use this code in my project ?
Thanks.
I've had a look at the code trying to use it.
Then I noticed that the jobs should not be able to run in parallel. The following code (simplified):
var handle = new FirstPassJob(...)
for(...)
handle = new DftPassJob { ... }.Schedule(..., handle);
As you can see, a bunch of jobs are created, which I assume should be run in parallel. However, each of the parallel jobs depends on the job handle of the previous loop iteration, which means all the jobs will be executed in sequence, and not in parallel. Is it correct?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.