add benchmarks for fft and fftmod
#include "num/init.h"
#include "num/ops.h"
#include "num/mdfft.h"
+#include "num/fft.h"
#include "wavelet/wavthresh.h"
@@ -442,6 +443,66 @@ static double bench_mdfft(long scale)
+static double bench_generic_fft(long dims[DIMS], unsigned long flags)
+{
+ complex float* x = md_alloc(DIMS, dims, CFL_SIZE);
+ complex float* y = md_alloc(DIMS, dims, CFL_SIZE);
+
+ md_gaussian_rand(DIMS, dims, x);
+
+ double tic = timestamp();
+
+ fft(DIMS, dims, flags, y, x);
+
+ double toc = timestamp();
+
+ md_free(x);
+ md_free(y);
+
+ return toc - tic;
+}
+
+
+
+static double bench_fft(long scale)
+{
+ long dims[DIMS] = { 1, 256 * scale, 256 * scale, 1, 1, 16, 1, 8 };
+ return bench_generic_fft(dims, 6ul);
+}
+
+
+
+
+static double bench_generic_fftmod(long dims[DIMS], unsigned long flags)
+{
+ complex float* x = md_alloc(DIMS, dims, CFL_SIZE);
+ complex float* y = md_alloc(DIMS, dims, CFL_SIZE);
+
+ md_gaussian_rand(DIMS, dims, x);
+
+ double tic = timestamp();
+
+ fftmod(DIMS, dims, flags, y, x);
+
+ double toc = timestamp();
+
+ md_free(x);
+ md_free(y);
+
+ return toc - tic;
+}
+
+
+
+static double bench_fftmod(long scale)
+{
+ long dims[DIMS] = { 1, 256 * scale, 256 * scale, 1, 1, 16, 1, 16 };
+ return bench_generic_fftmod(dims, 6ul);
+}
+
+
+
+
enum bench_indices { REPETITION_IND, SCALE_IND, THREADS_IND, TESTS_IND, BENCH_DIMS };
@@ -501,7 +562,9 @@ const struct benchmark_s {
{ bench_copy1, "copy 1" },
{ bench_copy2, "copy 2" },
{ bench_wavelet, "wavelet soft thresh" },
- { bench_mdfft, "FFT" },
+ { bench_mdfft, "(MD-)FFT" },
+ { bench_fft, "FFT" },
+ { bench_fftmod, "fftmod" },
};
