Pull requests / #717

#717 fix: make the CUDA language link the shared runtime (Windows sm_70 LNK1169, #585)

closed · @noahark · 0 コメント · GitHub で見る

BenchmarksNVIDIA / CUDAModels & quantsWindowsLinux

本文

Fixes #585.

The final link of `strata.exe` failed on a Windows sm_70 source build (MSVC 14.44, CUDA 12.4):
`cudart_static.lib(...)` raised LNK2005 for every runtime symbol already defined in
`cudart.lib(cudart64_12.dll)`, ending in LNK1169. Root cause: `enable_language(CUDA)` links the
runtime per `CMAKE_CUDA_RUNTIME_LIBRARY` (default **Static** -> `cudart_static.lib`), while the
project also links the imported `CUDA::cudart` target explicitly - both libraries on one link line.
GNU ld tolerates the duplicates, which is why the Pascal/Volta path (#295, tested on Linux) never
hit this on Linux.

The fix sets the language runtime to `Shared` so it agrees with the explicit `CUDA::cudart`
links, guarded by `if(NOT DEFINED ...)` so a user's explicit `-D` still wins.

Verified on the reporting machine (V100-PCIE-32GB, Windows, CUDA 12.4 + MSVC):

- before: all 129 objects compile, `link.exe` line contains both `cudart.lib` and
  `cudart_static.lib` -> LNK1169, build fails
- with this patch (fresh configure, no `-D`): the generated link line references only `cudart.lib`
  (178 occurrences, `cudart_static.lib` gone); the engine builds, runs, and serves - field numbers
  in #617 and PR #707 come from this build (16.5 -> 33.5 tok/s after calibration, IQ3_XXS)

関連リンク

インストール・モデル・リリースへの站内リンク。