NVIDIA / AMGX

Distributed multigrid linear solver library on GPU
468 stars 136 forks source link

[Build] Error with thrust #314

Closed geyan3566 closed 5 days ago

geyan3566 commented 3 weeks ago

Describe the issue

A clear and concise description of what the issue is.

Environment information:

Configuration information I'm using the default cmake command 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.

Compilation information

vs default build with debug

Issue information

Severity Code Description Project File Line Suppression State Details

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 Severity Code Description Project File Line Suppression State Details Error calling a host function("std::_Iterator_base12::~_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

Additional context

Add any other context about the problem here.

Hi, I just tried to build amgx on my pc as well but I got these errors from thrust side. Could someone help me with it? Thanks, Ge

marsaev commented 2 weeks ago

@geyan3566 sorry for the delayed response.

I was able to reproduce the issue and will take a look with the thrust team. Meanwhile - i was able to build Release version just fine, you can use that meanwhile.

Thanks,

geyan3566 commented 2 weeks ago

@marsaev Thanks for the reply. I'll go with with release build for now.

The error above seems like a compiler compatibility issue, not sure.

geyan3566 commented 2 weeks ago

I tried to build with release, it works. But I'm unable to run the example. Here is the error message

shot

Output info

'amgx_capi.exe' (Win32): Loaded 'D:\Develop\AMGX\out\build\x64-Release\examples\amgx_capi.exe'. Module was built without symbols.
'amgx_capi.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbol loading disabled by Include/Exclude setting.
'amgx_capi.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbol loading disabled by Include/Exclude setting.
'amgx_capi.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbol loading disabled by Include/Exclude setting.
'amgx_capi.exe' (Win32): Loaded 'C:\Windows\System32\apphelp.dll'. Symbol loading disabled by Include/Exclude setting.
'amgx_capi.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Symbol loading disabled by Include/Exclude setting.
The thread 20344 has exited with code 3221225781 (0xc0000135).
The thread 7572 has exited with code 3221225781 (0xc0000135).
The thread 5376 has exited with code 3221225781 (0xc0000135).
The program '[4580] amgx_capi.exe' has exited with code 3221225781 (0xc0000135) 'A dependent dll was not found'.

FYI, here is the release configuration info

1> CMake generation started for configuration: 'x64-Release'.
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="Release" -DCMAKE_INSTALL_PREFIX:PATH="D:\Develop\AMGX\out\install\x64-Release" -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-Release
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.8s)
1> [CMake] -- Generating done (0.1s)
1> [CMake] -- Build files have been written to: D:/Develop/AMGX/out/build/x64-Release
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.
marsaev commented 1 week ago

@geyan3566 was amgxsh.dll built in this build (is this file present in the build directory)? If no - can you check if there were any other compilation errors? If yes - can you try copy/paste it to the same directory as example? It maybe just system cannot find it relative to example executable.

geyan3566 commented 1 week ago

Thank you. I just overlooked the setting environment variable part.

Please let me know in the future how to fix the debug build with the specific (maybe the latest) visual studio.

marsaev commented 1 week ago

@geyan3566 The issue can be fixed with removing --Werror cross-execution-space-call from CMakeLists here: https://github.com/NVIDIA/AMGX/blob/f20a12db5cb6ad6a66e2ba6f9356456fed7af73f/CMakeLists.txt#L181C40-L181C75 Library gets compiled, but I still see some errors when linking example - probably need to adjust other flags too.

Since this configuration (Windows/Debug) is not very common, we will address this at some point in the future, but for now I can only suggest either proceed with Release, or link your application manually with Debug library.

marsaev commented 5 days ago

I'll close the issue for now, since i think the problem was resolved. Please, reopen it if you have any more questions.

Thanks,