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

Using MKL with MKL_NUM_THREADS=1

DmitrySkachkov
初学者
2,212 次查看

Hello,

 

I am trying to use MKL to calculate on one core only, but within the cycle working in OpenMP parallel regime.

Program A


!OMP PARALLEL DO
 do k=1,N2
  ...
  call getrf(A,ipiv)         ! MKL subroutine to work on one core 
  call getrs(A,ipiv,B)       ! MKL subroutine to work on one core
  ...
 enddo
!OMP END PARALLEL DO

 In job submission script I set 

export OMP_NUM_THREADS=2

export MKL_NUM_THREADS=1

However this gives an error in MKL subroutines!

When I submit the job on one core only (OMP_NUM_THREADS=1) the MKL subroutines work correctly.

How to ask MKL library to calculate on one core correctly when the program runs in OpenMP parallel regime? 

 

0 项奖励
1 解答
Ruqiu_C_Intel
主持人
2,184 次查看

For using oneMKL + OpenMP threading, we recommend you use intel OpenMP -liomp5 link option. For example,

 ${MKLROOT}/lib/libmkl_blas95_ilp64.a ${MKLROOT}/lib/libmkl_lapack95_ilp64.a -Wl,--start-group ${MKLROOT}/lib/libmkl_intel_ilp64.a ${MKLROOT}/lib/libmkl_intel_thread.a ${MKLROOT}/lib/libmkl_core.a -Wl,--end-group -liomp5 -lpthread -lm -ldl

More advisor, please check onemkl-link-line-advisor 

在原帖中查看解决方案

0 项奖励
2 回复数
Ruqiu_C_Intel
主持人
2,185 次查看

For using oneMKL + OpenMP threading, we recommend you use intel OpenMP -liomp5 link option. For example,

 ${MKLROOT}/lib/libmkl_blas95_ilp64.a ${MKLROOT}/lib/libmkl_lapack95_ilp64.a -Wl,--start-group ${MKLROOT}/lib/libmkl_intel_ilp64.a ${MKLROOT}/lib/libmkl_intel_thread.a ${MKLROOT}/lib/libmkl_core.a -Wl,--end-group -liomp5 -lpthread -lm -ldl

More advisor, please check onemkl-link-line-advisor 

0 项奖励
DmitrySkachkov
初学者
2,159 次查看

Thank you!

With this options MKL works as necessary, in OpenMP regime MKL subroutine runs on one core without errors.

0 项奖励
回复