Commit 060c3897 authored by Jan Oliver Oelerich's avatar Jan Oliver Oelerich

Default FFTW planning is now FFTW_MEASURE. This speeds up things even more.

parent 6ea73704
......@@ -109,7 +109,7 @@ namespace stemsalabim {
typedef std::vector<std::complex<float>, fftwAllocator<std::complex<float>>> data_type;
fftwf_plan getFwdPlan(unsigned int lx, unsigned int ly, bool quick_planning = false) {
fftwf_plan getFwdPlan(unsigned int lx, unsigned int ly) {
std::unique_lock<std::mutex> lck(_cache_mtx);
auto key = std::make_tuple(lx, ly);
......@@ -117,12 +117,12 @@ namespace stemsalabim {
if(_fwd_cache.count(key) > 0)
return _fwd_cache.at(key);
_fwd_cache[key] = makePlan(lx, ly, false, quick_planning);
_fwd_cache[key] = makePlan(lx, ly, false);
return _fwd_cache[key];
}
fftwf_plan getBwdPlan(unsigned int lx, unsigned int ly, bool quick_planning = false) {
fftwf_plan getBwdPlan(unsigned int lx, unsigned int ly) {
std::unique_lock<std::mutex> lck(_cache_mtx);
auto key = std::make_tuple(lx, ly);
......@@ -130,7 +130,7 @@ namespace stemsalabim {
if(_bwd_cache.count(key) > 0)
return _bwd_cache.at(key);
_bwd_cache[key] = makePlan(lx, ly, true, quick_planning);
_bwd_cache[key] = makePlan(lx, ly, true);
return _bwd_cache[key];
}
......@@ -142,14 +142,14 @@ namespace stemsalabim {
}
}
fftwf_plan makePlan(unsigned int lx, unsigned int ly, bool backward = false, bool quick = false) {
fftwf_plan makePlan(unsigned int lx, unsigned int ly, bool backward = false) {
data_type d(lx * ly, std::complex<float>(1.0, 0.0));
return fftwf_plan_dft_2d(lx,
ly,
reinterpret_cast<fftwf_complex *>(&d[0]),
reinterpret_cast<fftwf_complex *>(&d[0]),
backward ? FFTW_FORWARD : FFTW_BACKWARD,
quick ? FFTW_ESTIMATE : FFTW_PATIENT);
FFTW_ESTIMATE);
}
~FFTWCache() {
......@@ -350,7 +350,7 @@ namespace stemsalabim {
void forwardFFT() {
_is_kspace = true;
auto &fftw_cache = FFTWCache::getInstance();
fftwf_plan p = fftw_cache.getFwdPlan(_lx, _ly, _fftw_quick_planning);
fftwf_plan p = fftw_cache.getFwdPlan(_lx, _ly);
fftwf_execute_dft(p,
reinterpret_cast<fftwf_complex *>(&_data[0]),
reinterpret_cast<fftwf_complex *>(&_data[0]));
......@@ -363,10 +363,6 @@ namespace stemsalabim {
_data.clear();
}
void fftwQuickPlanning(bool quick) {
_fftw_quick_planning = quick;
}
/*!
* Returns if the WF is initialized.
* @return true if initialized
......@@ -382,7 +378,7 @@ namespace stemsalabim {
_is_kspace = false;
auto &fftw_cache = FFTWCache::getInstance();
fftwf_plan p = fftw_cache.getBwdPlan(_lx, _ly, _fftw_quick_planning);
fftwf_plan p = fftw_cache.getBwdPlan(_lx, _ly);
fftwf_execute_dft(p,
reinterpret_cast<fftwf_complex *>(&_data[0]),
reinterpret_cast<fftwf_complex *>(&_data[0]));
......@@ -437,7 +433,6 @@ namespace stemsalabim {
unsigned int _ly{0};
bool _is_kspace{false};
bool _fftw_quick_planning{false};
bool _initialized{false};
FFTWCache::data_type _data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment