# Gromacs cmake error w/ GPU enabled

**URL:** <https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712>\
**Category:** User discussions\
**Tags:** gpu, cmake-error\
**Created:** [July 23, 2024, 1:41am UTC](https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712 "2024-07-23T01:41:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshinsato](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jshinsato](https://gromacs.bioexcel.eu/u/jshinsato)\
**Post date:** [July 23, 2024, 1:41am UTC](https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712/1 "2024-07-23T01:41:47Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No

-Building gromacs on windows using vs cmd prompt cmake.  
-Using the following gromacs source because I was running into a known error on windows that this had fixed:

> **[Files · mdi-fix-msvc-bug · GROMACS / GROMACS · GitLab](https://gitlab.com/gromacs/gromacs/-/tree/mdi-fix-msvc-bug)**
>
> The GROMACS molecular simulation toolkit.

-cmake options are:  
cmake -G"NMake Makefiles" -S. -B./build -DGMX\_FFT\_LIBRARIES=fftw3 -DGMX\_GPU=CUDA -DCMAKE\_BUILD\_TYPE=Release -DBUILD\_SHARED\_LIBS=off -DFFTWF\_INCLUDE\_DIR=“C:/fftw-3.3.5-dll64” -DFFTWF\_LIBRARY=“C:/fftw-3.3.5-dll64/libfftw3f-3.lib” -DCUDA\_TOOLKIT\_ROOT\_DIR=“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA”

-Tried with and without -DGMX\_CUDA\_TARGET\_SM=90 neither working

-Running a 6GB NVIDIA RTX 3050 Laptop GPU with CUDA v12.4

I am receiving the following error

[32%] Building NVCC (Device) object src/gromacs/CMakeFiles/libgromacs.dir/domdec/libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj  
nvcc fatal : Unknown option ‘-std:c++17’  
CMake Error at libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.Release.cmake:220 (message):  
Error generating  
C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj

NMAKE : fatal error U1077: ‘echo \>nul && “C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -D verbose:BOOL= -D build\_configuration:STRING=Release -D generated\_file:STRING=C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj -D generated\_cubin\_file:STRING=C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.cubin.txt -P C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.Release.cmake’ : return code ‘0x1’  
Stop.  
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\nmake.exe” -s -f src\gromacs\CMakeFiles\libgromacs.dir\build.make /nologo -SL src\gromacs\CMakeFiles\libgromacs.dir\depend’ : return code ‘0x2’  
Stop.  
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\nmake.exe” -s -f CMakeFiles\Makefile2 /nologo -S all’ : return code ‘0x2’  
Stop.

Thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![scinikhil](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/scinikhil/32/3483_2.png) [@scinikhil](https://gromacs.bioexcel.eu/u/scinikhil)\
**Post date:** [July 23, 2024, 11:15pm UTC](https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712/2 "2024-07-23T23:15:16Z")

</div>

> [@jshinsato](#):
>
> nvcc fatal : Unknown option ‘-std:c++17

i think the issue is with the c++ , you may need to direct it or use different.

---

<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 25, 2024, 8:08am UTC](https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712/3 "2024-07-25T08:08:10Z")

</div>

Hi!

> [@jshinsato](#):
>
> nvcc fatal : Unknown option ‘-std:c++17’

Have you tried the solution form this post?

> [@Link error Gromacs on windows with CUDA](https://gromacs.bioexcel.eu/t/link-error-gromacs-on-windows-with-cuda/6394/4):
>
> Just change file gromacs-2023.1/cmake/gmxManageNvccConfig.cmake line 241 to: list(APPEND GMX\_CUDA\_NVCC\_FLAGS "${CMAKE\_CUDA17\_STANDARD\_COMPILE\_OPTION}")

You can also try building/running GROMACS via WSL. We try to support MSVC, but none of the core developers use Windows, so it is

> [@jshinsato](#):
>
> -Tried with and without -DGMX\_CUDA\_TARGET\_SM=90 neither working

For RTX 3050, you should use 86, not 90.

---

<div class="post-metadata">

**Author:** ![jshinsato](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jshinsato](https://gromacs.bioexcel.eu/u/jshinsato)\
**Post date:** [July 25, 2024, 6:40pm UTC](https://gromacs.bioexcel.eu/t/gromacs-cmake-error-w-gpu-enabled/9712/4 "2024-07-25T18:40:35Z")

</div>

Tried the solution posted there, also changed the targets to 86 as directed, got this error:

gpuhaloexchange\_impl\_gpu.cpp  
C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fixedcapacityvector.h(85): error: expected a comma (the one-argument version of static\_assert is not enabled in this mode)  
static\_assert(std::is\_default\_constructible\_v);  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(77): error: name followed by “::” must be a class or namespace name  
void gmx\_init\_debug(int dbglevel, const std::filesystem::path& dbgfile);  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(88): error: name followed by “::” must be a class or namespace name  
const std::filesystem::path& file,  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(155): error: name followed by “::” must be a class or namespace name  
const std::filesystem::path& file,  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(186): error: name followed by “::” must be a class or namespace name  
gmx\_fatal(int fatal\_errno, const std::filesystem::path& file, int line, const char\* fmt, …)  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(196): error: name followed by “::” must be a class or namespace name  
const std::filesystem::path& file,  
^

C:/gromacs-2024-cuda/src/gromacs/utility/include\gromacs/utility/fatalerror.h(237): error: name followed by “::” must be a class or namespace name  
const std::filesystem::path& file,  
^

C:/gromacs-2024-cuda/api/legacy/include\gromacs/utility/listoflists.h(130): error: expected a comma (the one-argument version of static\_assert is not enabled in this mode)  
static\_assert(std::is\_default\_constructible\_v);  
^

C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(239): error: expression must have a constant value  
static\_assert(checkStringsLengths\<22\>(wallCycleCounterNames));  
^  
C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(173): note #2703-D: cannot call non-constexpr function “std::\_Narrow\_char\_traits\<\_Elem, \_Int\_type\>::length [with \_Elem=char, \_Int\_type=int]” (declared at line 385 of C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include\xstring)  
if (std::char\_traits::length(str) \> maxLength)  
^

C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(239): error: expected a comma (the one-argument version of static\_assert is not enabled in this mode)  
static\_assert(checkStringsLengths\<22\>(wallCycleCounterNames));  
^

C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(292): error: expression must have a constant value  
static\_assert(checkStringsLengths\<22\>(wallCycleSubCounterNames));  
^  
C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(173): note #2703-D: cannot call non-constexpr function “std::\_Narrow\_char\_traits\<\_Elem, \_Int\_type\>::length [with \_Elem=char, \_Int\_type=int]” (declared at line 385 of C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\include\xstring)  
if (std::char\_traits::length(str) \> maxLength)  
^

C:/gromacs-2024-cuda/src/gromacs/timing/include\gromacs/timing/wallcycle.h(292): error: expected a comma (the one-argument version of static\_assert is not enabled in this mode)  
static\_assert(checkStringsLengths\<22\>(wallCycleSubCounterNames));  
^

12 errors detected in the compilation of “C:/gromacs-2024-cuda/src/gromacs/domdec/gpuhaloexchange\_impl\_gpu.cpp”.  
gpuhaloexchange\_impl\_gpu.cpp  
CMake Error at libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.Release.cmake:280 (message):  
Error generating file  
C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj

NMAKE : fatal error U1077: ‘echo \>nul && “C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -D verbose:BOOL= -D build\_configuration:STRING=Release -D generated\_file:STRING=C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj -D generated\_cubin\_file:STRING=C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/./libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.cubin.txt -P C:/gromacs-2024-cuda/build/src/gromacs/CMakeFiles/libgromacs.dir/domdec/libgromacs\_generated\_gpuhaloexchange\_impl\_gpu.cpp.obj.Release.cmake’ : return code ‘0x1’  
Stop.  
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\nmake.exe” -s -f src\gromacs\CMakeFiles\libgromacs.dir\build.make /nologo -SL src\gromacs\CMakeFiles\libgromacs.dir\depend’ : return code ‘0x2’  
Stop.  
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\nmake.exe” -s -f CMakeFiles\Makefile2 /nologo -S all’ : return code ‘0x2’  
Stop.
