Skip to content

CMake: accept renamed libmtblasfftdev.a from mtfftblas_v1.4.1c for DSP builds - #8236

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
DanielZhao0432:fix-dsp-mtblas-libname
Oct 29, 2026
Merged

mohanchen merged 1 commit into
deepmodeling:developfrom
DanielZhao0432:fix-dsp-mtblas-libname

Conversation

@DanielZhao0432

Copy link
Copy Markdown
Collaborator

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked an issue or explained why this PR does not need one.
  • I have added adequate unit tests and/or case tests, or explained why not.
  • I have listed the exact verification commands run and their results.
  • I have described user-visible behavior changes, including INPUT parameter changes.
  • I have explained core-module impact for ESolver, HSolver, ElecState, Hamilt, Operator, Psi, or other source/ changes.
  • I have requested any needed governance exception below.

Linked Issue

Fix #8227

Unit Tests and/or Case Tests for my changes

  • Commands run:
    1. Standalone CMake project exercising the exact new lookup block against mock
      mtfftblas prefixes, four scenarios (cmake -S <proj> -B <build> -DUSE_DSP=ON -DMTBLAS_FFT_DIR=<mock prefix>):
      • only libmtblasfftdev.a present (mtfftblas_v1.4.1c layout) → resolves to libmtblasfftdev.a
      • only libmtblasdev.a present (older mtfftblas layout) → falls back to libmtblasdev.a
      • both present → deterministically resolves to libmtblasfftdev.a (NAMES order)
      • neither present → configure aborts with the intended FATAL_ERROR message
    2. cmake -S . -B <build> with default options (USE_DSP=OFF) → configures and
      generates successfully; non-DSP builds unaffected.
    3. Real DSP build on Tianhe against mtfftblas_v1.4.1c, symlink workaround removed:
      cmake -DUSE_DSP=ON -DMT_CPACK_DIR=... -DMTBLAS_FFT_DIR=... ... →
      MTBLASDEV_LIB resolves to libmtblasfftdev.a; full compile and link succeed;
      the resulting binary runs LCAO calculations normally.
    4. python3 tools/03_code_analysis/agent_governance_check.py --staged → no findings.
  • Result summary: all checks above pass.
  • Checks not run, with reason: no unit/case tests added — the change is CMake build
    logic that the C++ test harness cannot exercise, and CI has no DSP toolchain;
    the DSP path was verified manually on Tianhe as listed above.

What's changed?

  • mtfftblas_v1.4.1c renamed libmtblasdev.a to libmtblasfftdev.a, breaking DSP
    builds (-DUSE_DSP=ON) because the archive name was hardcoded in
    source/CMakeLists.txt. The link entry is now resolved with
    find_library(... NAMES mtblasfftdev mtblasdev PATHS ${MTBLAS_FFT_DIR}/libmtblas/lib NO_DEFAULT_PATH), accepting both the new and the legacy name, and configuration
    aborts with a clear diagnostic when neither exists.
  • The archive keeps its position after the standalone BLAS/LAPACK/ScaLAPACK
    entries (required because the mtblas archives bundle their own OpenBLAS
    objects), and the separate C_PACK prerequisite is unchanged.
  • User-visible change: DSP builds now work with both mtfftblas >= v1.4.1c and
    older mtfftblas releases without symlink workarounds. No INPUT parameter changes.
  • Only the USE_DSP branch of source/CMakeLists.txt is touched; builds on
    other platforms are unaffected.

Governance Notes

  • INPUT/docs changes: none (build-system only).
  • Core module impact: none — no source/ C++ code changed.
  • Exceptions requested: none.

…P builds

mtfftblas_v1.4.1c renamed libmtblasdev.a to libmtblasfftdev.a, breaking
the hardcoded archive name in the USE_DSP link list. Look the library
up with find_library using both names (new name first, old name as
fallback) and fail with a clear diagnostic when neither exists.

Fixes deepmodeling#8227
@DanielZhao0432 DanielZhao0432 added GPU & DCU & HPC GPU and DCU and HPC related any issues Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS labels Oct 29, 2026
@mohanchen

Copy link
Copy Markdown
Collaborator

LGTM

@mohanchen
mohanchen merged commit 5a7e6a6 into deepmodeling:develop Oct 29, 2026
18 checks passed
@DanielZhao0432
DanielZhao0432 deleted the fix-dsp-mtblas-libname branch October 29, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS GPU & DCU & HPC GPU and DCU and HPC related any issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DSP] Build fails with mtfftblas_v1.4.1c: CMake hardcodes libmtblasdev.a, renamed to libmtblasfftdev.a

2 participants