3 <strong>Intel</strong>® M<strong>at</strong>h Kernel Library User’s GuideConceptILP64 interface is provided for the following two reasons:• To support huge d<strong>at</strong>a arrays, th<strong>at</strong> is, arrays with more than 2 billion elements• To enable compiling your Fortran code with the -i8 compiler option.The <strong>Intel</strong>® Fortran Compiler supports the -i8 option for changing behavior of the INTEGERtype. By default the st<strong>and</strong>ard INTEGER type is 4-byte. The -i8 option makes the compilertre<strong>at</strong> INTEGER constants, variables, function <strong>and</strong> subroutine parameters as 8-byte.The ILP64 binary interface uses 8-byte integers for function parameters th<strong>at</strong> define arraysizes, indices, strides, etc. At the language level, th<strong>at</strong> is, in the *.f90 <strong>and</strong> *.fi filesloc<strong>at</strong>ed in the <strong>Intel</strong> MKL include directory, such parameters are declared as INTEGER.To bind your Fortran code with the ILP64 interface, you must compile your code with the-i8 compiler option. And vice-versa, if your code is compiled with -i8, you can bind it onlywith the ILP64 interface, as the LP64 binary interface requires the INTEGER type to be4-byte.Note th<strong>at</strong> some <strong>Intel</strong> MKL functions <strong>and</strong> subroutines have scalar or array parameters oftype INTEGER*4 or INTEGER(KIND=4), which are always 4-byte, regardless of whether thecode is compiled with the -i8 option.For the languages of C <strong>and</strong> C++, <strong>Intel</strong> MKL provides the MKL_INT type as a counterpart ofthe INTEGER type for Fortran. MKL_INT is a macro defined as the st<strong>and</strong>ard C/C++ type intby default. However, if the MKL_ILP64 macro is defined for the code compil<strong>at</strong>ion, MKL_INTis defined as a 64-bit integer type. To define the MKL_ILP64 macro, you may call thecompiler with the -DMKL_ILP64 comm<strong>and</strong>-line option.<strong>Intel</strong> MKL also defines the type MKL_LONG for maintaining ILP64 interface in the specificcase of FFT interface for C/C++. The MKL_LONG macro is defined as the st<strong>and</strong>ard C/C++type long by default; <strong>and</strong> if the MKL_ILP64 macro is defined for the code compil<strong>at</strong>ion,MKL_LONG is defined as a 64-bit integer type.NOTE. The type int is 32-bit for the <strong>Intel</strong>® C++ compiler, as well as formost of modern C/C++ compilers. The type long is 32- or 64-bit for the<strong>Intel</strong>® C++ <strong>and</strong> comp<strong>at</strong>ible compilers, depending on the particular OS.In the <strong>Intel</strong> MKL interface for the C or C++ languages, th<strong>at</strong> is, in the *.h header filesloc<strong>at</strong>ed in the <strong>Intel</strong> MKL include directory, such function parameters as array sizes, indices,strides, etc. are declared as MKL_INT.The FFT interface for C/C++ is the specific case. The header file mkl_dfti.h uses theMKL_LONG type for both explicit <strong>and</strong> implicit parameters of the interface functions.Specifically, type of the explicit parameter dimension of the function3-6
<strong>Intel</strong>® M<strong>at</strong>h Kernel Library Structure 3DftiCre<strong>at</strong>eDescriptor() is MKL_LONG <strong>and</strong> type of the implicit parameter length isMKL_LONG for a one-dimensional transform <strong>and</strong> MKL_LONG[] (th<strong>at</strong> is, an array of numbershaving type MKL_LONG) for a multi-dimensional transform.To bind your C or C++ code with the ILP64 interface, you must provide the -DMKL_ILP64comm<strong>and</strong>-line option to the compiler to enforce MKL_INT <strong>and</strong> MKL_LONG being 64-bit. Andvice-versa, if your code is compiled with -DMKL_ILP64 option, you can bind it only with theILP64 interface, as the LP64 binary interface requires MKL_INT to be 32-bit <strong>and</strong> MKL_LONGto be the st<strong>and</strong>ard long type.Note th<strong>at</strong> certain MKL functions have parameters explicitly declared as int or int[]. Suchintegers are always 32-bit regardless of whether the code is compiled with the-DMKL_ILP64 option.Table 3-2 summarizes how the <strong>Intel</strong> MKL ILP64 concept is implemented:Table 3-2<strong>Intel</strong>® MKL ILP64 conceptThe same include directory forILP64 <strong>and</strong> LP64 interfacesType used for parameters th<strong>at</strong>are always 32-bitType used for parameters th<strong>at</strong>are 64-bit integers for theILP64 interface <strong>and</strong> 32-bitintegers for LP64Type used for all integerparameters of the FFTfunctionsComm<strong>and</strong>-line option tocontrol compiling for ILP64FortranC or C++/includeINTEGER*4intINTEGERMKL_INTINTEGERMKL_LONG-i8 -DMKL_ILP64Compiling for ILP64The same copy of the <strong>Intel</strong> MKL include directory is used for both ILP64 <strong>and</strong> LP64interfaces. So, the compil<strong>at</strong>ion for the ILP64 interface looks like this:Fortran:ifort -i8 -I/include …C or C++:icc -DMKL_ILP64 -I/include …3-7