|Visual Studio Community 2017||CMake|
|Intel Parallel Studio XE 2019||CUDA Toolkit|
Firstly, you should unpack installation package of gromacs, then, choosing the path of ‘Where is the source code’ and ‘Where is build the binaries’. Next, click
Configure button, then we choose ‘Visual Studio 15 2017 Win64’ option by drop-down list and using default native compliers(cl). If you use other VS version, you need match the corresponding option. The figure as follow:
Finish button, waiting…,, then some errors may occur, a common error is ‘Cannot find FFTW 3’. Here, you are able to assign the path of MKL include and MKL library after choosing GMX_FFT_LIBRARY to
MKL. For example, as follow:
GPU is optional, if you want to compile GPU version, you should open the option of GMX_GPU to ON. Next, re-clicking
Configure button until you pass cmake or no error, now you can click
Note: I don’t recommend you use CMake version 3.14, because some error will occur. You can find it in this website, I was also in trouble while using 3.14 version.
Open Gromacs.sln file in your build path, then choosing
Release option on toolbar. You should right click on
gmx solution to choose
Use Intel C++. Finally, right click again to choose
build option, now we need wait a long until finish. Then, you can right click
INSTALL solution to install compiled .exe file to default path(you can find it in C:/Program Files/Gromacs folder).
You can find the below file after compiling finish.
After setting up correct environment variable on windows, you can use it as below:
I found that the GPU version of GROMACS 5.X could be compiled successfully, but GROMACS 2016/2018.X version only could compile CPU version, not GPU version. It reminds error information
error : identifier "c_oneSixth" is undefined,..., it also was found in this website. I can not find a good way to solve this question.
cmake .. E:/User-software/gromacs-2016.4 -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS=\"/machine:x64\" -DCMAKE_INSTALL_PREFIX=E:\User-software\gromacs -DGMX_COMPILER_WARNINGS=ON -DGMX_DEFAULT_SUFFIX=OFF -DGMX_FFT_LIBRARY=mkl -DMKL_INCLUDE_DIR="D:\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include" -DMKL_LIBRARIES="D:\IntelSWTools\compilers_and_libraries_2016.4.246\windows\mkl\lib\intel64_win\mkl_core.lib;D:\IntelSWTools\compilers_and_libraries_2016.4.246\windows\mkl\lib\intel64_win\mkl_intel_lp64.lib;D:\IntelSWTools\compilers_and_libraries_2016.4.246\windows\mkl\lib\intel64_win\mkl_sequential.lib;D:\IntelSWTools\compilers_and_libraries_2016.4.246\windows\mkl\lib\intel64_win\mkl_intel_thread.lib;D:\IntelSWTools\compilers_and_libraries_2016.4.246\windows\compiler\lib\intel64_win\libiomp5md.lib" -DGMX_GPU=OFF -DGMX_USE_RDTSCP=DETECT
cmake --build . --target INSTALL --config Release
Solution one: Reference material. Simple note: CUDA does not recognize static const float that defined floating point type, you can change
__constant__ for solving it. the changed file is:
changed it to the below:
static __constant__ float c_oneSixth = 0.16666667f;
static __constant__ float c_oneTwelveth = 0.08333333f;
Solution two: Recently, when compiling the Windows gromacs2019.1-gpu version (the compilation process is more time-consuming than the previous version), I found that there was no the above error. When looking at the source code, I found that this section has been changed to the CUDA global variable bug mention, as below:
static const float __device__ c_oneSixth = 0.16666667f;
static const float __device__ c_oneTwelveth = 0.08333333f;
but also met other question[only occur in VS2017 RTW 15.0], the final I solve it.
When you use CMake, the error is CUDA compiler does not seem to be functional, but in fact CUDA is no problem. You could add Control options
GMX_NVCC_WORKS=ON in order to skip nvcc detection, now cmake will pass correctly. When in the compiling process, undefined M_PI problem occurred, this is because the constant is not defined in the VS-related header file, the problem can be found bug. The approach given by the developers is to add
#include <math_constants.h> into src/gromacs/ewald/pme-solve.cu file and change
CUDART_PI_F. It can be seen that the software compiled on different platforms is quite different. Gromacs source code has been constantly updated and improved.
When you cmake, add
-Xcompiler "/wd 4819" word into CUDA_NVCC_FLAGS
Here, I have provided two simple installation scripts. If your previous software environment has been configured correctly, you can use Microsoft MKL library or FFTW library to compile CPU/GPU version of gromacs 5.x/2016.x/2018.x/2019.x.
Note: MKL library is not recommended, there is no advantages compared with FFTW , and configuration is also troublesome, FFTW software is small, fast compilation; When compiling with VS, it is highly recommended to use the Intel C++ compiler instead of the C++ compiler from VS. The Intel C++ compiler maximizes the efficiency of the software.
We noticed that the compiling efficiency is very low by the above setting, that is gromacs is compilied via a single core of CPU. In order to improve the utilization of CPU, we need install JOM or Ninja on Windows, it supports the execution of multiple independent commands in parallel. It is very easy to install on Windows. Finally, you should open VS command prompt (X64) to use Cmake command the above mentioned. Here, you are supposed to replace
-G "Visual Studio 15 2017 Win64" with
-G "NMake Makefiles JOM" or "Ninja". Yes! Now you will use all cores of CPU to compile gromacs by
cmake --build . --target INSTALL --config Release -j 4, the 4 indicates your core number.
After installing GROMACS on Linux we usually requires simple tests. For example, you can add the
-DREGRESSIONTEST_DOWNLOAD=ON option when you
cmake on Linux. You can download test package on Windows, such as the 2019.3 version of http://gerrit.gromacs.org/download/regressiontests-2019.3.tar.gz. Uncompressing and executing
./gmxtest.pl all or
perl gmxtest.pl all to test all cases.
 How to install GROMACS in Windows without Cygwin
 I need to install GROMACS on windows 10, 64 bit system. Can anyone help me with a step by step tutorial?
 Using constant in CUDA kernel: works with int, fails to compile with float