SetMode

Sets a new mode for VML functions according to the mode parameter and stores the previous VML mode to oldmode.

Syntax

Fortran:

oldmode = vmlsetmode( mode )

C:

oldmode = vmlSetMode( mode );

Include Files

The FORTRAN 77 interfaces are specified in the mkl_vml.f77 include file, the Fortran 90 interfaces are specified in the mkl_vml.f90 include file, and the C interfaces are specified in the mkl_vml_functions.h include file.

Input Parameters

Name

Type

Description

mode

FORTRAN 77: INTEGER*8

Fortran 90: INTEGER(KIND=8), INTENT(IN)

C: const MKL_INT64

Specifies the VML mode to be set.

Output Parameters

Name

Type

Description

oldmode

FORTRAN: INTEGER*8

Fortran 90: INTEGER(KIND=8)

C: MKL_INT64

Specifies the former VML mode.

Description

The SetMode function sets a new mode for VML functions according to the mode parameter and stores the previous VML mode to oldmode. The mode change has a global effect on all the VML functions within a thread.

Note iconNote

You can override the global mode setting and change the mode for a given VML function call by using a respective vm[s,d]<Func> variant of the function.

The mode parameter is designed to control accuracy, handling of denormalized numbers, and error handling. Table "Values of the mode Parameter" lists values of the mode parameter. You can obtain all other possible values of the mode parameter from the mode parameter values by using bitwise OR ( | ) operation to combine one value for accuracy, one value for handling of denormalized numbers, and one vlaue for error control options. The default value of the mode parameter is VML_HA | VML_FTZDAZ_OFF | VML_ERRMODE_DEFAULT.

The VML_FTZDAZ_ON mode is specifically designed to improve the performance of computations that involve denormalized numbers at the cost of reasonable accuracy loss. This mode changes the numeric behavior of the functions: denormalized input values are treated as zeros (DAZ = denormals-are-zero) and denormalized results are flushed to zero (FTZ = flush-to-zero). Accuracy loss may occur if input and/or output values are close to denormal range.

Values of the mode Parameter
Value of mode Description
Accuracy Control
VML_HA high accuracy versions of VML functions
VML_LA low accuracy versions of VML functions
VML_EP enhanced performance accuracy versions of VML functions
Denormalized Numbers Handling Control
VML_FTZDAZ_ON Faster processing of denormalized inputs is enabled.
VML_FTZDAZ_OFF Faster processing of denormalized inputs is disabled.
Error Mode Control
VML_ERRMODE_IGNORE No action is set for computation errors.
VML_ERRMODE_ERRNO On error, the errno variable is set.
VML_ERRMODE_STDERR On error, the error text information is written to stderr.
VML_ERRMODE_EXCEPT On error, an exception is raised.
VML_ERRMODE_CALLBACK On error, an additional error handler function is called.
VML_ERRMODE_DEFAULT On error, the errno variable is set, an exception is raised, and an additional error handler function is called.

Examples

The following example shows how to set low accuracy, fast processing for denormalized numbers and errno error mode in the Fortran and C languages:

Fortran:

oldmode = vmlsetmode( VML_LA )
call vmlsetmode( IOR(VML_LA, VML_FTZDAZ_ON, VML_ERRMODE_ERRNO) )
C:

vmlSetMode( VML_LA );
vmlSetMode( VML_LA | VML_FTZDAZ_ON | VML_ERRMODE_ERRNO );

Submit feedback on this help topic

Copyright © 1994 - 2011, Intel Corporation. All rights reserved.