Installation of gromacs 2020.4 with avx2 support

GROMACS version:2020.4
GROMACS modification: No
Dear Gromacs Users/Developers

I am trying to install gromacs 2020.4.
When I try to install with
cmake … -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=on

I get the following error

#error “compiling simd-avx2.h without avx2 support”

I looked up the error online and the suggested solution was to disable avx2 support for computers that didn’t actually support avx2.
In my case, I believe avx2 is supported.
I tried installing fftw3.3.8 from source and I can reproduce the problem, which goes away if I compile without avx2.

I would be grateful for suggestions on installing gromacs/fftw3 with avx2 support.
Thanks.

Amin.

At which point are you getting the error? Can you please provide the full error message for context?

Thanks for replying. I get the error in the ‘make’ step.
The error looks like this

Build/dft/simd/avx2/n1fv_2.c
libtool: compile: /home/amin-ub/anaconda3/bin/x86_64-conda-linux-gnu-cc -DHAVE_CONFIG_H -I. -I/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/dft/simd/avx2 -I…/…/… -I /home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/amin-ub/anaconda3/include -march=core-avx2 -mfma -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/amin-ub/anaconda3/include -MT n1fv_2.lo -MD -MP -MF .deps/n1fv_2.Tpo -c /home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/dft/simd/avx2/n1fv_2.c -fPIC -DPIC -o n1fv_2.o
In file included from /home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/dft/simd/n1f.h:21:0,
from /home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/dft/simd/avx2/…/common/n1fv_2.c:71,
from /home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/dft/simd/avx2/n1fv_2.c:3:
/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild/simd-support/simd-avx2.h:43:2: error: #error “compiling simd-avx2.h without avx2 support”
#error “compiling simd-avx2.h without avx2 support”
^~~~~
make[8]: *** [Makefile:755: n1fv_2.lo] Error 1
make[8]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build/dft/simd/avx2’
make[7]: *** [Makefile:512: all] Error 2
make[7]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build/dft/simd/avx2’
make[6]: *** [Makefile:395: all-recursive] Error 1
make[6]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build/dft/simd’
make[5]: *** [Makefile:502: all-recursive] Error 1
make[5]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build/dft’
make[4]: *** [Makefile:708: all-recursive] Error 1
make[4]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build’
make[3]: *** [Makefile:552: all] Error 2
make[3]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-build’
make[2]: *** [src/external/build-fftw/CMakeFiles/fftwBuild.dir/build.make:114: src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-stamp/fftwBuild-build] Error 2
make[2]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build’
make[1]: *** [CMakeFiles/Makefile2:1521: src/external/build-fftw/CMakeFiles/fftwBuild.dir/all] Error 2
make[1]: Leaving directory ‘/home/amin-ub/softwares/gromacs-2020.4/build’
make: *** [Makefile:163: all] Error 2

That looks like an error during FFTW build which suggests that something is not right with your compiler or build environment (or that there may be an issue with the FFTW configure scripts?).

What compiler are you using? Unless it is a recent compiler version (e.g. gcc 8 or later), I suggest to install one.

You are right. I should have been clearer in my original question. When I wrote that I tried installing fftw3.3.8 from the source and I can reproduce the problem, I meant if I just install fftw3.3.8 itself, I get the exact same error. And it disappears if I try to compile fftw without avx2 support.

I have tried using my system gcc and the compiler tools from Anaconda and both give the same result. However, both are 7.5. So, I would try to update to gcc 8 and report back.
Thanks,
Amin.

Sorry for the delay.
I updated to gcc 8 and disabled the Anaconda compiler tools and I was able to build with avx2 enabled.
The compilation goes smoothly. However, some tests fail.

The following tests FAILED:
46 - MdrunTests (Failed)
49 - MdrunMpiTests (Failed)
56 - regressiontests/complex (Failed)
59 - regressiontests/essentialdynamics (Failed)
The error seems to be
cufftPlanMany R2C plan failure (error code 5)

I can see that other users have seen similar errors with previous versions of gromacs and some solutions have been suggested on the mailing list. I will try those. Meanwhile, if someone has some suggestions, I would be really grateful.

Best,
Amin.

Those errors are not expected. You can share the content of the failures, those might help diagnosing.

However, I suggest to first try to exclude the possibility of an issue with your compilers and libraries (gcc, fftw, and CUDA installation). Figuring out whether it is a case of broken compiler or CUDA installation can be tedious, so better eliminate that first.

An easy way to do that would be to take a flash drive, transfer a plain Linux OS on it (ideally use the same operating system as the one installed on your machine), boot from that, install only the minimum necessary compoennts, e.g. gcc 8 the latest CUDA and GPU drivers, and see if the error still occurs.

Cheers,
Szilárd

Following a suggestion from the forum, I just restarted the computer tried to compile again. Now, all the tests pass.
So, the solution for me was: Update gcc to 8, disable Anaconda compiler tools and restart.
Thanks for the suggestions.

Best,
Amin.