AMGX build error with thrust

Hi,

I’m trying to install AMGX on my PC, but VS gave me some compiling error. (I’ve successfully installed amgx on my ubuntu 24.04)

The environment of PC is given as follow:

  • OS: [Windows 11]
  • Compiler version: [MSVC 19.40.3381]
  • CMake version: [3.30]
  • CUDA used for AMGX compilation: [CUDA 12.5.0]
  • MPI version (if applicable): [MS-MPI v10.1.2]
  • AMGX version or commit hash [f20a12db5cb6ad6a66e2ba6f9356456fed7af73f]

The cmake config info is:

1> CMake generation started for default configuration: 'x64-Debug'.
1> Command line: "C:\Windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:\Develop\AMGX\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\Develop\AMGX" 2>&1"
1> Working directory: D:\Develop\AMGX\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.40.33811.0
1> [CMake] -- The CXX compiler identification is MSVC 19.40.33811.0
1> [CMake] -- The CUDA compiler identification is NVIDIA 12.5.40
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Detecting CUDA compiler ABI info
1> [CMake] -- Detecting CUDA compiler ABI info - done
1> [CMake] -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5/bin/nvcc.exe - skipped
1> [CMake] -- Detecting CUDA compile features
1> [CMake] -- Detecting CUDA compile features - done
1> [CMake] -- Found MPI_C: C:/Program Files (x86)/Microsoft SDKs/MPI/Lib/x64/msmpi.lib (found version "2.0")
1> [CMake] -- Found MPI_CXX: C:/Program Files (x86)/Microsoft SDKs/MPI/Lib/x64/msmpi.lib (found version "2.0")
1> [CMake] -- Found MPI: TRUE (found version "2.0")
1> [CMake] -- Found OpenMP_C: -openmp (found version "2.0")
1> [CMake] -- Found OpenMP_CXX: -openmp (found version "2.0")
1> [CMake] -- Found OpenMP: TRUE (found version "2.0")
1> [CMake] -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5/include (found suitable version "12.5.40", minimum required is "10.0")
1> [CMake] This is a MPI build:TRUE
1> [CMake] CMake Deprecation Warning at thrust/CMakeLists.txt:9 (cmake_policy):
1> [CMake] The OLD behavior for policy CMP0104 will be removed from a future version
1> [CMake] of CMake.
1> [CMake]
1> [CMake] The cmake-policies(7) manual explains that the OLD behaviors of all
1> [CMake] policies are deprecated and that a policy should be set to OLD only under
1> [CMake] specific short-term circumstances. Projects should be ported to the NEW
1> [CMake] behavior and not rely on setting a policy to OLD.
1> [CMake]
1> [CMake]
1> [CMake] -- Found libcudacxx: D:/Develop/AMGX/thrust/dependencies/libcudacxx/lib/cmake/libcudacxx/libcudacxx-config.cmake (found suitable version "1.8.1.0", minimum required is "1.8.0")
1> [CMake] -- Found Thrust: D:/Develop/AMGX/thrust/thrust/cmake/thrust-config.cmake (found version "2.1.0.0")
1> [CMake] -- Found CUB: D:/Develop/AMGX/thrust/dependencies/cub/cub/cmake/cub-config.cmake (found suitable version "2.1.0.0", minimum required is "2.1.0.0")
1> [CMake] -- Configuring done (28.9s)
1> [CMake] -- Generating done (0.1s)
1> [CMake] -- Build files have been written to: D:/Develop/AMGX/out/build/x64-Debug
1> Extracted CMake variables.
1> Extracted source files and headers.
1> Extracted code model.
1> Extracted toolchain configurations.
1> Extracted includes paths.
1> CMake generation finished.

Here are the compiling error:

error 1

Error calling a **host** function("std::_Iterator_base12::_Iterator_base12(const ::std::_Iterator_base12&)") from a **host** **device** function("std::_Iterator_base12::_Iterator_base12 [subobject]") is not allowed D:\Develop\AMGX\out\build\x64-Debug\AMGX D:\Develop\AMGX\thrust\thrust\detail\allocator\allocator_traits.inl 370

error2

Error calling a **host** function("std::_Iterator_base12::<del>_Iterator_base12()") from a **host** **device** function("std::_Iterator_base12::</del>_Iterator_base12 [subobject]") is not allowed D:\Develop\AMGX\out\build\x64-Debug\AMGX D:\Develop\AMGX\thrust\thrust\detail\allocator\allocator_traits.inl 370

Is there anyone could help me with it ?

Thanks