Skip to content

Fix: Correct FFTW version detection and NCCL build summary - #7995

Open
AsTonyshment wants to merge 2 commits into
deepmodeling:developfrom
AsTonyshment:fix/fftw-version-nccl-summary
Open

AsTonyshment wants to merge 2 commits into
deepmodeling:developfrom
AsTonyshment:fix/fftw-version-nccl-summary

Conversation

@AsTonyshment

@AsTonyshment AsTonyshment commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Issues

FFTW was reported as version unknown because detection relied on a nonexistent header macro. NCCL parallel support was always reported as Enabled, even when disabled.

Changes

  • Read FFTW's version directly from pkgconfig/fftw3.pc beside the selected library, avoiding a second dependency lookup or a dependency on the pkg-config tool. Retain version unknown when the file or a literal version is unavailable.
  • Remove duplicate FFTW version detection from the build summary.
  • Report Disabled when ENABLE_NCCL_PARALLEL_DEVICE is off.

@AsTonyshment
AsTonyshment requested review from ZhouXY-PKU and mohanchen and a lite review from Copilot and removed request for Copilot September 20, 2026 15:49
Comment thread cmake/modules/FindFFTW3.cmake Outdated
Comment on lines +60 to +69
# FFTW has no version macro; use pkg-config metadata for the selected installation.
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_FFTW3 QUIET fftw3)
get_filename_component(_fftw3_library_dir "${FFTW3_LIBRARY}" DIRECTORY)
if(PC_FFTW3_FOUND AND PC_FFTW3_INCLUDEDIR STREQUAL FFTW3_INCLUDE_DIR
AND PC_FFTW3_LIBDIR STREQUAL _fftw3_library_dir)
set(FFTW3_VERSION "${PC_FFTW3_VERSION}")
endif()
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it duplicate the fftw3 discovery practically?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pkg_check_modules() indeed also performs a library lookup. If that's your concern, I've replaced it with a direct read of the Version: field from pkgconfig/fftw3.pc beside the selected library. Either way reports a valid version number on my system, while the previous logic connot.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial concern is that duplicated discovery may potentially cause information inconsistency, e.g. it's possible that the fftw3 package you found from FFTW3_DIR is different from what pkg-config can see (depending on PKG_CONFIG_PATH). The current file(STRING ...) approach seems to be a compromise, but looks less clean. If I was to handle it, I would rely on pkg_check_modules() in priority to find fftw3, just like what we're currently doing for elpa.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that it's indeed a valid concern, and I do agree that using pkg-config as the primary discovery mechanism would be cleaner. However, I would not like to expand this PR into a full refactor of FFTW3 discovery. I'll keep the current compromise of reading the metadata for now. If you're interested, a separate PR to refactor the FFTW3 discovery logic would be welcome :) As “the Elder” once said, ”我说另请高明吧“!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with it, just explaining my concern :) I am willing to help handle it if you'd like

@AsTonyshment
AsTonyshment force-pushed the fix/fftw-version-nccl-summary branch from 98170c0 to 9168bfb Compare September 21, 2026 03:28
@AsTonyshment
AsTonyshment requested a lite review from Copilot and removed request for Copilot September 21, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants