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

found answer and a bug maybe

joan_puig
Beginner
279 Views
I think this is an mkl bug:

I don't set OMP_NUM_THREADS
My code uses the omp_set_num_threads()
It seems though that unless OMP_NUM_THREADS is set to something at the beggining of the program it won't honor any future calls to omp_set_num_threads()
Now, if I take out the call to the MKL function, the plain openmp for loop will actually be parallelized well.

[jpuig@altix jpuig]$ export -n OMP_NUM_THREADS
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.8064 - 1 threads loop ratio:1
Elapsed time: 1.79981 - 2 threads loop ratio:0.996353
Elapsed time: 1.85461 - 3 threads loop ratio:1.02669
Elapsed time: 1.82016 - 4 threads loop ratio:1.00762
[jpuig@altix jpuig]$ export OMP_NUM_THREADS=4
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.84285 - 1 threads loop ratio:1
Elapsed time: 0.929641 - 2 threads loop ratio:0.504457
Elapsed time: 0.62401 - 3 threads loop ratio:0.338611
Elapsed time: 0.476085 - 4 threads loop ratio:0.258341
[jpuig@altix jpuig]$
0 Kudos
0 Replies
Reply