Skip to content

Fix MKL version detection for oneAPI and fail fast on a bad Boost source tree (#117) - #139

Draft
skilledwolf wants to merge 1 commit into
ALPSim:masterfrom
skilledwolf:fix/mkl-version-detection
Draft

Fix MKL version detection for oneAPI and fail fast on a bad Boost source tree (#117)#139
skilledwolf wants to merge 1 commit into
ALPSim:masterfrom
skilledwolf:fix/mkl-version-detection

Conversation

@skilledwolf

@skilledwolf skilledwolf commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the two CMake configure failures from the Spack thread in #117.

  • FindLapack.cmake parsed the MKL version with a single-space pattern. oneAPI column-aligns the macro values, so MKL_VERSION ended up holding raw header lines and the unquoted if() died with Unknown arguments specified whenever MKLROOT was set in the environment. Match the whitespace properly, choose the library layout by version comparison (layered libraries since 10.0, lib/intel64 or lib since 10.3) so the year-numbered releases work, prefer lib/ when lib/intel64 is absent (oneAPI 2024+), and add -ldl on Linux.
  • FindBoostSrc.cmake: when Boost_SRC_DIR points at a directory without boost/version.hpp, stop with one clear error instead of a file(READ) error, three MATH() errors and Boost Version: ERROR_ERROR_ERROR.

The Spack side (handing Spack's BLAS/LAPACK to ALPS so a host MKLROOT cannot hijack the build) is in ALPSim/spack-packages#1.

Testing

  • CMake harness with fake MKL trees (9.1, 10.2, 11.1, 2023, 2025, missing header) on the Linux and Darwin code paths: the old module reproduces the Unknown arguments error, the new one produces the expected link line for each vintage
  • same harness for FindBoostSrc: an empty directory now fails with a single message; the fetched Boost 1.87 tree still reports 1_87_0

Related to #117

…ost tree

FindLapack.cmake parsed the MKL version with a single-space pattern
("#define __INTEL_MKL__ ([0-9]+)").  oneAPI column-aligns the values in
mkl_version.h, so the pattern never matched, MKL_VERSION ended up holding
the raw header lines, and the unquoted if() checks died with

  CMake Error at config/FindLapack.cmake:159 (if):
    Unknown arguments specified

as soon as MKLROOT was set in the environment (reported in ALPSim#117 for a
Spack build on a machine with oneAPI 2025 installed).

- Match the whitespace as [ \t]+ and extract the version with REGEX MATCH.
- Decide the library layout by version comparison (layered libraries since
  10.0, lib/intel64 or lib since 10.3) instead of patterns that only knew
  10.x and 11.x, so the year-numbered releases (2017 ... oneAPI 2025) get
  the layered libraries rather than the pre-10 -lmkl -lguide set.
- Use lib/ when lib/intel64 does not exist (oneAPI 2024+), add -ldl on
  Linux, warn and assume a current release when no version can be read,
  and fix the $ENV{mkl_home} typo in the include search.

FindBoostSrc.cmake: when Boost_SRC_DIR points at a directory without
boost/version.hpp (the first failure in ALPSim#117, an empty resource
directory), stop with one FATAL_ERROR naming the directory and the
options, instead of a file(READ) error, three MATH() errors and
"Boost Version: ERROR_ERROR_ERROR".

Refs ALPSim#117

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant