Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Different computation results on different processors using mkl_cbwr_set(int)

seredzhinov__renat
781 Views
  1. There are two desktop PC with the following processors:  Intel Core i5 4570 (Haswell) and Intel Core i5 3330 (Ivy Bridge).
  2. Use MKL 2019.0.1, build 20180928.
  3. The app use PARDISO with the following settings: MKL_INT _mtype = 11; MKL_INT _nrhs = 1; MKL_INT _iparm1 = 2; MKL_INT _iparm3 = 0; MKL_INT _iparm4 = 2; MKL_INT _iparm7 = -1; MKL_INT _iparm9 = 13; MKL_INT _iparm10 = 1; MKL_INT _iparm12 = 1; MKL_INT _iparm20 = 2; MKL_INT _iparm23 = 0; MKL_INT _iparm33 = 1; MKL_INT _iparm34 = 1; mkl_domain_set_num_threads(1, MKL_DOMAIN_PARDISO);
  4. Call the mkl_cbwr_set(MKL_CBWR_SSE2) and next PARDISO.
  5. The native library was build using Microsoft Visual Studio 2017 (v141)
  6. The mkl_intel_lp64.lib, mkl_intel_thread.lib, mkl_core.lib used as additional dependencies.
  7. The app runs on both PC.
  8. The calculation result is different. See attached files.

Please suggest a solution to my problem.

 

0 Kudos
13 Replies
Gennady_F_Intel
Moderator
781 Views

is that in-core mode?

0 Kudos
seredzhinov__renat
781 Views

yes, in-core mode. _iparm[59] = 0.

0 Kudos
Gennady_F_Intel
Moderator
781 Views

ok, then please take a look at the iparm(34), set the same #of threads for both cases and check if that will help to see the same output.

0 Kudos
seredzhinov__renat
781 Views

Do you mean iparm(33)? - optimal number of OpenMP threads for conditional numerical reproducibility (CNR) mode. Now _iparm33 = 1 for both cases.

0 Kudos
seredzhinov__renat
781 Views

Gennady,

I prepared the initial data files and the source files. JMatrix.csv is Jacobian, PowerUnbalance.csv is rhs vector. The software implementation you will find in PardisoProvider.cpp. You have to use

int Initialization(int n, int nrhs, Monitel::MathNative::Pardiso::Block2x2 * a, int * ja, int * ia, float *executionTime);

int Factorization(int n, Monitel::MathNative::Pardiso::Block2x2 * a, int * ja, int * ia, float *converterTime, float *factorizationTime, int PivotingPerturbation = 13);

and

int Solve(double * rhs, double * solution, float *executionTime);

in order to reproduce bug.

0 Kudos
seredzhinov__renat
781 Views

I suppose we solved the problem. We added to

case DLL_PROCESS_ATTACH:

the next code:

#if defined (_WIN64)
        _set_FMA3_enable(0);
#endif

See also

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-fma3-enable-set-fma3-enable?view=vs-2017.

 

0 Kudos
Gennady_F_Intel
Moderator
781 Views

Renat, how could we build the sources you shared into post#6? 

0 Kudos
seredzhinov__renat
781 Views

We use Microsoft Visual Studio 2017 (v.15.9.2). The platform toolset is v141. You have to add links to addational files in \include and \lib folders in order to use PardisoProvider::ConvertMatrix method. We use MKL static libraries (mkl_intel_lp64.lib
mkl_intel_thread.lib
mkl_core.lib), but you could use "Use Intel MKL" property for using MKL in the app. I have attached PerfCounter.h and PerfCounter.cpp also. It's necessary for PardisoProvider.cpp.

0 Kudos
seredzhinov__renat
781 Views

Gennady,

did you manage to build a project?

0 Kudos
Gennady_F_Intel
Moderator
781 Views

I couldn't build these project. There is not main function into sources you sent. Is that possible to simplify the case? reading from scv file into CSR format and calling pardiso...

0 Kudos
seredzhinov__renat
781 Views

Ок, I'll prepare it.

0 Kudos
seredzhinov__renat
781 Views

Gennady,


I have attached a simple project to reproduce the bug. It contains all necessary files. Please, run an executable file on Haswell and Ivy Bridge. The result will be in "result.csv".

0 Kudos
Gennady_F_Intel
Moderator
781 Views
thanks, we will try this
0 Kudos
Reply