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

<Parallel vs Sequencial> issues on Visual Studio 2017

Almeida__Caetano
Beginner
849 Views

Hello,

This is my first post here.

I'm using MKL for matrices multiplication in my current project.

Sometimes - just in RELEASE mode and with no pattern neither a way to reproduce the bug - my application either crashes or returns me crazy numbers (totally out of expected, according my unit tests). Again, It's sort of random, but I'm suspicious about the MKL parallelism.

And here is the strangeness - Intel Performance Libraries Properties is set this way (look the attachments):

  • Debug - Use Intel MKL - Parallel
  • Release - Use Intel MKL - Sequential

It's never crashed in Debug mode.

As an investigative act, I forced it in runtime to be sequential by calling 

mkl_set_num_threads(1);

every time my MKL routines need to be used, for both DEBUG and RELEASE.

Results?

It has not crashed anymore, neither has given me crazy numbers as output.

It's much slower, though, obviously. I was suspicious the flag above <Release - Use Intel MKL - Sequential> was not working in fact, because it should not behave differently.

Have you ever faced this kind of situation or I made something wrong right here?

I want to be back to the multi-thread mode, but I don't feel comfortable with these random errors.

Thank you very much.

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
849 Views

actually MKL had the problem with  integration to VS 2017 but all of these problems were resolved in version 2019. In the case if you have suspicious the flag parallel doesn't work, you may explicitly link all needed mkl's libraries ( check with MKL Linker Adviser)  or build your case from command line.

Regard to "crazy numbers" returned by gemm as  I guess - could you give us the reproducer? 

Are you aware that you call mk from within multi-threaded environment like openmp region? in that case, our recommendation is to use 1 thread will answers to this question. You may check MKL User's guide -- how to call MKL functions from multi-threaded applications

 

View solution in original post

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
850 Views

actually MKL had the problem with  integration to VS 2017 but all of these problems were resolved in version 2019. In the case if you have suspicious the flag parallel doesn't work, you may explicitly link all needed mkl's libraries ( check with MKL Linker Adviser)  or build your case from command line.

Regard to "crazy numbers" returned by gemm as  I guess - could you give us the reproducer? 

Are you aware that you call mk from within multi-threaded environment like openmp region? in that case, our recommendation is to use 1 thread will answers to this question. You may check MKL User's guide -- how to call MKL functions from multi-threaded applications

 

0 Kudos
Reply