Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Coding Techniques

To improve performance, properly align arrays in your code. For more details, see Example of Data Alignment. Additional conditions can improve performance for specific function domains.

Data Alignment and Leading Dimensions

To improve performance of your application that calls Intel® oneAPI Math Kernel Library (oneMKL), align your arrays on 64-byte boundaries and pad the leading dimensions, keeping in mind the following recommendations:

Recommendation 1:
For best performance, the leading dimensions of matrices must be a multiple of 64 bytes (full cache line size). For single-precision real data, this means that the leading dimension must be a multiple of (64 / sizeof(float)), which is equal to 16 elements. Similarly, for double-precision real data or single-precision complex data, the leading dimension must be a multiple of 8 elements, while for double-precision complex data, the leading dimension should be a multiple of 4 elements.
Recommendation 2:
For best performance, leading dimensions must not be a multiple of a large power of 2 (for example, 4096 bytes). Increasing the leading dimension slightly (for example, from 4096 bytes to 4096+64 bytes) can improve performance in some cases.

LAPACK Packed Routines

The routines with the names that contain the letters HP, OP, PP, SP, TP, UP in the matrix type and storage position (the second and third letters respectively) operate on the matrices in the packed format (see LAPACK "Routine Naming Conventions" sections in the Intel® oneAPI Math Kernel Library (oneMKL) Developer Reference). Their functionality is strictly equivalent to the functionality of the unpacked routines with the names containing the lettersHE, OR, PO, SY, TR, UN in the same positions, but the performance is significantly lower.

If the memory restriction is not too tight, use an unpacked routine for better performance. In this case, you need to allocate N2/2 more memory than the memory required by a respective packed routine, where N is the problem size (the number of equations).

For example, to speed up solving a symmetric eigenproblem with an expert driver, use the unpacked routine:

            
call dsyevx(jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, iwork, ifail, info)
            

where a is the dimension lda-by-n, which is at least N2 elements,
instead of the packed routine:


call dspevx(jobz, range, uplo, n, ap, vl, vu, il, iu, abstol, m, w, z, ldz, work, iwork, ifail, info)
            

where ap is the dimension N*(N+1)/2.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201