Hello Huiyu,
My understanding from the above question is, that you want to know why there is difference in numerical values when using ‘AVX’ and ‘AVX2’, and whether it is possible to configure the MKL libraries to utilize ‘AVX2’.
The variation in numerical values arises from the distinct ways ‘AVX’ and ‘AVX2’ interpret and process floating-point numbers. For a more comprehensive explanation, refer to the links provided below.
To configure the MKL libraries to use ‘AVX2’, follow these steps:
- Open Notepad and paste the following code:
- Save this file. It will be saved as a .TXT file. Change the extension to .BAT.
- Double-clicking this file will start MATLAB with MKL in ‘AVX2’ mode on an AMD machine.
The above solution creates an instance of MATLAB with MKL in ‘AVX2’ mode. Starting MATLAB without this method will start MATLAB with default settings.
To always start MATLAB with MKL in ‘AVX2’ mode, make a new variable in System Environment Variables with the name ‘MKL_DEBUG_CPU_TYPE’ and set its value as 5. For more details, refer the MATLAB answer provided below: