Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sangamesh_B_
Beginner
44 Views

-lpthread in sequential mkl?

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
44 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 

Ying_H_Intel
Employee
44 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