Commit b60b0c08 by Francois Gygi

FFTW3 modifications

git-svn-id: http://qboxcode.org/svn/qb/branches/fftw3@1528 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 1132a458
......@@ -22,7 +22,11 @@
#include <complex>
#include <vector>
#if USE_FFTW
#if defined(USE_FFTW2) && defined(USE_FFTW3)
#error
#endif
#if USE_FFTW2
#if USE_DFFTW
#include "dfftw.h"
#else
......@@ -30,6 +34,13 @@
#endif
#endif
#if USE_FFTW3
#include "fftw3.h"
#if USE_FFTW3MKL
#include "fftw3_mkl.h"
#endif
#endif
#if USE_MPI
#include <mpi.h>
#endif
......@@ -65,17 +76,26 @@ class FourierTransform
#if USE_ESSL
#if USE_ESSL_2DFFT
std::vector<double> aux1xyf;
std::vector<double> aux1xyb;
int naux1xy;
std::vector<double> aux1xyf,aux1zf;
std::vector<double> aux1xyb,aux1zb;
std::vector<double> aux2;
int naux1xy,naux1z,naux2;
#else
std::vector<double> aux1xf, aux1yf, aux1zf;
std::vector<double> aux1xb, aux1yb, aux1zb;
std::vector<double> aux2;
int naux1x,naux1y,naux1z,naux2;
#endif
#elif USE_FFTW || USE_FFTW3
#elif USE_FFTW2
fftw_plan fwplan0,fwplan1,fwplan2,bwplan0,bwplan1,bwplan2;
#elif USE_FFTW3
//plans for np2_
fftw_plan fwplan, bwplan;
#if defined(USE_FFTW3_2D) || defined(USE_FFTW3_THREADS)
fftw_plan fwplan2d, bwplan2d;
#else
fftw_plan fwplanx, fwplany, bwplanx, bwplany;
#endif
#else
// no library
#endif
......@@ -124,6 +144,10 @@ class FourierTransform
void reset_timers(void);
Timer tm_f_map, tm_f_fft, tm_f_pack, tm_f_mpi, tm_f_zero, tm_f_unpack,
tm_b_map, tm_b_fft, tm_b_pack, tm_b_mpi, tm_b_zero, tm_b_unpack;
tm_b_map, tm_b_fft, tm_b_pack, tm_b_mpi, tm_b_zero, tm_b_unpack,
tm_f_xy, tm_f_z, tm_f_x, tm_f_y,
tm_b_xy, tm_b_z, tm_b_x, tm_b_y,
tm_init, tm_b_com, tm_f_com;
};
#endif
......@@ -201,6 +201,14 @@ SampleStepper.o EnergyFunctional.o
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
test_spline: test_spline.o spline.o $(PLTOBJECTS)
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
testfftw2: testfftw2.o $(PLTOBJECTS)
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
testfftw3: testfftw3.o $(PLTOBJECTS)
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
testfftw3mkl: testfftw3mkl.o $(PLTOBJECTS)
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
testessl: testessl.o $(PLTOBJECTS)
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
#------------------------------------------------------------------------------
# generate dependencies in makefile: use -Y to avoid library header files
# that are likely to be different on other platforms.
......
--------------------------------------------------------------------------------
r1506: Fixed typo in AlphaPBE0.h
--------------------------------------------------------------------------------
rel1_60_2
CGCellStepper.C: revert to 1.60.0 use of matrix transformations
Use reduced alpha_init (0.002)
--------------------------------------------------------------------------------
rel1_60_1
CGCellStepper.C: fixed incorrect use of amat_inv() in calc of gradient.
Note: use was correct. later restored.
CGCellStepper.C: reduced initial alpha value to 0.01, max to 0.5.
--------------------------------------------------------------------------------
qbox_msd.py: print msd value only, not step index
--------------------------------------------------------------------------------
Context.C: fixed deprecated cast to const char*
--------------------------------------------------------------------------------
rel1_60_0
Added alpha_PBE0 variable
--------------------------------------------------------------------------------
......
......@@ -15,27 +15,37 @@
// sinft.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: sinft.C,v 1.4 2008-09-08 15:56:20 fgygi Exp $
#include "sinft.h"
#include <math.h>
#include <assert.h>
#if USE_FFTW
#if USE_FFTW2
#if USE_DFFTW
#include "dfftw.h"
#else
#include "fftw.h"
#endif
#endif
#if USE_FFTW3
#include "fftw3.h"
#endif
#include <vector>
#include <complex>
using namespace std;
void sinft(int n, double *y)
{
vector<complex<double> > zin(2*n), zout(2*n);
fftw_plan fwplan;
#if USE_FFTW2
fwplan = fftw_create_plan(2*n,FFTW_FORWARD,FFTW_ESTIMATE);
vector<complex<double> > zin(2*n), zout(2*n);
#elif USE_FFTW3
fwplan = fftw_plan_dft_1d(2*n,(fftw_complex*)&zin[0],(fftw_complex*)&zout[0],
FFTW_FORWARD, FFTW_ESTIMATE);
#else
#error
#endif
zin[0] = 0.0;
for ( int i = 1; i < n; i++ )
{
......@@ -43,7 +53,13 @@ void sinft(int n, double *y)
zin[i] = t;
zin[2*n-i] = -t;
}
#if USE_FFTW2
fftw_one(fwplan,(fftw_complex*)&zin[0],(fftw_complex*)&zout[0]);
#elif USE_FFTW3
fftw_execute(fwplan);
#else
#error
#endif
for ( int i = 0; i < n; i++ )
{
y[i] = -0.5 * imag(zout[i]);
......@@ -54,9 +70,16 @@ void sinft(int n, double *y)
void cosft1(int n, double *y)
{
/* Note: the array y contains n+1 elements */
vector<complex<double> > zin(2*n), zout(2*n);
fftw_plan fwplan;
#if USE_FFTW2
fwplan = fftw_create_plan(2*n,FFTW_FORWARD,FFTW_ESTIMATE);
vector<complex<double> > zin(2*n), zout(2*n);
#elif USE_FFTW3
fwplan = fftw_plan_dft_1d(2*n,(fftw_complex*)&zin[0],(fftw_complex*)&zout[0],
FFTW_FORWARD, FFTW_ESTIMATE);
#else
#error
#endif
zin[0] = y[0];
for ( int i = 1; i < n+1; i++ )
......@@ -65,7 +88,13 @@ void cosft1(int n, double *y)
zin[i] = t;
zin[2*n-i] = t;
}
#if USE_FFTW2
fftw_one(fwplan,(fftw_complex*)&zin[0],(fftw_complex*)&zout[0]);
#elif USE_FFTW3
fftw_execute(fwplan);
#else
#error
#endif
y[0] = 0.5 * real(zout[0]);
for ( int i = 1; i < n; i++ )
{
......
......@@ -16,6 +16,7 @@
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
#include "Basis.h"
......@@ -142,7 +143,7 @@ int main(int argc, char **argv)
cout << " backward done " << endl;
MPI_Barrier(MPI_COMM_WORLD);
#if 0
#if 1
tm.reset();
ft2.reset_timers();
......
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