From c9131cf1de48a52fc2ad86dd67ffcbd91eaeaf9a Mon Sep 17 00:00:00 2001 From: "Steven J. Plimpton" <sjplimp@singsing.sandia.gov> Date: Wed, 15 Aug 2018 13:54:37 -0600 Subject: [PATCH] drop FFTW2 support, and change doc pages --- doc/src/Build_settings.txt | 32 ++++++++------------------- src/KSPACE/fft3d.cpp | 14 +++++++++++- src/KSPACE/fft3d.h | 44 +++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/doc/src/Build_settings.txt b/doc/src/Build_settings.txt index 6c36420f77..db281c0857 100644 --- a/doc/src/Build_settings.txt +++ b/doc/src/Build_settings.txt @@ -33,27 +33,25 @@ LAMMPS can use them if they are available on your system. [CMake variables]: --D FFT=value # KISS or FFTW3 or FFTW2 or MKL, default is FFTW3 if found, else KISS +-D FFT=value # FFTW3 or MKL or KISS, default is FFTW3 if found, else KISS -D FFT_SINGLE=value # yes or no (default), no = double precision -D FFT_PACK=value # array (default) or pointer or memcpy :pre -NOTE: The values for the FFT variable must be in upper-case. -This is an exception to the rule that all CMake variables can -be specified with lower-case values. +NOTE: The values for the FFT variable must be in upper-case. This is +an exception to the rule that all CMake variables can be specified +with lower-case values. Usually these settings are all that is needed. If CMake cannot find the FFT library, you can set these variables: -D FFTW3_INCLUDE_DIRS=path # path to FFTW3 include files -D FFTW3_LIBRARIES=path # path to FFTW3 libraries --D FFTW2_INCLUDE_DIRS=path # ditto for FFTW2 --D FFTW2_LIBRARIES=path -D MKL_INCLUDE_DIRS=path # ditto for Intel MKL library -D MKL_LIBRARIES=path :pre [Makefile.machine settings]: -FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW2, -DFFT_FFTW (same as -DFFT_FFTW3), -DFFT_MKL, or -DFFT_KISS +FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW (same as -DFFT_FFTW3), -DFFT_MKL, or -DFFT_KISS # default is KISS if not specified FFT_INC = -DFFT_SINGLE # do not specify for double precision FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY :pre @@ -63,8 +61,6 @@ FFT_INC = -I/usr/local/include FFT_PATH = -L/usr/local/lib FFT_LIB = -lfftw3 # FFTW3 double precision FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision -FFT_LIB = -lfftw # FFTW2 double precision, or -ldfftw -FFT_LIB = -lsfftw # FFTW2 single precision FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compier :pre @@ -89,13 +85,9 @@ details. FFTW is a fast, portable FFT library that should also work on any platform and can be faster than the KISS FFT library. You can -download it from "www.fftw.org"_http://www.fftw.org. Both the -(obsolete) legacy version 2.1.X and the newer 3.X versions are -supported. +download it from "www.fftw.org"_http://www.fftw.org. LAMMPS requires +version 3.X; the legacy version 2.1.X is no longer supported. -NOTE: FFTW2 has not been updated since 1999 and has been declared -obsolete by its developers. - Building FFTW for your box should be as simple as ./configure; make; make install. The install command typically requires root privileges (e.g. invoke it via sudo), unless you specify a local directory with @@ -116,8 +108,8 @@ error is less than the difference in precision. Using the -DFFT_SINGLE setting trades off a little accuracy for reduced memory use and parallel communication costs for transposing 3d FFT data. -When using -DFFT_SINGLE with FFTW3 or FFTW2, you may need to build the -FFTW library a second time with support for single-precision. +When using -DFFT_SINGLE with FFTW3 you may need to build the FFTW +library a second time with support for single-precision. For FFTW3, do the following, which should produce the additional library libfftw3f.a @@ -125,12 +117,6 @@ library libfftw3f.a make clean ./configure --enable-single; make; make install :pre -For FFTW2, do the following, which should produce the additional -library libsfftw.a - -make clean -./configure --enable-float --enable-type-prefix; make; make install :pre - Performing 3d FFTs requires communication to transpose the 3d FFT grid. The data packing/unpacking for this can be done in one of 3 modes (ARRAY, POINTER, MEMCPY) as set by the FFT_PACK syntax above. diff --git a/src/KSPACE/fft3d.cpp b/src/KSPACE/fft3d.cpp index db44feabcc..7d3c8c83f2 100644 --- a/src/KSPACE/fft3d.cpp +++ b/src/KSPACE/fft3d.cpp @@ -104,11 +104,13 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan) DftiComputeForward(plan->handle_fast,data); else DftiComputeBackward(plan->handle_fast,data); + /* #elif defined(FFT_FFTW2) if (flag == -1) fftw(plan->plan_fast_forward,total/length,data,1,length,NULL,0,0); else - fftw(plan->plan_fast_backward,total/length,data,1,length,NULL,0,0); + fftw(plan->plan_fast_backward,total/length,data,1,length,NULL,0,0); + */ #elif defined(FFT_FFTW3) if (flag == -1) theplan=plan->plan_fast_forward; @@ -143,11 +145,13 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan) DftiComputeForward(plan->handle_mid,data); else DftiComputeBackward(plan->handle_mid,data); + /* #elif defined(FFT_FFTW2) if (flag == -1) fftw(plan->plan_mid_forward,total/length,data,1,length,NULL,0,0); else fftw(plan->plan_mid_backward,total/length,data,1,length,NULL,0,0); + */ #elif defined(FFT_FFTW3) if (flag == -1) theplan=plan->plan_mid_forward; @@ -182,11 +186,13 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan) DftiComputeForward(plan->handle_slow,data); else DftiComputeBackward(plan->handle_slow,data); + /* #elif defined(FFT_FFTW2) if (flag == -1) fftw(plan->plan_slow_forward,total/length,data,1,length,NULL,0,0); else fftw(plan->plan_slow_backward,total/length,data,1,length,NULL,0,0); + */ #elif defined(FFT_FFTW3) if (flag == -1) theplan=plan->plan_slow_forward; @@ -520,6 +526,7 @@ struct fft_plan_3d *fft_3d_create_plan( (out_khi-out_klo+1); } + /* #elif defined(FFT_FFTW2) plan->plan_fast_forward = @@ -561,6 +568,7 @@ struct fft_plan_3d *fft_3d_create_plan( plan->normnum = (out_ihi-out_ilo+1) * (out_jhi-out_jlo+1) * (out_khi-out_klo+1); } + */ #elif defined(FFT_FFTW3) plan->plan_fast_forward = @@ -660,6 +668,7 @@ void fft_3d_destroy_plan(struct fft_plan_3d *plan) DftiFreeDescriptor(&(plan->handle_fast)); DftiFreeDescriptor(&(plan->handle_mid)); DftiFreeDescriptor(&(plan->handle_slow)); + /* #elif defined(FFT_FFTW2) if (plan->plan_slow_forward != plan->plan_fast_forward && plan->plan_slow_forward != plan->plan_mid_forward) { @@ -672,6 +681,7 @@ void fft_3d_destroy_plan(struct fft_plan_3d *plan) } fftw_destroy_plan(plan->plan_fast_forward); fftw_destroy_plan(plan->plan_fast_backward); + */ #elif defined(FFT_FFTW3) FFTW_API(destroy_plan)(plan->plan_slow_forward); FFTW_API(destroy_plan)(plan->plan_slow_backward); @@ -809,6 +819,7 @@ void fft_1d_only(FFT_DATA *data, int nsize, int flag, struct fft_plan_3d *plan) DftiComputeBackward(plan->handle_mid,data); DftiComputeBackward(plan->handle_slow,data); } + /* #elif defined(FFT_FFTW2) if (flag == -1) { fftw(plan->plan_fast_forward,total1/length1,data,1,0,NULL,0,0); @@ -819,6 +830,7 @@ void fft_1d_only(FFT_DATA *data, int nsize, int flag, struct fft_plan_3d *plan) fftw(plan->plan_mid_backward,total2/length2,data,1,0,NULL,0,0); fftw(plan->plan_slow_backward,total3/length3,data,1,0,NULL,0,0); } + */ #elif defined(FFT_FFTW3) FFTW_API(plan) theplan; if (flag == -1) diff --git a/src/KSPACE/fft3d.h b/src/KSPACE/fft3d.h index ab3bca8358..a51818d986 100644 --- a/src/KSPACE/fft3d.h +++ b/src/KSPACE/fft3d.h @@ -24,7 +24,7 @@ typedef float FFT_SCALAR; typedef double FFT_SCALAR; #endif -// set default fftw library. switch to FFT_FFTW3 when convenient. +// if user set FFTW, it means FFTW3 #ifdef FFT_FFTW #define FFT_FFTW3 @@ -41,13 +41,13 @@ typedef double FFT_SCALAR; typedef float _Complex FFT_DATA; #define FFT_MKL_PREC DFTI_SINGLE -#elif defined(FFT_FFTW2) -#if defined(FFTW_SIZE) -#include "sfftw.h" -#else -#include "fftw.h" -#endif -typedef FFTW_COMPLEX FFT_DATA; +//#elif defined(FFT_FFTW2) +//#if defined(FFTW_SIZE) +//#include "sfftw.h" +//#else +//#include "fftw.h" +//#endif +//typedef FFTW_COMPLEX FFT_DATA; #elif defined(FFT_FFTW3) #include "fftw3.h" @@ -82,13 +82,13 @@ typedef struct kiss_fft_state* kiss_fft_cfg; typedef double _Complex FFT_DATA; #define FFT_MKL_PREC DFTI_DOUBLE -#elif defined(FFT_FFTW2) -#if defined(FFTW_SIZE) -#include "dfftw.h" -#else -#include "fftw.h" -#endif -typedef FFTW_COMPLEX FFT_DATA; +//#elif defined(FFT_FFTW2) +//#if defined(FFTW_SIZE) +//#include "dfftw.h" +//#else +//#include "fftw.h" +//#endif +//typedef FFTW_COMPLEX FFT_DATA; #elif defined(FFT_FFTW3) #include "fftw3.h" @@ -139,13 +139,13 @@ struct fft_plan_3d { DFTI_DESCRIPTOR *handle_fast; DFTI_DESCRIPTOR *handle_mid; DFTI_DESCRIPTOR *handle_slow; -#elif defined(FFT_FFTW2) - fftw_plan plan_fast_forward; - fftw_plan plan_fast_backward; - fftw_plan plan_mid_forward; - fftw_plan plan_mid_backward; - fftw_plan plan_slow_forward; - fftw_plan plan_slow_backward; +//#elif defined(FFT_FFTW2) +// fftw_plan plan_fast_forward; +// fftw_plan plan_fast_backward; +// fftw_plan plan_mid_forward; +// fftw_plan plan_mid_backward; +//fftw_plan plan_slow_forward; +//fftw_plan plan_slow_backward; #elif defined(FFT_FFTW3) FFTW_API(plan) plan_fast_forward; FFTW_API(plan) plan_fast_backward; -- GitLab