Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Linux*

ID 766690
Date 12/16/2022
Public

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

Document Table of Contents

Using High-bandwidth Memory with oneMKL

To achieve maximum performance, Intel® oneAPI Math Kernel Library may use the memkind library (https://github.com/memkind/memkind), which enables controlling memory characteristics and partitioning the heap between different kinds of memory. By default Intel® oneAPI Math Kernel Library memory manager tries to allocate memory to Multi-Channel Dynamic Random Access Memory (MCDRAM) using the memkind library on the 2nd generation Intel® Xeon Phi™ product family (for more details of MCDRAM, see https://software.intel.com/content/www/us/en/develop/articles/mcdram-high-bandwidth-memory-on-knights-landing-analysis-methods-tools.html). If allocation of memory to MCDRAM is not possible at the moment, Intel® oneAPI Math Kernel Library memory manager falls back to a regular system allocator.

By default the amount of MCDRAM available for Intel® oneAPI Math Kernel Library is unlimited. To control the amount of MCDRAM available for Intel® oneAPI Math Kernel Library, do either of the following:

  • Call

    mkl_set_memory_limit (MKL_MEM_MCDRAM, <limit_in_mbytes>)

  • Set the environment variable:

    • For the bash shell:

      MKL_FAST_MEMORY_LIMIT="<limit_in_mbytes>"

    • For a C shell (csh or tcsh):

      setenv MKL_FAST_MEMORY_LIMIT "<limit_in_mbytes>"

The setting of the limit affects all Intel® oneAPI Math Kernel Library functions, including user-callable memory functions such asmkl_malloc. Therefore, if an application calls mkl_malloc, mkl_calloc, or mkl_realloc, which always tries to allocate memory to MCDRAM, make sure that the limit is sufficient.

If you replace Intel® oneAPI Math Kernel Library memory management functions with your own functions (for details, see Redefining Memory Functions), Intel® oneAPI Math Kernel Library uses your functions and does not work with the memkind library directly.

Product and Performance Information

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

Notice revision #20201201