Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

Determingine MKL version number during compile

John_Young
New Contributor I
590 Views
Hi,

Does MKL #define anything that indicate its version number and that can be seen by the preprocessor during a compile (C/C++)? Some function definitions seem to have changed between MKL 10.1 and 10.2. For example, the LAPACK function 'cpptrf' changed from

cpptrf(char*, int*, float*, int*)

to

cpptrf(char*,int*,(MKL_Complex8*),int*)

Right now we have the user explicitly set a #define before comple to indicate which mkl version they have, but it would be nice if we could key off something that is set by MKL itself.

Thanks,
John
0 Kudos
6 Replies
mecej4
Honored Contributor III
590 Views
Look up the functions MKL_Get_Version() and MKL_Get_Version_String().
0 Kudos
John_Young
New Contributor I
590 Views
I am aware of those functions, but those are at run time. I would like to #ifdef things at compile time depending on the MKL version.

John
0 Kudos
mecej4
Honored Contributor III
590 Views
In that case, why not insert your own version symbol into, say, mkl.h ? If needed, a comparison of the value of this preprocessor symbol to the return value of MKL_Get_Version() could be put in your initialization code as a sanity check .
0 Kudos
barragan_villanueva_
Valued Contributor I
590 Views
Hi,

Thanks for your suggestion.Introducing kind of MKL_VERSION macro into would be very helpful but only for C/C++ users.
0 Kudos
John_Young
New Contributor I
590 Views
That would be one solution. However, some users do not have write access to MKL libraries on the systems they are using.

0 Kudos
John_Young
New Contributor I
590 Views
Victor,

That would be great if some macros could be added.

I am not sure if the Fortran libraries suffer from the same problem that the C/C++ libraries do, so maybe having the version available at compile time is not as useful on the Fortran side. For example, the C/C++ interface of 'cpptrf' changed between versions 11.1 and 11.2. I do not think (but I have not checked) the Fortran interface for this particular function changed between 11.1 and 11.2. I suppose subroutine interface changes could happen in the Fortran libraries as well though.

That being said, if you want to make a macro available to Fortran users who do actually pre-process their files, you could create a separate header such as 'mkl_version.h'. Inside 'mkl_version.h' would only exist #define macros. That way a Fortran user who is using pre-processing could still #include it.

Thanks,
John
0 Kudos
Reply