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

-lpthread in sequential mkl?

Sangamesh_B_
Beginner
676 Views

The link line provided by MKL link line advisor(https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor) for linking static sequential libraries is:

-Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -lm  

and  -I$(MKLROOT)/include

My question is, why -lpthread library required to link a sequential library?

0 Kudos
2 Replies
Ying_H_Intel
Employee
676 Views

Hi San, 

Thank you for the post. Right, it seem the -lpthread are not needed by sequential linkage.  I will check it with internal owner and fix the problem if possible. 

Thanks
Ying 

0 Kudos
Ying_H_Intel
Employee
676 Views

Hi San, 

I get feedback from our team,  as quite often users who use sequential linking of MKL exploit own threading in their applications. To be thread safe in that case MKL has to use TLS functionality of lpthread. Thus we require lphtread even for sequential linking. So it seems better to keep it there. and user can remove manually if it is not needed. 

Best Regards,

Ying

 

0 Kudos
Reply