Visible to Intel only — GUID: GUID-E9D1623E-C85F-4D10-A1E2-9CAA258E30BC
Visible to Intel only — GUID: GUID-E9D1623E-C85F-4D10-A1E2-9CAA258E30BC
Using Predefined Preprocessor Symbols for Intel® MKL Version-Dependent Compilation
Preprocessor symbols (macros) substitute values in a program before it is compiled. The substitution is performed in the preprocessing phase.
The following preprocessor symbols are available:
Predefined Preprocessor Symbol |
Description |
---|---|
__INTEL_MKL__ |
Intel® oneAPI Math Kernel Library (oneMKL) major version |
__INTEL_MKL_MINOR__ |
Intel® oneAPI Math Kernel Library (oneMKL) minor version |
__INTEL_MKL_UPDATE__ |
Intel® oneAPI Math Kernel Library (oneMKL) update number |
INTEL_MKL_VERSION |
Intel® oneAPI Math Kernel Library (oneMKL) full version in the following format: INTEL_MKL_VERSION = (__INTEL_MKL__*100+__INTEL_MKL_MINOR__)*100+__INTEL_MKL_UPDATE__ |
These symbols enable conditional compilation of code that uses new features introduced in a particular version of the library.
To perform conditional compilation:
- Depending on your compiler, include in your code the file where the macros are defined:
C/C++ compiler:
mkl_version.h,
or mkl.h, which includes mkl_version.h
Intel® Fortran compiler:
mkl.fi
Any Fortran compiler with enabled preprocessing:
mkl_version.h
Read the documentation for your compiler for the option that enables preprocessing.
- [Optionally] Use the following preprocessor directives to check whether the macro is defined:
- #ifdef, #endif for C/C++
- !DEC$IF DEFINED, !DEC$ENDIF for Fortran
- Use preprocessor directives for conditional inclusion of code:
- #if, #endif for C/C++
- !DEC$IF, !DEC$ENDIF for Fortran
Example
This example shows how to compile a code segment conditionally for a specific version of Intel® oneAPI Math Kernel Library (oneMKL). In this case, the version is 11.2 Update 4:
Intel® Fortran Compiler:
include "mkl.fi"
!DEC$IF DEFINED INTEL_MKL_VERSION
!DEC$IF INTEL_MKL_VERSION .EQ. 110204
* Code to be conditionally compiled
!DEC$ENDIF
!DEC$ENDIF
C/C++ Compiler. Fortran Compiler with Enabled Preprocessing:
#include "mkl.h"
#ifdef INTEL_MKL_VERSION
#if INTEL_MKL_VERSION == 110204
... Code to be conditionally compiled
#endif
#endif