Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 10/31/2024
Public
Document Table of Contents

Using the ILP64 Interface vs. LP64 Interface

The Intel® oneAPI Math Kernel Library (oneMKL) ILP64 libraries use the 64-bit integer type (necessary for indexing large arrays, with more than 231-1 elements), whereas the LP64 libraries index arrays with the 32-bit integer type.

The LP64 and ILP64 interfaces are implemented in the Interface layer. Link with the following interface libraries for the LP64 or ILP64 interface, respectively:

  • mkl_intel_lp64.lib or mkl_intel_ilp64.lib for static linking
  • mkl_intel_lp64_dll.lib or mkl_intel_ilp64_dll.lib for dynamic linking

The ILP64 interface provides for the following:

  • Support large data arrays (with more than 231-1 elements)
  • Enable compiling your Fortran code with the /4I8 compiler option

The LP64 interface provides compatibility with the previous Intel® oneAPI Math Kernel Library (oneMKL) versions because "LP64" is just a new name for the only interface that the Intel® oneAPI Math Kernel Library (oneMKL) versions lower than 9.1 provided. Choose the ILP64 interface if your application uses Intel® oneAPI Math Kernel Library (oneMKL) for calculations with large data arrays or the library may be used so in the future.

On 64-bit platforms, selected domains provide API extensions with the _64 suffix (for example, SGEMM_64) for supporting large data arrays in the LP64 library, which enables the mixing of data types in one application. The selected domains and APIs include the following:

  • BLAS: Fortran-style APIs for C applications and CBLAS APIs with integer arguments
  • LAPACK: Fortran-style APIs for C applications and LAPACKE APIs with integer arguments
  • Vector Statistics: API for C applications only on 64-bit platforms for selected functions:

    • Random Number Generators: vslNewStream_64; vslNewStreamEx_64; all Distribution Generators (for example, vsRngUniform_64)
    • Summary Statistics: Task Constructors (vslsSSNewTask; vsldSSNewTask)

Intel® oneAPI Math Kernel Library (oneMKL) provides the same include directory for the ILP64 and LP64 interfaces.

Compiling for LP64/ILP64

The table below shows how to compile for the ILP64 and LP64 interfaces:

Fortran

Compiling for ILP64

ifx /4I8 /I<mkl directory>\include ...

Compiling for LP64

ifx /I<mkl directory>\include ...

C or C++

Compiling for ILP64

icx/DMKL_ILP64 /I<mkl directory>\include ...

Compiling for LP64

icx/I<mkl directory>\include ...

CAUTION:

Linking of an application compiled with the /4I8 or /DMKL_ILP64 option to the LP64 libraries may result in unpredictable consequences and erroneous output.

Coding for ILP64

You do not need to change existing code if you are not using the ILP64 interface.

To migrate to ILP64 or write new code for ILP64, use appropriate types for parameters of the Intel® oneAPI Math Kernel Library (oneMKL) functions and subroutines:

Integer Types

Fortran

C or C++

32-bit integers

INTEGER*4 or
INTEGER(KIND=4)

int

Universal integers for ILP64/LP64:

  • 64-bit for ILP64

  • 32-bit otherwise

INTEGER
without specifying KIND

MKL_INT

Universal integers for ILP64/LP64:

  • 64-bit integers

INTEGER*8 or
INTEGER(KIND=8)

MKL_INT64

FFT interface integers for ILP64/LP64

INTEGER
without specifying KIND

MKL_LONG

To determine the type of an integer parameter of a function, use appropriate include files. For functions that support only a Fortran interface, use the C/C++ include files *.h.

The above table explains which integer parameters of functions become 64-bit and which remain 32-bit for ILP64. The table applies to most Intel® oneAPI Math Kernel Library (oneMKL) functions except some Vector Mathematics and Vector Statistics functions, which require integer parameters to be 64-bit or 32-bit regardless of the interface:

  • Vector Mathematics: The mode parameter of the functions is 64-bit.

  • Random Number Generators (RNG):

    All discrete RNG except viRngUniformBits64 are 32-bit.

    The viRngUniformBits64 generator function and vslSkipAheadStream service function are 64-bit.

  • Summary Statistics: The estimate parameter of the vslsSSCompute/vsldSSCompute function is 64-bit.

Refer to the Intel® oneAPI Math Kernel Library (oneMKL) Developer Reference for more information.

To better understand ILP64 interface details, see also examples.

Limitations

All Intel® oneAPI Math Kernel Library (oneMKL) function domains support ILP64 programming but FFTW interfaces to Intel® oneAPI Math Kernel Library (oneMKL):

  • FFTW 2.x wrappers do not support ILP64.

  • FFTW 3.x wrappers support ILP64 by a dedicated set of functions plan_guru64.