Luecx / Grapheus

5 stars 7 forks source link

Issues with compilation #12

Open Jochengehtab opened 2 weeks ago

Jochengehtab commented 2 weeks ago

Hi there, I am trying to compile the project using

Windows 11
cmake version 3.30.0-rc3
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0
latest version of Visual Studio 2022

but when i ran the command cmake .. in the /build directory i get the following error:

\Downloads\Grapheus\build>cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The CUDA compiler identification is NVIDIA 11.7.64
-- The CXX compiler identification is MSVC 19.40.33811.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: /CUDA/v11.7/bin/nvcc.exe
-- Check for working CUDA compiler: /CUDA/v11.7/bin/nvcc.exe - broken
CMake Error at /CMake/share/cmake-3.30/Modules/CMakeTestCUDACompiler.cmake:59 (message):
  The CUDA compiler

    "/CUDA/v11.7/bin/nvcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Grapheus/build/CMakeFiles/CMakeScratch/TryCompile-ydhsg7'

    Run Build Command(s): "/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_c75f5.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
    The build process was started on 15/06/2024 10:24:15.

    Project: "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" on node "1" (default targets).
    PrepareForBuild:
      The "cmTC_c75f5.dir\Debug\" directory is created.
      Structured output is activated. The formatting of the compiler diagnostics reflects the error hierarchy. Further information can be found at https://aka.ms/cpp/structured-output.
      The directory "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\Debug\" is created.
      The directory "cmTC_c75f5.dir\Debug\cmTC_c75f5.tlog\" is created.
    InitialiseBuildStatus:
      "cmTC_c75f5.dir\Debug\cmTC_c75f5.tlog\unsuccessfulbuild" is created because "AlwaysCreate" was specified.
      Update the timestamp of "cmTC_c75f5.dir\Debug\cmTC_c75f5.tlog\unsuccessfulbuild".
    AddCudaCompileDeps:
      \Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D__CUDACC_VER_MAJOR__=11 /D__CUDACC_VER_MINOR__=7 /D_WINDOWS /DCMAKE_INTDIR="Debug" /D_MBCS /DCMAKE_INTDIR="Debug" /I"\CUDA\v11.7\bin" /I"\CUDA\v11.7\include" /I. /FIcuda_runtime.h /c \Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\main.cu
    The project "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" (1) creates "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" (1:2) on node "1", CudaBuildCore target(s).
    CudaBuildCore:
      Compiling CUDA source file main.cu...
      cmd.exe /C "\AppData\Local\Temp\tmpe26b2c7e1e074161b958328b71a8b400.cmd"
      "\CUDA\v11.7\bin\nvcc.exe"  --use-local-env -ccbin "\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"\CUDA\v11.7\include"     --keep-dir cmTC_c75f5\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_c75f5.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_c75f5.dir\Debug\main.obj "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\main.cu"

      \Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7>"\CUDA\v11.7\bin\nvcc.exe"  --use-local-env -ccbin "\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"\CUDA\v11.7\include"     --keep-dir cmTC_c75f5\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_c75f5.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_c75f5.dir\Debug\main.obj "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\main.cu"
    \CUDA\v11.7\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. [\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj]
      main.cu
    \Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: Der Befehl ""\CUDA\v11.7\bin\nvcc.exe"  --use-local-env -ccbin "\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"\CUDA\v11.7\include"     --keep-dir cmTC_c75f5\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_c75f5.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_c75f5.dir\Debug\main.obj "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\main.cu"" was terminated with code 2. [C\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj]
    The creation of the project "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" is complete, CudaBuildCore target(s) -- ERROR.
    The creation of the project "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" is complete (default target(s)) -- ERROR.

    Error during build process.

    "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" (default target) (1) ->
    "s\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj" (CudaBuildCore target) (1:2) ->
    (CudaBuildCore target) ->
      \CUDA\v11.7\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. [\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj]
      \Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: Der Befehl ""t\CUDA\v11.7\bin\nvcc.exe"  --use-local-env -ccbin "\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include"     --keep-dir cmTC_c75f5\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_c75f5.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_c75f5.dir\Debug\main.obj "\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\main.cu"" was terminated with code 2. [\Grapheus\build\CMakeFiles\CMakeScratch\TryCompile-ydhsg7\cmTC_c75f5.vcxproj]

        0 Warning(s)
        2 Error

    Elapsed time 00:00:00.64

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!
jhonnold commented 1 week ago

Please upgrade your CUDA to at least 11.8 and try again.

Jochengehtab commented 1 week ago

Tryed with CUDA 11.8

  \NVIDIA GPU Computing
  Toolkit\CUDA\v11.8\include\crt/host_config.h(153): fatal error C1189:
  #error: -- unsupported Microsoft Visual Studio version! Only the versions
  between 2017 and 2022 (inclusive) are supported! The nvcc flag
  '-allow-unsupported-compiler' can be used to override this version check;
  however, using an unsupported host compiler may cause compilation failure
  or incorrect run time execution.  Use at your own risk.

  # --error 0x2 --

Call Stack (most recent call first):
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCUDACompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Luecx commented 1 week ago

What's your OS? What's your compiler? Please list those things.

We recommend using WSL. Atleast cuda 11.7 and gcc 12 I think. Alternatively sometimes compiling with USE_IMMINTRIN=0 when using make instead of cmake can work.

Jochengehtab commented 1 week ago

As mentioned above, I am using Windows 11.

cmake version 3.29.3

gcc (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders, r1) 14.1.0

GNU Make 4.4.1
Built for x86_64-w64-mingw32

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

and when running the makefile on Windows i get this error:

File *.cu not found
process_begin: CreateProcess(NULL, mkdir -p bin, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [makefile:37: bin/Grapheus] Error 2
jhonnold commented 1 week ago

The version of GCC you’re using is not supported by CUDA 11.8 - it’s very explicit in the error message you posted and unrelated to Grapheus. If you wish to use the latest version of GCC, follow the recommendation in the error, otherwise downgrade to GCC 12.

Tryed with CUDA 11.8

  \NVIDIA GPU Computing
  Toolkit\CUDA\v11.8\include\crt/host_config.h(153): fatal error C1189:
  #error: -- unsupported Microsoft Visual Studio version! Only the versions
  between 2017 and 2022 (inclusive) are supported! The nvcc flag
  '-allow-unsupported-compiler' can be used to override this version check;
  however, using an unsupported host compiler may cause compilation failure
  or incorrect run time execution.  Use at your own risk.

  # --error 0x2 --

Call Stack (most recent call first):
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
  /scoop/apps/mingw-winlibs-llvm/14.1.0-18.1.5-11.0.1-r1/share/cmake-3.29/Modules/CMakeDetermineCUDACompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!