mirror of https://github.com/EspoTek/Labrador.git
feat : adding multithreading support for faster DFT
Signed-off-by: Vincenzo Petrolo <vincenzo@kernel-space.org>
This commit is contained in:
parent
55ec7bde96
commit
827da5f145
|
@ -354,3 +354,9 @@ DISTFILES += \
|
|||
build_android/package_source/gradle/wrapper/gradle-wrapper.properties \
|
||||
build_android/package_source/gradlew.bat \
|
||||
build_android/package_source/res/xml/device_filter.xml
|
||||
|
||||
unix|win32: LIBS += -lomp
|
||||
|
||||
unix|win32: LIBS += -lfftw3f_omp
|
||||
|
||||
unix|win32: LIBS += -lfftw3_threads
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <math.h>
|
||||
#include "daqloadprompt.h"
|
||||
#include <iostream>
|
||||
#include <omp.h>
|
||||
|
||||
isoDriver::isoDriver(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
|
@ -35,10 +36,17 @@ isoDriver::isoDriver(QWidget *parent) : QLabel(parent)
|
|||
connect(slowTimer, SIGNAL(timeout()), this, SLOT(slowTimerTick()));
|
||||
|
||||
/*Creating DFT plan*/
|
||||
fftw_init_threads();
|
||||
fftw_plan_with_nthreads(omp_get_max_threads());
|
||||
std::cout << "Starting with " << omp_get_max_threads() << "threads" << std::endl;
|
||||
this->N = 1<<17;
|
||||
this->N *= omp_get_max_threads();
|
||||
this->in_buffer = fftw_alloc_real(N);
|
||||
this->out_buffer = fftw_alloc_complex(N);
|
||||
std::cout << in_buffer << " " << out_buffer << " " << N<< std::endl;
|
||||
this->plan = fftw_plan_dft_r2c_1d(N,in_buffer, out_buffer,0);
|
||||
std::cout << plan << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void isoDriver::setDriver(genericUsbDriver *newDriver){
|
||||
|
@ -667,7 +675,7 @@ QVector<double> isoDriver::getFrequencies()
|
|||
double delta_freq = ((double) 375000)/ ((double) N);
|
||||
QVector<double> f(max_freq);
|
||||
|
||||
for (int i = 0; i*delta_freq < max_freq; i++) {
|
||||
for (int i = 0; i < max_freq; i++) {
|
||||
f[i] = i*delta_freq;
|
||||
}
|
||||
return f;
|
||||
|
|
|
@ -131,6 +131,7 @@ private:
|
|||
double *in_buffer;
|
||||
fftw_complex *out_buffer;
|
||||
int N;
|
||||
double maximum = -1;
|
||||
|
||||
|
||||
//Generic Functions
|
||||
|
|
Loading…
Reference in New Issue