File: fftwmanager.cpp

package info (click to toggle)
wsclean 2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,196 kB
  • sloc: cpp: 34,504; ansic: 234; python: 174; makefile: 10
file content (37 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "fftwmanager.h"

#include "system.h"

#include <iostream>

#include <fftw3.h>

FFTWManager::FFTWManager(bool verbose) :
	_multiThreadEnabledDepth(0),
	_verbose(verbose),
	_nThreads(std::min(System::ProcessorCount(), 4u))
{ }

FFTWManager::FFTWManager(size_t nThreads, bool verbose) :
	_multiThreadEnabledDepth(0),
	_verbose(verbose),
	_nThreads(nThreads)
{ }

FFTWManager::~FFTWManager()
{
	fftw_cleanup_threads();
}

void FFTWManager::activateMultipleThreads()
{
	if(_verbose)
		std::cout << "Setting FFTW to use " << _nThreads << " threads.\n";
	fftw_init_threads();
	fftw_plan_with_nthreads(_nThreads);
}

void FFTWManager::endMultipleThreads()
{
	fftw_plan_with_nthreads(1);
}