# Gromacs and cuFFT

**URL:** <https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441>\
**Category:** User discussions\
**Created:** [July 26, 2025, 5:25pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441 "2025-07-26T17:25:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![darincond](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@darincond](https://gromacs.bioexcel.eu/u/darincond)\
**Post date:** [July 26, 2025, 5:25pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/1 "2025-07-26T17:25:27Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
Here post your question

I have used this command line:

CUDACXX=/usr/local/cuda/ cmake .. -DCMAKE\_CUDA\_ARCHITECTURES=native -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_MPI=on -DGMX\_GPU=CUDA -DOCL\_ROOT=/usr/local/cuda/targets/x86\_64-linux/lib/ -DGMX\_FFT\_LIBRARY=fftw3 -DGMX\_BUILD\_OWN\_FFTW=ON -DGMX\_GPU\_FFT\_LIBRARY=cuFFT

and I get:

CMake Error at CMakeLists.txt:796 (message):  
The CUDA build only supports cuFFT GPU FFT library

– Configuring incomplete, errors occurred!

Then, I introduce the full path for cuFFT libraries:

CUDACXX=/usr/local/cuda-12.9/bin/nvcc cmake .. -DCMAKE\_CUDA\_ARCHITECTURES=native -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_MPI=on -DGMX\_GPU=CUDA -DOCL\_ROOT=/usr/local/cuda/targets/x86\_64-linux/lib/ -DGMX\_FFT\_LIBRARY=fftw3 -DGMX\_BUILD\_OWN\_FFTW=ON -DGMX\_GPU\_FFT\_LIBRARY=/usr/local/cuda/targets/x86\_64-linux/lib/

and it does not work neither, I get:

CMake Error at cmake/gmxOptionUtilities.cmake:78 (message):  
Invalid value for GMX\_GPU\_FFT\_LIBRARY:  
/usr/local/cuda/targets/x86\_64-linux/lib/cuFFT. Pick one of: cuFFT, clFFT,  
VkFFT, MKL, oneMath, rocFFT, BBFFT, none  
Call Stack (most recent call first):  
CMakeLists.txt:349 (gmx\_option\_multichoice)

– Configuring incomplete, errors occurred!

How can I solve this issue?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![al42and](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/al42and/32/1393_2.png) [@al42and](https://gromacs.bioexcel.eu/u/al42and)\
**Post date:** [July 26, 2025, 11:19pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/2 "2025-07-26T23:19:34Z")

</div>

Hi,

1. What version of GROMACS are you using?
2. Have you tried fully clearing your build directory and re-running CMake again?
3. If clearing the directory does not help, please share the full CMake output, not just the error.

> [@darincond](#):
>
> Then, I introduce the full path for cuFFT libraries:  
> …  
> `-DGMX_GPU_FFT_LIBRARY=/usr/local/cuda/targets/x86_64-linux/lib/`

This won’t work; your first approach of setting `-DGMX_GPU_FFT_LIBRARY=cuFFT` is the correct one. However, if you repeatedly try builds with different settings in the same build directory, things can get mixed up because CMake tries to reuse as much as possible from the last time, and for the developers it’s nearly impossible to test every possible order of changing things. Which is why the advice above to clear the build directory.

---

<div class="post-metadata">

**Author:** ![darincond](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@darincond](https://gromacs.bioexcel.eu/u/darincond)\
**Post date:** [July 27, 2025, 11:07am UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/3 "2025-07-27T11:07:32Z")

</div>

Hi,

Thank you for your response.

The answer are:

1. gromacs-2025.2
2. Before this answer, no
3. Clearing the directory worked… But, when I “make” the code I receive:

```auto
[92%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/selection/sm_simple.cpp.o
[92%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/selection/symrec.cpp.o
[92%] Linking CXX shared library ../../lib/libgromacs_mpi.so
/home/alejo/Downloads/gromacs-2025.2/src/gromacs/selection/selvalue.cpp: In function ‘_gmx_selvalue_reserve’:
/home/alejo/Downloads/gromacs-2025.2/src/gromacs/selection/selvalue.cpp:100:47: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  100 | val->u.p = new gmx_ana_pos_t[n];
      | ^
/usr/include/c++/13/new:128:26: note: in a call to allocation function ‘operator new []’ declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      | ^
/tmp/ccfwur6x.s: Assembler messages:
/tmp/ccfwur6x.s:5264: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:23978: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:827674: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:1466499: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:2255113: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3120776: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3145052: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3147133: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3147682: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3154581: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3155130: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3155679: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3161017: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3161566: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3173078: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3173627: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3174176: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3195389: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3195938: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3197825: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3198374: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3249615: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3250164: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3332078: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3332627: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3333176: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3333725: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3334274: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3334823: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3335372: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3335921: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3336470: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3348461: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3349010: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3349559: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3404418: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3426105: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3494922: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3495471: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3496020: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3496569: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3497118: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3497667: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3498216: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3498765: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3499314: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3499863: Error: symbol `fatbinData' is already defined
/tmp/ccfwur6x.s:3501119: Error: symbol `fatbinData' is already defined
make[3]: *** [/tmp/ccR3vE4F.mk:2: /tmp/cchJ0kpJ.ltrans0.ltrans.o] Error 1
make[3]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:14478: lib/libgromacs_mpi.so.10.0.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:4522: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
(base) alejo@alejo:~/Downloads/gromacs-2025.2/build$ 

```

How can I solve it?

Best regards,  
David

---

<div class="post-metadata">

**Author:** ![al42and](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/al42and/32/1393_2.png) [@al42and](https://gromacs.bioexcel.eu/u/al42and)\
**Post date:** [July 29, 2025, 11:16am UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/4 "2025-07-29T11:16:57Z")

</div>

Hi,

That’s a new issue. It seems something in your toolchain, likely MPI, is enabling LTO (link-time-optimization). LTO is usually a good thing (although the effects in GROMACS are minimal and we usually don’t recommend using it), but does not work all that well with CUDA.

Can you try re-running CMake with `-DCMAKE_C_FLAGS=-fno-lto -DCMAKE_CXX_FLAGS=-fno-lto -DCMAKE_SHARED_LINKER_FLAGS=-fno-lto`?

---

<div class="post-metadata">

**Author:** ![darincond](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@darincond](https://gromacs.bioexcel.eu/u/darincond)\
**Post date:** [July 30, 2025, 8:12pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/5 "2025-07-30T20:12:44Z")

</div>

Hi,

I added your suggestion:

```auto
CUDACXX=/usr/local/cuda-12.9/bin/nvcc cmake .. \
  -DGMX_BUILD_OWN_FFTW=ON \
  -DREGRESSIONTEST_DOWNLOAD=ON \
  -DGMX_MPI=ON \
  -DGMX_GPU=CUDA \
  -DCMAKE_CUDA_ARCHITECTURES="native" \
  -DCMAKE_C_COMPILER=gcc-11 \
  -DCMAKE_CXX_COMPILER=g++-11 \
  -DCMAKE_C_FLAGS="-fno-lto" \
  -DCMAKE_CXX_FLAGS="-fno-lto" \
  -DCMAKE_SHARED_LINKER_FLAGS=-fno-lto \
  -B build_gpu \
  -DGGML_CUDA=1 \
  -DCUDAToolkit_ROOT=/usr/local/cuda-12.9/bin/ \
  -DGMX_FORCE_GPU_AWARE_MPI

```

Then, I followed the instructions: “make” and “make check.” The last step of the testing process, “make check,” ends with errors. I have shared the output of the cmake process (attached), may be to find something else.

Best regards,  
David

[log.log](https://gromacs.bioexcel.eu/uploads/short-url/3XcuRMvn8k0ouRLiajoCJPIN4Cl.log) (15.9 KB)

---

<div class="post-metadata">

**Author:** ![al42and](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/al42and/32/1393_2.png) [@al42and](https://gromacs.bioexcel.eu/u/al42and)\
**Post date:** [July 30, 2025, 8:30pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/6 "2025-07-30T20:30:57Z")

</div>

If `make check` ends with an error, please attach the output from it (full, not just the list of failed tests at the end). The CMake log looks ok.

Also, `-DGGML_CUDA=1` is not used by GROMACS in any way, and `-DGMX_FORCE_GPU_AWARE_MPI` is not used at CMake time (and, since your MPI library supports CUDA-aware detection, you probably should not set this flag at runtime either, unless you’re absolutely sure that the MPI library is lying about itself).

---

<div class="post-metadata">

**Author:** ![darincond](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@darincond](https://gromacs.bioexcel.eu/u/darincond)\
**Post date:** [July 31, 2025, 7:33pm UTC](https://gromacs.bioexcel.eu/t/gromacs-and-cufft/12441/7 "2025-07-31T19:33:27Z")

</div>

Hi,  
Thank you for your comments and help, I will post a new issue with detailed logs.
