Compiling SuiteSparse on Windows with CUDA enabled #929
Replies: 3 comments 4 replies
-
Thank you for your detailed report and the pointers to past discussions revolving around this topic. If I understand correctly, the issue arises because CUDA isn't used as the linker for the CHOLMOD libraries. Could you please check if that fixes the issue for you? |
Beta Was this translation helpful? Give feedback.
-
Well, I have just tested replacing the CHOLMOD's CMakeLists.txt file with the one provided in #931, but unfortunately it didn't solved the problem. Got the same linker error (LNK2019) as before. I checked, but with the new LINKER_LANGUAGE CUDA option, the cholmod_static.device-link.obj was not generated. My environment is: So you have a slightly newer Visual studio version, but an older CUDA toolkit. Attached are the CMakeLists.txt file that works for me (only tested on Windows) and the log files from running cmake with both my CMakeLists file and the new one. Notice that on the new one, there is no "CudaLink" call to generate the cholmod_static.device-link.obj file. Both of them have the "CudaLink" call to generate gpuqrengine_static.device-link.obj from SPQR. My command line for running cmake was: And the build logs where generated by that call to cmake, followed by msbuild ALL_BUILD.vcxproj /t:Build /p:Configuration=Release /m SuiteSparseBuildLog_MyCMakeLists.txt Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
A CI runner that built only static libraries with CUDA succeeded with additional changes in #931: That could still be because it is using a different (older) version of CUDA than you. The only remaining question might be whether that should only be done for MSVC (and MSVC-compatible?) compilers. (And only slightly related: Should we check if these properties are set reasonably for the other CUDA libraries (e.g., in SPQR)?) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have recently started integrating SuiteSparse to our in-house geomechanical simulator. Our main compilation environment is on Windows, with Visual Studio 2022. Without CUDA support, compilation was surprisingly easy and everything just worked by providing the desired flags for CMake. I had some difficulties though when I enabled CUDA compilation.
To compile version 7.8.3 on Windows WITH CUDA support, it was necessary to add the following lines to the shared and static libs sections on CHOLMOD's CMakeLists.txt file:
set_target_properties ( CHOLMOD PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
set_target_properties ( CHOLMOD_static PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
Without this, the PerformDeviceLink attribute in the generated vcproj file is set to false, instead of true (found on the GUI at the CHOLMOD_static project properties page, at the "CUDA Linker" section).
This prevents the creation of the needed cholmod_static.device-link.obj file, leading to the following linker error when compiling CHOLMOD's "dl" and "sl" demos (the ones that can use CUDA):
error LNK2019: unresolved external symbol __cudaRegisterLinkedBinary
Turning on the CUDA_RESOLVE_DEVICE_SYMBOLS solves the problem. Notice that this flag is already set to 'on' at the SPQR\GPUQREngine CMakeLists.txt file. The fact that SPQR uses CHOLMOD doesn't seem to be a problem. We where able to build and run SPQR GPU demos.
We have NOT tested if this addition causes any trouble in Linux.
As per the following link, it appears that this is a limitation of CMake itself. See https://gitlab.kitware.com/cmake/cmake/-/issues/17520 for a discussion on the subject.
Beta Was this translation helpful? Give feedback.
All reactions