diff --git a/include/finufft/fftw_defs.h b/include/finufft/fftw_defs.h index 1771ff259..fd010f964 100644 --- a/include/finufft/fftw_defs.h +++ b/include/finufft/fftw_defs.h @@ -38,11 +38,13 @@ #define FFTW_INIT FFTWIFY(init_threads) #define FFTW_PLAN_TH FFTWIFY(plan_with_nthreads) #define FFTW_CLEANUP_THREADS FFTWIFY(cleanup_threads) +#define FFTW_GET_NTHREADS FFTWIFY(planner_nthreads) #else // no OMP (no fftw{f}_threads or _omp), need dummy fftw threads calls... #define FFTW_INIT() #define FFTW_PLAN_TH(x) #define FFTW_CLEANUP_THREADS() +#define FFTW_GET_NTHREADS() #endif #endif // FFTW_DEFS_H diff --git a/src/finufft.cpp b/src/finufft.cpp index b71acce87..4a8fdf49e 100644 --- a/src/finufft.cpp +++ b/src/finufft.cpp @@ -760,10 +760,12 @@ int FINUFFT_MAKEPLAN(int type, int dim, BIGINT *n_modes, int iflag, int ntrans, // set it just for our one plan and then revert to the user value. // Unfortunately fftw_planner_nthreads wasn't introduced until fftw 3.3.9, and // there isn't a convenient mechanism to probe the version + int prev_nthr_fft = FFTW_GET_NTHREADS(); FFTW_PLAN_TH(nthr_fft); p->fftwPlan = FFTW_PLAN_MANY_DFT(dim, ns, p->batchSize, (FFTW_CPX *)p->fwBatch, NULL, 1, p->nf, (FFTW_CPX *)p->fwBatch, NULL, 1, p->nf, p->fftSign, p->opts.fftw); + FFTW_PLAN_TH(prev_nthr_fft); } if (p->opts.debug) printf("[%s] FFTW plan (mode %d, nthr=%d):\t%.3g s\n", __func__, p->opts.fftw,