Commit 9adf398d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

lock call to fftw_plan_dft_r2c_1d().

parent 9c949eb9
......@@ -7,12 +7,14 @@
#endif
#include <vector>
#include <mutex>
#include "cdo_output.h"
#include "cdo_options.h"
#include "cdo_fctrans.h"
#include "cimdOmp.h"
static std::mutex fftw_mutex;
void
fc2gp(double *fc, double *gp, long nlat, long nlon, long nfc)
......@@ -31,6 +33,7 @@ fc2gp(double *fc, double *gp, long nlat, long nlon, long nfc)
{
ompmem[i].in_fft = fftw_alloc_complex(nlon / 2 + 1);
ompmem[i].out_fft = (double*) fftw_malloc(nlon*sizeof(double));
std::unique_lock<std::mutex> locked_mutex(fftw_mutex);
ompmem[i].plan = fftw_plan_dft_c2r_1d(nlon, ompmem[i].in_fft, ompmem[i].out_fft, FFTW_ESTIMATE);
}
......@@ -90,6 +93,7 @@ gp2fc(const double *gp, double *fc, long nlat, long nlon, long nfc)
{
ompmem[i].in_fft = (double*) fftw_malloc(nlon*sizeof(double));
ompmem[i].out_fft = fftw_alloc_complex(nlon / 2 + 1);
std::unique_lock<std::mutex> locked_mutex(fftw_mutex);
ompmem[i].plan = fftw_plan_dft_r2c_1d(nlon, ompmem[i].in_fft, ompmem[i].out_fft, FFTW_ESTIMATE);
}
......
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