Compiling with g++

Compiling with g++

How can I compile my program with mkl and g++?

I already tried the mkl line advisor, but I got the "pthread_mutex_trylock" message.

How`s it going ?

Thanks.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

What is your linkline?

For intel64, lp64 interface, it is something like this.

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

Have you threaded your program with pthreads?

--Vipin

 

No, I don't thread with pthreads.

The point is, somewhere in your build you are calling a pthread function, e.g. by using OpenMP in your own code or by linking an mkl_thread library.  You will need either to remove the pthread function usage or link properly to support it.

Best Reply

Hi Jack,

Are you working on Ubuntu system?

It looks similiar problem as  http://software.intel.com/en-us/forums/topic/501970#comment-1779725 and the one in http://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-intel-mkl-with-gcc-on-ubuntu.  Some ubuntu and GCC have the issue, some have not.

You may try to add the compiler option : -Wl,--no-as-needed.   for example

g++ -Wall -o test.exe test.cpp -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -ldl -lpthread -lm

Best Regards,

Ying

It works. Thank you everybody.

Leave a Comment

Please sign in to add a comment. Not a member? Join today