Revert "CMake: cuFFT linked statically wherever the toolkit has the static library"

This reverts commit 3ac1fd657f.
This commit is contained in:
leonarski_f committed 2026-11-18 11:14:25 +01:00
1 parent 3a5391dd65
commit 4b8ed5c0d5
7 files changed
+29 -31

No files matched your search

-26
View File
@@ -656,32 +656,6 @@ IF (NOT JFJOCH_WRITER_ONLY AND NOT JFJOCH_PORTABLE_ONLY)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/frontend/dist/ DESTINATION share/jfjoch/frontend COMPONENT jfjoch )
ENDIF()
# libcufft_static.a carries a relocatable-device-code object (separate_callback.o), so an executable
# linking it needs a CUDA device-link step -- without it the host link fails on an undefined
# __cudaRegisterLinkedBinary_* symbol. CUDA 13 no longer ships libcufft_static_nocallback.a, which
# used to be the way around it. CUDA_RESOLVE_DEVICE_SYMBOLS makes CMake emit that step while leaving
# the host link driver alone, so the -march/-flto flags CI passes still apply. Set on every executable
# and shared library of this source tree, as nearly all of them link the image analysis.
FUNCTION(JFJOCH_RESOLVE_DEVICE_SYMBOLS dir)
GET_PROPERTY(_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
FOREACH(_target IN LISTS _targets)
GET_TARGET_PROPERTY(_type ${_target} TYPE)
IF (_type MATCHES "EXECUTABLE|SHARED_LIBRARY|MODULE_LIBRARY")
SET_TARGET_PROPERTIES(${_target} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
ENDFOREACH()
GET_PROPERTY(_subdirs DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
FOREACH(_subdir IN LISTS _subdirs)
STRING(FIND "${_subdir}" "${CMAKE_SOURCE_DIR}/" _position)
IF (_position EQUAL 0) # not the fetched dependencies
JFJOCH_RESOLVE_DEVICE_SYMBOLS(${_subdir})
ENDIF()
ENDFOREACH()
ENDFUNCTION()
IF (JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
JFJOCH_RESOLVE_DEVICE_SYMBOLS(${CMAKE_SOURCE_DIR})
ENDIF()
# Windows has no static cuFFT (the toolkit ships no cufft_static.lib), so there the indexer links
# the import library and the self-contained products must carry the DLL beside the executable --
# the same idea the Linux builds no longer need, since they link libcufft_static.a. CUDA 13 keeps
@@ -47,7 +47,7 @@ IF (JFJOCH_CUDA_AVAILABLE)
BeamCenterBackgroundGPU.cu BeamCenterBackgroundGPU.h)
# Same static/dynamic cuFFT choice as the FFT indexer, and for the same reasons - see the long
# note in image_analysis/indexing/CMakeLists.txt.
IF (TARGET CUDA::cufft_static)
IF (JFJOCH_PORTABLE_ONLY AND TARGET CUDA::cufft_static)
TARGET_LINK_LIBRARIES(JFJochGeomRefinement CUDA::cufft_static)
ELSE()
TARGET_LINK_LIBRARIES(JFJochGeomRefinement CUDA::cufft)
+4 -4
View File
@@ -51,10 +51,10 @@ IF (JFJOCH_CUDA_AVAILABLE)
# and the dynamic library is the only option; the top-level CMakeLists installs the DLL beside
# the executable for the self-contained builds. Test the target rather than the platform, so a
# toolkit that gains or loses the static library is handled without another special case.
# The server build links it statically too, so its executables (broker, tools copied to another
# machine) need no CUDA toolkit library; the top-level CMakeLists gives every executable the device
# link this needs.
IF (TARGET CUDA::cufft_static)
# Both halves matter: the server build keeps the shared library (its .deb/.rpm take CUDA from the
# distro, and every executable there -- broker, tests, tools -- would otherwise need the device
# link below), and Windows has no static cuFFT to link even for the portable products.
IF (JFJOCH_PORTABLE_ONLY AND TARGET CUDA::cufft_static)
TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft_static)
ELSE()
TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft)
+8
View File
@@ -66,6 +66,14 @@ IF(APPLE AND JFJOCH_MACOS_SIGNING_IDENTITY)
COMPONENT rugnux)
ENDIF()
# libcufft_static.a carries a relocatable-device-code object (separate_callback.o), so an executable
# linking it needs a CUDA device-link step -- without it the host link fails on an undefined
# __cudaRegisterLinkedBinary_* symbol. CUDA 13 no longer ships libcufft_static_nocallback.a, which
# used to be the way around it. CUDA_RESOLVE_DEVICE_SYMBOLS makes CMake emit that step while leaving
# the host link driver alone, so the -march/-flto flags CI passes still apply.
IF (JFJOCH_PORTABLE_ONLY AND JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
SET_TARGET_PROPERTIES(rugnux PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
# On Windows this CLI gets getopt/getopt_long from the vendored wingetopt shim (libc has none).
+4
View File
@@ -47,6 +47,10 @@ ADD_EXECUTABLE(jfjoch_portable_test EXCLUDE_FROM_ALL
target_link_libraries(jfjoch_portable_test Catch2WithMain JFJochRugnux JFJochReader JFJochImageAnalysis
JFJochWriter JFJochAPIConvert JFJochCommon)
target_include_directories(jfjoch_portable_test PRIVATE .)
# Same device-link step as rugnux (see rugnux/CMakeLists.txt): a portable CUDA build links cuFFT statically.
IF (JFJOCH_PORTABLE_ONLY AND JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
SET_TARGET_PROPERTIES(jfjoch_portable_test PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
# The CPU vs GPU test of the fast-feedback indexer reads the library's own test spot lists
IF (JFJOCH_CUDA_AVAILABLE)
+4
View File
@@ -18,6 +18,10 @@ TARGET_LINK_LIBRARIES(jfjoch_extract_hkl JFJochReader)
# measuring the refinement on battery outputs without processing anything again.
ADD_EXECUTABLE(rugnux_refine_test rugnux_refine_test.cpp)
TARGET_LINK_LIBRARIES(rugnux_refine_test JFJochStructureRefinement JFJochCommon gemmi)
# Same device-link step as rugnux (see rugnux/CMakeLists.txt): a portable CUDA build links cuFFT statically.
IF (JFJOCH_PORTABLE_ONLY AND JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
SET_TARGET_PROPERTIES(rugnux_refine_test PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
# In-place re-compress /entry/data/data of a _data file from bitshuffle/LZ4 to bitshuffle/zstd.
ADD_EXECUTABLE(jfjoch_recompress jfjoch_recompress.cpp)
+8
View File
@@ -184,6 +184,14 @@ IF(APPLE)
PATTERN "COLLECT.sh" EXCLUDE)
ENDIF()
# libcufft_static.a carries a relocatable-device-code object (separate_callback.o), so an executable
# linking it needs a CUDA device-link step -- without it the host link fails on an undefined
# __cudaRegisterLinkedBinary_* symbol. CUDA 13 no longer ships libcufft_static_nocallback.a, which
# used to be the way around it. CUDA_RESOLVE_DEVICE_SYMBOLS makes CMake emit that step while leaving
# the host link driver alone, so the -march/-flto flags CI passes still apply.
IF (JFJOCH_PORTABLE_ONLY AND JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
SET_TARGET_PROPERTIES(jfjoch_viewer PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
IF(JFJOCH_VIEWER_DBUS)