diff --git a/cmake/Modules/Packages/KSPACE.cmake b/cmake/Modules/Packages/KSPACE.cmake index 7e40e50941..9c9c879cd4 100644 --- a/cmake/Modules/Packages/KSPACE.cmake +++ b/cmake/Modules/Packages/KSPACE.cmake @@ -49,18 +49,18 @@ endif() option(FFT_USE_HEFFTE "Use heFFTe as the distributed FFT engine, overrides the FFT option." OFF) if(FFT_USE_HEFFTE) # if FFT_HEFFTE is enabled, switch the builtin FFT engine with Heffte - set(HEFFTE_BACKEND_VALUES FFTW MKL) - set(HEFFTE_BACKEND "" CACHE STRING "Select heFFTe backend, e.g., FFTW or MKL") - set_property(CACHE HEFFTE_BACKEND PROPERTY STRINGS ${HEFFTE_BACKEND_VALUES}) + set(FFT_HEFFTE_BACKEND_VALUES FFTW MKL) + set(FFT_HEFFTE_BACKEND "" CACHE STRING "Select heFFTe backend, e.g., FFTW or MKL") + set_property(CACHE FFT_HEFFTE_BACKEND PROPERTY STRINGS ${FFT_HEFFTE_BACKEND_VALUES}) - if(HEFFTE_BACKEND STREQUAL "FFTW") # respect the backend choice, FFTW or MKL + if(FFT_HEFFTE_BACKEND STREQUAL "FFTW") # respect the backend choice, FFTW or MKL set(HEFFTE_COMPONENTS "FFTW") set(Heffte_ENABLE_FFTW "ON" CACHE BOOL "Enables FFTW backend for heFFTe") - elseif(HEFFTE_BACKEND STREQUAL "MKL") + elseif(FFT_HEFFTE_BACKEND STREQUAL "MKL") set(HEFFTE_COMPONENTS "MKL") set(Heffte_ENABLE_MKL "ON" CACHE BOOL "Enables MKL backend for heFFTe") else() - message(WARNING "HEFFTE_BACKEND not selected, defaulting to the builtin 'stock' backend, which is intended for testing and is not optimized for production runs") + message(WARNING "FFT_HEFFTE_BACKEND not selected, defaulting to the builtin 'stock' backend, which is intended for testing and is not optimized for production runs") endif() find_package(Heffte 2.4.0 QUIET COMPONENTS ${HEFFTE_COMPONENTS}) @@ -78,7 +78,7 @@ if(FFT_USE_HEFFTE) target_link_libraries(Heffte::Heffte INTERFACE Heffte) endif() - target_compile_definitions(lammps PRIVATE -DLMP_HEFFTE "-DHEFFTE_${HEFFTE_BACKEND}") + target_compile_definitions(lammps PRIVATE -DFFT_HEFFTE "-DFFT_HEFFTE_${FFT_HEFFTE_BACKEND}") target_link_libraries(lammps PRIVATE Heffte::Heffte) endif() diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 630be1d8eb..d0004da606 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -83,7 +83,7 @@ better pipelining for packing and communication. -D MKL_INCLUDE_DIR=path # ditto for Intel MKL library -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries -D MKL_LIBRARY=path # path to MKL libraries - -D HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock backend + -D FFT_HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock backend -D Heffte_ROOT=path # path to an existing heFFTe installation @@ -126,15 +126,15 @@ better pipelining for packing and communication. .. code-block:: make include /share/heffte/HeffteMakefile.in - FFT_INC = -DLMP_HEFFTE -DHEFFTE_FFTW $(heffte_include) + FFT_INC = -DFFT_HEFFTE -DFFT_HEFFTE_FFTW $(heffte_include) FFT_PATH = FFT_LIB = $(heffte_link) $(heffte_libs) The heFFTe install path will contain `HeffteMakefile.in`. which will define the `heffte_` include variables needed to link to heFFTe from an external project using traditional make. - The `-DLMP_HEFFTE` is required to switch to using heFFTe, while the optional `-DHEFFTE_FFTW` - selects the desired heFFTe backend, e.g., `-DHEFFTE_FFTW` or `-DHEFFTE_MKL`, + The `-DFFT_HEFFTE` is required to switch to using heFFTe, while the optional `-DFFT_HEFFTE_FFTW` + selects the desired heFFTe backend, e.g., `-DFFT_HEFFTE_FFTW` or `-DFFT_HEFFTE_MKL`, omitting the variable will default to the `stock` backend. The `KISS FFT library `_ is diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index c79ba8a780..7b00543eea 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -27,7 +27,7 @@ FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow, int out_klo, int out_khi, int scaled, int permute, int *nbuf, int usecollective) : Pointers(lmp) { - #ifndef LMP_HEFFTE + #ifndef FFT_HEFFTE plan = fft_3d_create_plan(comm,nfast,nmid,nslow, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, @@ -56,7 +56,7 @@ FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow, FFT3d::~FFT3d() { - #ifndef LMP_HEFFTE + #ifndef FFT_HEFFTE fft_3d_destroy_plan(plan); #endif } @@ -65,7 +65,7 @@ FFT3d::~FFT3d() void FFT3d::compute(FFT_SCALAR *in, FFT_SCALAR *out, int flag) { - #ifndef LMP_HEFFTE + #ifndef FFT_HEFFTE fft_3d((FFT_DATA *) in,(FFT_DATA *) out,flag,plan); #else if (flag == 1) @@ -86,7 +86,7 @@ void FFT3d::compute(FFT_SCALAR *in, FFT_SCALAR *out, int flag) void FFT3d::timing1d(FFT_SCALAR *in, int nsize, int flag) { - #ifndef LMP_HEFFTE + #ifndef FFT_HEFFTE fft_1d_only((FFT_DATA *) in,nsize,flag,plan); #endif } diff --git a/src/KSPACE/fft3d_wrap.h b/src/KSPACE/fft3d_wrap.h index 505b4b195c..04b828b7de 100644 --- a/src/KSPACE/fft3d_wrap.h +++ b/src/KSPACE/fft3d_wrap.h @@ -17,18 +17,18 @@ #include "fft3d.h" // IWYU pragma: export #include "pointers.h" -#ifdef LMP_HEFFTE +#ifdef FFT_HEFFTE #include "heffte.h" // select the backend -#if defined(HEFFTE_FFTW) +#if defined(FFT_HEFFTE_FFTW) using heffte_backend = heffte::backend::fftw; -#elif defined(HEFFTE_MKL) +#elif defined(FFT_HEFFTE_MKL) using heffte_backend = heffte::backend::mkl; -#elif defined(HEFFTE_) +#else using heffte_backend = heffte::backend::stock; #endif -#endif // LMP_HEFFTE +#endif // FFT_HEFFTE namespace LAMMPS_NS { @@ -43,7 +43,7 @@ class FFT3d : protected Pointers { void timing1d(FFT_SCALAR *, int, int); private: - #ifdef LMP_HEFFTE + #ifdef FFT_HEFFTE // the heFFTe plan supersedes the internal fft_plan_3d std::unique_ptr> heffte_plan; std::vector> heffte_workspace;