CMake: Rewrite FindMKL.cmake#7595
Open
Growl1234 wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request rewrites cmake/modules/FindMKL.cmake to expose ABACUS-oriented oneMKL link closures (BLAS/LAPACK/FFTW, plus BLACS/ScaLAPACK+MPI for MPI builds) instead of exposing individual MKL libraries, and adjusts the build to support MPI-flavor auto-detection for the BLACS interface.
Changes:
- Replace
FindMKL.cmakewith a closure-based design that providesMKL::MKLandMKL::MKL_SCALAPACK, plus cache axes for link mode/threading/MPI ABI. - Enable MPI library-version probing (when not cross-compiling) so MKL can auto-select the correct BLACS interface.
- Switch the core linalg link closure to consume
${MKL_LIBRARIES}and key offMKL_FOUND.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
cmake/modules/FindMKL.cmake |
Reworked MKL discovery to build ABACUS-specific imported-target closures with explicit threading/link-mode/MPI-ABI handling. |
CMakeLists.txt |
Enables MPI_DETERMINE_LIBRARY_VERSION pre-probing for improved Open MPI detection used by the MKL finder. |
source/CMakeLists.txt |
Updates the linalg closure to link via ${MKL_LIBRARIES} and key off MKL_FOUND. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reworks
FindMKL.cmaketo model the oneMKL link closure required by ABACUS rather than exposing individual MKL libraries to callers.ABACUS directly uses LP64 Fortran-style BLAS/LAPACK symbols and, in MPI builds, BLACS/ScaLAPACK routines. The finder now provides:
abacus::mklfor the BLAS/LAPACK and FFTW compatibility interfaces;abacus::mkl_scalapackfor the MPI closure, including ScaLAPACK, the matching BLACS library, base MKL libraries, andMPI::MPI_CXX.The configuration handles the relevant oneMKL choices explicitly:
mkl_gf_lp64for GCC andmkl_intel_lp64otherwise, preserving the established ABACUS interface-library selection;mkl_blacs_openmpi_lp64, while MPICH and Intel MPI usemkl_blacs_intelmpi_lp64, as required by oneMKL.Note about visible affects
MKL_MPI=AUTO, MPI library-version probing is enabled beforefind_package(MPI)when the build is not cross-compiled. This allows Open MPI to be detected reliably, but does not work for cross builds. People who process cross builds should know what they are doing, and select the BLACS interface explicitly throughMKL_MPIwhen using MKL.Closes #7568.
Details
Linked Issue
Fix #7568
Unit Tests and/or Case Tests for my changes
Exact Verification Performed
What's changed?
Governance Checklist
GlobalV,GlobalC, orPARAMcode references, or exception requested below with reason, scope, risk, and cleanup plan..hpppropagation, or rationale provided below..batand.cmduse CRLF.CMakeLists.txt, or rationale provided below.INPUT Parameter Changes
docs/parameters.yamlupdated: nodocs/advanced/input_files/input-main.mdupdated: noCore Module Impact
Governance Exception