Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Fix MKL detection when not using environment modules #2443

Merged
merged 4 commits into from
May 16, 2024

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented May 14, 2024

If MKLROOT is set (e.g., source /opt/intel/oneapi/setvars.sh will do that), first try FindBLAS instead of just relying on MKL_INCDIR and MKL_LIB.

Fixes #2441.

If MKLROOT is set (e.g., `source /opt/intel/oneapi/setvars.sh` will do that), first try FindBLAS instead of just relying on MKL_INCDIR and MKL_LIB.

Fixes AMICI-dev#2441.
@dweindl dweindl linked an issue May 14, 2024 that may be closed by this pull request
Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.64%. Comparing base (44ed074) to head (6c39a6b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2443   +/-   ##
========================================
  Coverage    77.64%   77.64%           
========================================
  Files          324      324           
  Lines        20930    20930           
  Branches      1464     1464           
========================================
  Hits         16251    16251           
  Misses        4676     4676           
  Partials         3        3           
Flag Coverage Δ
cpp 73.41% <ø> (ø)
cpp_python 34.10% <ø> (ø)
petab 36.66% <ø> (ø)
python 31.45% <ø> (-40.74%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@dweindl dweindl marked this pull request as ready for review May 15, 2024 06:40
@dweindl dweindl requested a review from a team as a code owner May 15, 2024 06:40
@dweindl dweindl self-assigned this May 15, 2024
# Was MKLROOT set by /opt/intel/oneapi/setvars.sh? then cmake will find it
message(STATUS "Trying to find BLAS based on MKLROOT=$ENV{MKLROOT}")
# give the user the option to override the BLA_VENDOR
if(NOT DEFINED BLA_VENDOR)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add message about assumed default here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The default is that BLA_VENDOR is undefined and that any BLAS is accepted.
I add a message with the current value.

if(NOT DEFINED BLA_VENDOR)
set(BLA_VENDOR Intel10_64lp)
endif()
find_package(BLAS)
Copy link
Member

Choose a reason for hiding this comment

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

Is this really only going to work if MKLROOT is set?

Copy link
Member Author

Choose a reason for hiding this comment

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

find_package(BLAS)? No, generally MKLROOT does not need to be set. But to use the Intel MKL, it is most likely required. I'd have to check the full cmake module to see which other environment variables might be considered, but with a default installation, it only works after setting certain env variables, and MKLROOT is one of them.

The find_package(BLAS) case without MKLROOT is handled further down.

Copy link
Member

Choose a reason for hiding this comment

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

ah, missed the if(DEFINED ENV{MKLROOT})

if(NOT DEFINED BLA_VENDOR)
set(BLA_VENDOR Intel10_64lp)
endif()
find_package(BLAS)
Copy link
Member

Choose a reason for hiding this comment

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

ah, missed the if(DEFINED ENV{MKLROOT})

@dweindl dweindl merged commit 59256b4 into AMICI-dev:develop May 16, 2024
20 checks passed
@dweindl dweindl deleted the fix_mkl branch May 16, 2024 08:53
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.

Compilation fails with Intel OneApi MKL 2024.1
2 participants