-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove most special handling of MKL in CMake configuration #1149
Conversation
cscs-ci run |
cscs-ci run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The include directory is needed, otherwise non-spack builds are not possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cscs-ci run |
I've changed back the CUDA CI to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if and how to cache the try_compile result for detecting MKL
Not sure... maybe @albestro has an idea?
I would say that it might be nicer to not cache, so that any change to Otherwise, let's suppose we do this sequence
with the cached result for MKL we might end up getting BLAS/LAPACK error, because of the So, I would suggest to do the same we do for LAPACK in FindLAPACK, i.e. |
Currently on this branch, the I think if we reset and redetect MKL every time then As a last option, we |
Not sure what to say... just realized that auto-detection might have false positive if the mkl include directory is present (e.g. if using mkl fftw).
If a variable is also needed in the rest of the cmake scripts I would use a different name. |
cscs-ci run |
This sounds pretty reasonable. I made an attempt at implementing this logic in d5a7ae4.
Yeah, I was worried about something like this as well. Without intending to I think this now covers that quite reasonably: Lines 81 to 84 in d5a7ae4
DLAF_WITH_MKL is explicitly enabled we can safely disable OpenMP. If DLAF_WITH_MKL is undefined that first branch is always false so we'll keep OpenMP enabled (if it wasn't changed by the user). In the worst case we end up calling both omp_set_num_threads and mkl_set_num_threads , but we won't end up in the situation where we think we're using MKL, but we're not setting omp_set_num_threads .
In the spack package we set At least this is how I think it's working now and I think it seems reasonable, but not 100% sure. I think warning/status messages can still be tweaked, but I'll leave that up to you to comment about. |
cscs-ci run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
It is only to be set by users, but should be undefined otherwise.
Co-authored-by: Rocco Meli <[email protected]>
cscs-ci run |
DLAF_WITH_MKL_LEGACY
option is completely removedThis is currently untested, but early feedback more than welcome and the general structure is in place!
The first version of the MKL auto-detection simply uses
try_compile
withLAPACK_LIBRARY
and a call tomkl_set_num_threads_local
. It uses the result of thistry_compile
as the default value ofDLAF_WITH_MKL
. It's important to note that currently this will only be tested on the first configuration, so if the first configuration is wrong, and one then changesLAPACK_LIBRARY
to have the correct paths,DLAF_WITH_MKL
will still be off.On the other hand, the above method means that one can simply set
DLAF_WITH_MKL
manually to on if one expects MKL to be there, and compilation will then fail if it's not there (instead of quietly disabling it).The logic could be changed/improved to have different behaviour in the above case.
An alternative method is to simply use
__has_include
insingle_threaded_blas.cpp
. This doesn't allow overriding and is silent in either case (MKL found or not found).