SigPack - the C++ signal processing library
fftw_wisdom.cpp

Output

Armadillo FFT Time = 0.74614
FFTW Time without Wisdom = 0.49901
FFTW Time using Wisdom = 0.00612

Source

#include <sigpack.h>
using namespace arma;
using namespace sp;
int main()
{
int r = 480, c = 640;
mat x(r, c);
cx_mat X(r, c);
clock_t tic;
FFTW X_2d(r, c, FFTW_MEASURE);
x.randn();
tic = clock();
X = fft2(x);
cout << "Armadillo FFT Time = " << (clock() - tic) / double(CLOCKS_PER_SEC)
<< endl;
tic = clock();
X = X_2d.fft2(x);
cout << "FFTW Time without Wisdom = "
<< (clock() - tic) / double(CLOCKS_PER_SEC) << endl;
// X_2d.export_wisdom_fft("wisd_fft.txt");
// This string is generated by the export command above and is depending upon
// the FFTW version used, in this case fftw-3.3.7. Run the code once with the
// export command and the copy-paste the result into this string. It is also
// possible to generate a string from the shell using the program fftw-wisdom
// distributed with FFTW
std::string str_fft = "\
(fftw-3.3.7 fftw_wisdom #x458a31c8 #x92381c4c #x4f974889 #xcd46f97e\
(fftw_codelet_n2fv_12_avx 0 #x11048 #x11048 #x0 #xe63b0d4a #x2d9149fa #xf85a1f1c #xc30b3a35)\
(fftw_rdft_rank0_register 3 #x11048 #x11048 #x0 #x0503b83a #xa613f39e #x68f44fe7 #xb1187709)\
(fftw_rdft2_rank_geq2_register 0 #x11048 #x11048 #x0 #x02ea06f0 #x38d222a8 #xdd69f756 #xc618b279)\
(fftw_dft_buffered_register 1 #x11048 #x11048 #x0 #x1018de6d #x760edbc0 #xadb405fb #x3390a6e1)\
(fftw_codelet_t2fv_20_avx 0 #x10048 #x10048 #x0 #xcb73b984 #xa427b33a #x8f9f8732 #x7ddc99ba)\
(fftw_rdft2_vrank_geq1_register 0 #x11048 #x11048 #x0 #x5fbfaf8d #xd7c71ef8 #xc763e411 #x2a1d804b)\
(fftw_codelet_t2fv_20_avx 0 #x10048 #x10048 #x0 #x93f6ac9f #xb6a8adef #x1dfa04d9 #xe36ce49f)\
(fftw_codelet_r2cfII_2 2 #x11048 #x11048 #x0 #x7d87470c #x9a8fa84e #x594d1b19 #xe33421cd)\
(fftw_codelet_n1fv_32_avx 0 #x10048 #x10048 #x0 #x164b6574 #x2c9c5928 #xe0a745e3 #x6cebe34e)\
(fftw_dft_vrank_geq1_register 0 #x10048 #x10048 #x0 #xb8817807 #x285b63d1 #x6c69df43 #x7657d381)\
(fftw_dft_nop_register 0 #x11048 #x11048 #x0 #x76bbd3bc #xcfeb9088 #x9e21b533 #x49182bb0)\
(fftw_codelet_hc2cfdftv_2_avx 0 #x11048 #x11048 #x0 #x273e2b42 #x6f57ae52 #xfd23a4a9 #x578e3fd1)\
(fftw_dft_vrank_geq1_register 0 #x10048 #x10048 #x0 #x9484389e #xb1d48973 #xc6f25524 #x386a033e)\
(fftw_codelet_t2fv_20_avx 0 #x11048 #x11048 #x0 #x2fa8abef #x5e475335 #xecc229c3 #xd0ff9ce7)\
(fftw_dft_buffered_register 1 #x11048 #x11048 #x0 #x892c8da0 #x656dbb26 #x57f5fc08 #x575b950d)\
(fftw_dft_r2hc_register 0 #x11048 #x11048 #x0 #xcfc85bc7 #x6656bbe9 #x69ffc792 #x091d5626)\
(fftw_codelet_n1fv_32_avx 0 #x10048 #x10048 #x0 #xd681cd5f #x8fe52eb4 #x852c46ca #x1e56c7af)\
(fftw_dft_r2hc_register 0 #x11048 #x11048 #x0 #x85b9734d #x4ae376c3 #x46085432 #xf7704875)\
(fftw_rdft_rank0_register 3 #x11048 #x11048 #x0 #x879bab0b #x8eaa8bd8 #x3ad6b15f #x662e2260)\
(fftw_codelet_r2cf_2 2 #x11048 #x11048 #x0 #x055f68ee #x109fc123 #x55f761d7 #xb3cf78c3))";
X_2d.import_wisdom_string(str_fft);
// X_2d.import_wisdom_file("wisd_fft.txt");
tic = clock();
X = X_2d.fft2(x);
cout << "FFTW Time using Wisdom = "
<< (clock() - tic) / double(CLOCKS_PER_SEC) << endl;
return 0;
}