Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 3/31/2025
Public
Document Table of Contents

Using the Custom Dynamic-Link Library Builder in the Command-Line Mode

To build a custom DLL, use the following command:

nmake target [<options>]

The following table lists possible values of target and explains what the command does for each value:

Value

Comment

libintel64

The builder uses static Intel® oneAPI Math Kernel Library (oneMKL) interface, threading, and core libraries to build a custom DLL for the Intel® 64 architecture.

help

The command prints Help on the custom DLL builder

The <options> placeholder stands for the list of parameters that define macros to be used by the makefile. The following table describes these parameters:

Parameter [Values]

Description

interface = {lp64|ilp64}

The lp64 interface uses the 32-bit integer type, while the ilp64 interface uses the 64-bit integer type. The default value is lp64.

threading = {parallel|sequential}

Defines whether to use the Intel® oneAPI Math Kernel Library (oneMKL) in the threaded or sequential mode. The default value is parallel.

parallel = {intel|tbb}

Specifies whether to use Intel OpenMP or Intel® oneTBB. The default value is intel.

cluster = {yes|no}

Specifies whether Intel® oneAPI Math Kernel Library (oneMKL) cluster components (BLACS, ScaLAPACK and/or CDFT) are needed to build the custom shared object. The default value is no.

blacs_mpi = {intelmpi|msmpi}

Specifies the pre-compiled Intel® oneAPI Math Kernel Library (oneMKL) BLACS library to use. Ignored if'cluster=no'. The default value is intelmpi.

All of the above parameters are optional. However, you must make the system and c-runtime (crt) libraries and link.exe available by setting the PATH and LIB environment variables appropriately. You can do this in the following ways:

  • Manually.
  • If you are using Microsoft Visual Studio (VS), call the vcvarsall.bat script with the 64-bit (x64 or amd64) architecture flag.
  • If you are using the Intel compiler, call the setvars.bat script.

In the simplest case, the command line is:

rem Set environment variables
call <oneAPI_dir>\setvars.bat

rem Run custom dll builder script
nmake libintel64

and the missing options have default values. This command creates the  mkl_custom.dll and mkl_custom.lib libraries with the lp64 interface for processors using the Intel® 64 architecture. The command takes the list of functions from the user_example_list file and uses the native Intel® oneAPI Math Kernel Library (oneMKL) error handlerxerbla.

Here is an example of a more complex case:

rem Set Visual Studio environment variables
call <script_dir>\vcvarsall.bat x64

rem Run custom dll builder script
nmake libintel64 threading=sequential export=my_func_list name=mkl_small xerbla=my_xerbla.obj

In this case, the command creates the mkl_small.dll and mkl_small.lib libraries with oneMKL sequential mode for processors using the Intel® 64 architecture. The command takes the list of functions from the my_func_list file and uses the error handler of the user my_xerbla.obj.

To build a UWD-compatible custom dll, use the uwd_compat=yes option. For this purpose, you must make a different set of universal system (OneCore.lib) and universal c-runtime (ucrt.lib) libraries available. You can get these libraries by downloading Windows 10 SDK 10.0.17134.0 (version 1803) or newer. Make sure to source the Visual Studio environment with the appropriate native architecture to add the libraries to your path.

This example shows how to create a 64-bit architecture library, mkl_uwd_compat.dll, that is UWD-compatible with the lp64 interface using my_func_list for specific functionality:

rem Set Visual Studio environment variables. LIB should have paths to desired OneCore.lib and universal crt libraries.
call <script_dir>\vcvarsall.bat x64

rem Run custom dll builder script
nmake libintel64 interface=lp64 export=my_func_list uwd_compat=yes name=mkl_uwd_compat

Product and Performance Information

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

Notice revision #20201201