Skip to content

Fix CMake link ordering for tests and SW math libraries#7288

Closed
A-006 wants to merge 5 commits intodeepmodeling:developfrom
A-006:sunway1
Closed

Fix CMake link ordering for tests and SW math libraries#7288
A-006 wants to merge 5 commits intodeepmodeling:developfrom
A-006:sunway1

Conversation

@A-006
Copy link
Copy Markdown
Collaborator

@A-006 A-006 commented Apr 27, 2026

Summary

  • Adjust CMake link dependencies for gtest targets so project libraries are linked before ${math_libs}
  • Move container/base/device dependencies into AddTest(LIBS ...) for ATen kernel tests
  • Add SW build compile option -mieee and include SW FFT/BLAS/LAPACK/ScaLAPACK libraries in math_libs
  • Add truncated_underflow(const FPTYPE&) overload to support const inputs by forwarding to the mutable implementation

Notes

The latest commits currently contain unresolved conflict markers in CMakeLists.txt:

  • CMakeLists.txt:353
  • CMakeLists.txt:818
  • CMakeLists.txt:819
  • CMakeLists.txt:822

Copilot AI review requested due to automatic review settings April 27, 2026 11:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CMake-based build/test linkage to be more link-order-friendly (notably for static math libraries and SW builds), and adjusts a utility function intended to avoid floating underflow in SW-specific code paths.

Changes:

  • Reorders AddTest(LIBS ...) arguments so project libraries are listed before ${math_libs} for several unit test targets.
  • Consolidates SW FFT/BLAS/LAPACK/ScaLAPACK libraries into the math_libs list and adds an SW compile option (-mieee).
  • Adds a truncated_underflow(const FPTYPE&) overload (currently implemented via const_cast forwarding).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source/source_lcao/module_rt/test/CMakeLists.txt Reorders test link libraries so ${math_libs} is last.
source/source_hsolver/test/CMakeLists.txt Reorders ${math_libs} to the end for some HSOLVER tests.
source/source_base/truncated_func.h Adds truncated_underflow(const&) overload forwarding to the mutating implementation.
source/source_base/module_container/ATen/kernels/test/CMakeLists.txt Moves container/base/device dependencies into AddTest(LIBS ...) (and keeps ${math_libs} last).
CMakeLists.txt Adds SW -mieee compile option and appends SW math libs into math_libs; removes later per-lib SW link lines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/source_base/truncated_func.h
Comment thread source/source_hsolver/test/CMakeLists.txt
Comment thread CMakeLists.txt
@mohanchen mohanchen added Refactor Refactor ABACUS codes GPU & DCU & HPC GPU and DCU and HPC related any issues labels Apr 28, 2026
@mohanchen
Copy link
Copy Markdown
Collaborator

reopen it if needed

@mohanchen mohanchen closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GPU & DCU & HPC GPU and DCU and HPC related any issues Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants