Currently, the following Intel® oneAPI Math Kernel Library (oneMKL) types are defined in the mkl_types.h header file:
MKL_INT - for integer values
MKL_UINT - for unsigned integer values
MKL_Complex8 - for single precision complex values (a structure that contains single precision real and imaginary parts
real
and imag
)MKL_Complex16 - for double precision complex values (a structure that contains double precision real and imaginary parts
real
and imag
)See the oneMKL User's Guide and the mkl_types.h header file for more details.
The types listed above can be redefined in oneMKL version 10.3 update 4 so that C/C++ developers can avoid explicit argument casting when calling the library in applications that use the types "binary compatible" with those in oneMKL.
Such a possibility is often needed because the user can use his or her own types that can be "binary compatible", that is, having the same representation or memory layout.
For example:
- ISO C99 Complex type qualifier
_Complex
- C++ Complex types std::complex
- There are several integer types on Linux* OS for ILP64, for example:
__int64
,
long
orlong long
Another way to do this is to use the compiler option -D<name>=<username>, for example:
#define MKL_INT size_t
#include "mkl.h"
or
add the compiler option "-DMKL_INT=size_t" in the command line or build configuration.
Inaccurate redefinition of the oneMKL types may result in unpredictable computational results and/or crash of the application if the user's data types and those of oneMKL turn out to be incompatible (*). It is the user's responsibility to make a thorough analysis of such cases before redefining data types in oneMKL.
An example of incorrect redefinition for the oneMKL integer data type: #define MKL_INT double
An example of correct redefinition of MKL_INT for ILP64 if positive integer values less than 2^63 are used:
#define MKL_INT size_t
Below is a short C++ example zhetrd.cpp on the Linux OS and Windows, that covers the correct redefinition of MKL_Complex16
and MKL_INT:
Use the following on the Linux OS with the Intel® compiler:
and the next example illustrates linking that uses Intel® compilers on the Window OS.
Use the command below to output result: The result:
(*) this feature is intended for advanced users