Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 7/13/2023
Public

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

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

libia32

The builder uses static Intel® oneAPI Math Kernel Library (oneMKL) interface, threading, and core libraries to build a customDLL for the IA-32 architecture.

libintel64

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

dllia32

The builder uses the single dynamic library libmkl_rt.dll to build a custom DLL for the IA-32 architecture.

dllintel64

The builder uses the single dynamic library libmkl_rt.dll 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

Defines which programming interface to use.Possible values:

  • For the IA-32 architecture, {cdecl}. The default value is cdecl.
  • For the Intel 64 architecture, {lp64|ilp64}. 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 isparallel.

Prallel = {intel|tbb}

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

cluster = {yes|no}

(For libintel64only) 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 isno.

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.

blacs_name = <lib name>

Specifies the name (without extension) of a custom Intel® oneAPI Math Kernel Library (oneMKL) BLACS library to use. Ignored if'cluster=no'. 'blacs_mpi' is ignored if 'blacs_name' was explicitly specified. The default value is mkl_blacs_<blacs_mpi>_<interface>.

mpi = <lib name>

Specifies the name (without extension) of the MPI library used to build the custom DLL. Ignored if 'cluster=no'. The default value is impi.

export = <file name>

Specifies the full name of the file that contains the list of entry-point functions to be included in the DLL. The default name is user_example_list (no extension).

name = <dll name>

Specifies the name of the dll and interface library to be created. By default, the names of the created libraries are mkl_custom.dll and mkl_custom.lib.

xerbla = <error handler>

Specifies the name of the object file <user_xerbla>.objthat contains the error handler of the user. The makefile adds this error handler to the library for use instead of the default Intel® oneAPI Math Kernel Library (oneMKL) error handlerxerbla. If you omit this parameter, the native Intel® oneAPI Math Kernel Library (oneMKL)xerbla is used. See the description of the xerblafunction in the Intel® oneAPI Math Kernel Library (oneMKL) Developer Reference to develop your own error handler. For the IA-32 architecture, the object file should be in the interface defined by the interface macro (cdecl).

MKLROOT = <mkl directory>

Specifies the location of Intel® oneAPI Math Kernel Library (oneMKL) libraries used to build the customDLL. By default, the builder uses the Intel® oneAPI Math Kernel Library (oneMKL) installation directory.

uwd_compat = {yes|no}

Build a Universal Windows Driver (UWD)-compatible custom DLL with OneCore.lib. The recommended versions of Windows SDK are 10.0.17134.0 or higher.

If 'uwd_compat'=yes, then threading = sequential and crt = ucrt.lib by default.

The default value of is uwd_compat is no.

buf_lib

Manages resolution of the __security_cookie external references in the custom DLL on systems based on the Intel® 64 architecture.

By default, the makefile uses the bufferoverflowu.lib library of Microsoft SDK builds 1289 or higher. This library resolves the __security_cookie external references.

To avoid using this library, set the empty value of this parameter. Therefore, if you are using an older SDK, set buf_lib= .

CAUTION:

Use the buf_lib parameter only with the empty value. Incorrect value of the parameter causes builder errors.

crt = <c run-time library>

Specifies the name of the Microsoft C run-time library to be used to build the custom DLL. By default, the builder uses msvcrt.lib.

manifest = {yes|no|embed}

Manages the creation of a Microsoft manifest for the custom DLL:

  • If manifest=yes, the manifest file with the name defined by the name parameter above and the manifest extension is created.
  • If manifest=no, the manifest file is not be created.
  • If manifest=embed, the manifest is embedded into the DLL.

By default, the builder does not use the manifest parameter.

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 appropriate 32-bit (x86) or 64-bit (x64 or amd-64) architecture flag.
  • If you are using the Intel compiler, use the compilervars.bat script with the appropriate 32-bit (x86) or 64-bit (x64 or amd-64) architecture flag.

In the simplest case, the command line is:

#source Visual Studio environment variables
call vcvarsall.bat x86
#run custom dll builder script
nmake ia32

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

Here is an example of a more complex case:

#source Visual Studio environment variables
call vcvarsall.bat x86
#run custom dll builder script
nmake ia32 interface=cdecl export=my_func_list.txt name=mkl_small xerbla=my_xerbla.obj

In this case, the command creates the mkl_small.dll and mkl_small.lib libraries with the cdecl interface for processors using the IA-32 architecture. The command takes the list of functions from my_func_list.txt 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_function_list.txt for specific functionality:

#source Visual Studio environment variables, LIB should have paths to desired OneCore.lib and universal crt libraries
call vcvarsall.bat x64
#run custom dll builder script
nmake intel64 interface=lp64 export=my_func_list.txt 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