Commits

Ville Suoranta authored d8541f26bde Merge
Merge pull request #361 in CASA/casa6 from CAS-13440 to release/6.1.3

* commit '7cbb42994bbcf140ab1bdf23e50be57f3098681b': restore fftw thread plan based on OMP_NUM_THREADS (CAS-13342)
No tags

casa5/gcwrap/tools/utils/utils_cmpt.cc

Modified
30 30 #include <stdcasa/StdCasa/CrashReporter.h>
31 31 #endif
32 32 #include <stdlib.h>
33 33 #include <signal.h>
34 34 #include <string>
35 35 #include <vector>
36 36 #include <cstdlib>
37 37 #include <casacore/casa/Quanta/UnitMap.h>
38 38 #include <casatools/Config/State.h>
39 39 #ifdef CASATOOLS
40 +#include <fftw3.h>
41 +#ifdef _OPENMP
42 +#include <omp.h>
43 +#endif
44 +#include <casacore/scimath/Mathematics/FFTW.h>
40 45 #include <asdmstman/AsdmStMan.h>
41 46 #include <casacore/derivedmscal/DerivedMC/Register.h>
42 47 #include <toolversion.h>
43 48 #endif
44 49
45 50 using namespace std;
46 51 using namespace casacore;
47 52 using namespace casa;
48 53
49 54 using namespace casacore;
423 428 #endif
424 429 static bool initialized = false;
425 430 if ( initialized ) return false;
426 431 default_data_path = default_path;
427 432 python_path = pypath;
428 433 casatools::get_state( ).setDataPath(default_data_path);
429 434 casatools::get_state( ).setDistroDataPath(distro_data);
430 435 casatools::get_state( ).setPythonPath(python_path);
431 436 // configure quanta/measures customizations...
432 437 UnitMap::putUser( "pix", UnitVal(1.0), "pixel units" );
438 +
433 439 #ifdef CASATOOLS
434 440 casa::AsdmStMan::registerClass( );
435 441 register_derivedmscal();
442 +
443 + // --- --- --- configure fftw --- CAS-13342 --- --- --- --- --- --- --- ---
444 + casacore::FFTW init_casacore_fftw;
445 +#ifdef _OPENMP
446 + int numCPUs = omp_get_max_threads();
447 +#else
448 + int numCPUs = HostInfo::numCPUs();
449 +#endif
450 + int nthreads = 1;
451 + if (numCPUs > 1) {
452 + nthreads = numCPUs;
453 + }
454 + fftwf_plan_with_nthreads(nthreads);
455 + fftw_plan_with_nthreads(nthreads);
436 456 #endif
437 457 initialized = true;
438 458 return true;
439 459 }
440 460
441 461 // ------------------------------------------------------------
442 462 // -------------------- handling data path --------------------
443 463 std::vector<std::string> utils::defaultpath( ) {
444 464 return default_data_path;
445 465 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut