Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/31/2023
Public

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

Document Table of Contents

Usage Examples for CNR Support Functions

The following examples illustrate usage of support functions for conditional numerical reproducibility.

Setting Automatically Detected CNR Branch

    PROGRAM MAIN 
    INCLUDE 'mkl.fi'
    INTEGER*4 MY_CBWR_BRANCH
C Find the available MKL_CBWR_BRANCH automatically
    MY_CBWR_BRANCH = MKL_CBWR_GET_AUTO_BRANCH()
C User code without Intel MKL calls
C Piece of the code where CNR of Intel MKL is needed
C The performance of Intel MKL functions might be reduced for CNR mode
    IF (MKL_CBWR_SET (MY_CBWR_BRANCH) .NE. MKL_CBWR_SUCCESS) THEN
        PRINT *, 'Error in setting MKL_CBWR_BRANCH! Aborting…'
        RETURN
    ENDIF
C CNR calls to Intel MKL + any other code
    END

Use of the mkl_cbwr_get Function

    PROGRAM MAIN
    INCLUDE 'mkl.fi'
    INTEGER*4 MY_CBWR_BRANCH
C Piece of the code where CNR of Intel MKL is analyzed
    MY_CBWR_BRANCH = MKL_CBWR_GET(MKL_CBWR_BRANCH)
    IF (MY_CBWR_BRANCH .EQ. MKL_CBWR_AUTO) THEN
C actions in case of automatic mode
    ELSE IF (MY_CBWR_BRANCH .EQ. MKL_CBWR_SSSE3) THEN
C actions for SSSE3 code
    ELSE
C all other cases
    ENDIF
C User code
    END

Product and Performance Information

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

Notice revision #20201201