FFTW Error in GROMACS installation with CP2K and CUDA

GROMACS version:2022.4
GROMACS modification: No
Here post your question

Hello,
I tried to install GROMACS 2022.4 on wsl2-Ubuntu 22.04 with CP2K and CUDA.

I did the following steps to install fftw, CP2K, and GROMACS after I installed the wsl2-Ubuntu in the Microsoft store.

##
fftw
./configure --prefix=/home/lzk/app/fftw3.3.8 --enable-shared --enable-static --enable-sse2 --enable-avx --enable-avx2 --enable-fma --enable-mpi --enable-threads --enable-openmp
make
make install
make clean
./configure --prefix=/home/lzk/app/fftw3.3.8 --enable-shared --enable-static --enable-float --enable-sse --enable-sse2 --enable-avx --enable-avx2 --enable-fma --enable-mpi --enable-threads --enable-openmp
make  
make install

###
cp2k
./install_cp2k_toolchain.sh --with-openmpi=install --with-plumed=install --with-openblas=install --with-scalapack=install --with-sirius=no --with-hdf5=install --with-spfft=install --with-libvdwxc=install --with-libxsmm=install --with-gsl=install --enable-cuda --libint-lmax=6 --gpu-ver=V100 --with-elpa=no --with-spla=no --with-libint=install --with-fftw=/home/lzk/app/fftw3.3.8

###
gromacs
cmake .. -DCMAKE_INSTALL_PREFIX=/home/lzk/app/gmx_qmmm_gpu -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_FFT_LIBRARY=fftw3 -DFFTWF_LIBRARY='/home/lzk/app/fftw-3.3.8/lib' -DFFTWF_INCLUDE_DIR=/home/lzk/app/fftw-3.3.8/include -DGMX_BLAS_USER=/home/lzk/app/cp2k-2022.2/tools/toolchain/install/openblas-0.3.20 -DGMX_LAPACK_USER=/home/lzk/app/cp2k-2022.2/tools/toolchain/install/scalapack-2.1.0 -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF -DGMX_CP2K=ON -DCP2K_DIR=/home/lzk/app/cp2k-2022.2/lib/local/psmp -DCP2K_LINKER_FLAGS="-Wl,--enable-new-dtags -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/openmpi-4.1.1/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/openmpi-4.1.1/lib'  -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/openblas-0.3.20/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/openblas-0.3.20/lib' -L'/home/lzk/app/fftw3.3.8/lib' -Wl,-rpath='/home/lzk/app/fftw3.3.8/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-6/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libxc-5.2.3/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libxc-5.2.3/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libxsmm-1.17/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libxsmm-1.17/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/scalapack-2.1.0/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/scalapack-2.1.0/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/COSMA-2.5.1/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/COSMA-2.5.1/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/gsl-2.7/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/gsl-2.7/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/plumed-2.8.0/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/plumed-2.8.0/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/hdf5-1.12.0/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/hdf5-1.12.0/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libvdwxc-0.4.0/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libvdwxc-0.4.0/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/spglib-1.16.2/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/spglib-1.16.2/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libvori-220621/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/libvori-220621/lib' -L'/home/lzk/app/cp2k-2022.2/tools/toolchain/install/SpFFT-1.0.6/lib' -Wl,-rpath='/home/lzk/app/cp2k-2022.2/tools/toolchain/install/SpFFT-1.0.6/lib' -lspfft -lsymspg -lvdwxc -lhdf5 -lhdf5_hl -lz -lplumed -ldl -lstdc++ -lz -ldl -lgsl -lcosma_prefixed_pxgemm -lcosma -lcosta  -lscalapack -lxsmmf -lxsmm -ldl -lpthread -lxcf03 -lxc -lint2 -lfftw3_mpi -lfftw3 -lfftw3_omp    -lopenblas -lvori -lstdc++ -lstdc++" -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.8

The test of CP2K is passed.
When I enter the CMake steps of GROMACS, I got the following error.

I think the notable part in CMakeError.log is this:

Determining if the function fftwf_plan_many_dft exists in the /home/lzk/app/fftw-3.3.8/lib failed with the following output:
Change Dir: /home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_afe5b/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_afe5b.dir/build.make CMakeFiles/cmTC_afe5b.dir/build
gmake[1]: Entering directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_afe5b.dir/CheckFunctionExists.c.o
/usr/bin/gcc   -DCHECK_FUNCTION_EXISTS=fftwf_plan_many_dft -o CMakeFiles/cmTC_afe5b.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
gmake[1]: *** No rule to make target '/home/lzk/app/fftw-3.3.8/lib', needed by 'cmTC_afe5b'.  Stop.
gmake[1]: Leaving directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_afe5b/fast] Error 2



Determining if the function fftwf_plan_many_dft_r2c exists in the /home/lzk/app/fftw-3.3.8/lib failed with the following output:
Change Dir: /home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_40690/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_40690.dir/build.make CMakeFiles/cmTC_40690.dir/build
gmake[1]: Entering directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_40690.dir/CheckFunctionExists.c.o
/usr/bin/gcc   -DCHECK_FUNCTION_EXISTS=fftwf_plan_many_dft_r2c -o CMakeFiles/cmTC_40690.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
gmake[1]: *** No rule to make target '/home/lzk/app/fftw-3.3.8/lib', needed by 'cmTC_40690'.  Stop.
gmake[1]: Leaving directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_40690/fast] Error 2



Determining if the function fftwf_plan_many_dft_c2r exists in the /home/lzk/app/fftw-3.3.8/lib failed with the following output:
Change Dir: /home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_3673d/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_3673d.dir/build.make CMakeFiles/cmTC_3673d.dir/build
gmake[1]: Entering directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3673d.dir/CheckFunctionExists.c.o
/usr/bin/gcc   -DCHECK_FUNCTION_EXISTS=fftwf_plan_many_dft_c2r -o CMakeFiles/cmTC_3673d.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
gmake[1]: *** No rule to make target '/home/lzk/app/fftw-3.3.8/lib', needed by 'cmTC_3673d'.  Stop.
gmake[1]: Leaving directory '/home/lzk/app_install/gromacs-2022.4/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_3673d/fast] Error 2

I tried reinstalling GROMACS as the preview steps with fftw3.3.10 and got the same error.
How can I solve the problem?

Thank you.
Li_Zekai

Hi Zekai,

Have you considered letting GROMACS install fftw itself with the following flag -DGMX_BUILD_OWN_FFTW=ON? This is the recommended way in the documentation.

Bests,
Jingbang

Hello Jingbang,

Thanks for your advice. I have tried this method and it would also cause an error.
I find this sentence ‘’ FFT, BLAS, and LAPACK libraries should be the same between CP2K and GROMACS." in the Installation guide part of the official documentation page.

Thank you.
Li_Zekai

Hi Li_Zekai,

Could you try to compile GROMACS for your setup but without CP2K?
Just to make sure that the problem is indeed not in the FFTW 3.3.8 that you’ve compiled separately.

Best,
Dmitry

Hi Li_Zekai,
Have you solved your problem?
If so could you explain how?
I have encountered exactly the same error installing gromacs with CP2k and CUDA.
If we remove -DGMX_GPU=CUDA from cmake command, everything works fine and it runs without any problem, otherwise I have encountered the same error.
Regards