Routine level mode control for VML

VML API in Intel® MKL has been extended to have routine level mode control from Intel® MKL 10.3 onwards.

VML mathematical and pack/unpack function full names have the following new structure:


The initial letter v is a prefix indicating that a function belongs to VML.

The [m] field is an optional prefix for mathematical functions that indicates additional argument to specify VML mode for a given function call (see vmlSetMode from MKL Reference Manual for possible values and their description).

The <?> field is a precision prefix that indicates the data type:

s        REAL for Fortran interface, or float for C interface
d        DOUBLE PRECISION for Fortran interface, or double for C interface.
c        COMPLEX for Fortran interface, or MKL_Complex8 for C interface.
z        DOUBLE COMPLEX for Fortran interface, or MKL_Complex16 for C interface.

The <name> field indicates the function short name, with some of its letters in uppercase for C interface (see for example Table "VML Mathematical Functions" or Table "VML Service Functions").

The <mod> field (written in uppercase for C interface) is present in pack/unpack functions only; it indicates the indexing method used:

i         indexing with positive increment
v        indexing with index vector
m       indexing with mask vector.


To call VML functions from an application program, use conventional function calls. For example, the VML exponential function for single precision real data can be called as

call vsexp ( n, a, y ) for Fortran interface,
call vmsexp ( n, a, y, mode ) for Fortran interface with specified mode,
vsExp ( n, a, y ); for C interface,
vmsExp ( n, a, y, mode ); for C interface with specified mode.



Considering the exp function from MKL, the function naming and calling functions are mentioned below for older MKL versions and the changes in the new MKL 10.3 beta.

MKL 10.2.* and earlier, the VML exp and sin functions are:

vdExp(const MKL_INT n, const double a[], double r[])
vdExp(const MKL_INT n, const double r[], double r[])

To set accuracy the user had to call vmlSetMode() function separately with accuracy parameter as below in the earlier versions.

vmlSetMode(VML_LA);  /* Setting Low Accuracy */
vdExp(1000, a, r);
vmlSetMode(VML_HA);  /* Setting High Accuracy */
vdSin(1000, r, r);

From MKL 10.3 and future versions, the calls to the VML exp and sin functions are:

vmdExp(const MKL_INT n, const double a[], double r[], MKL_INT64 mode)
vmdSin(const MKL_INT n, const double r[], double r[], MKL_INT64 mode)

Setting accuracy has been made easier by passing it as a parameter in the VML computation routine itself.

vmdExp(1000, a, r, VML_LA);
vmdSin(1000, r, r, VML_HA);

NOTE: Both styles are equally supported in MKL 10.3 and future versions.


For more complete information about compiler optimizations, see our Optimization Notice.