- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am a beginner of MKL. I installed Intel C++ Compiler 11.1.064 on my Debian testing, and GCC 4.4.2. I tried to compile a very simple code to test MKL:
test_ddot.c:
#include "mkl.h"
#include
#include
#define N 3
int main()
{
double vec1= {1.0, 2.0, 3.0};
double vec2= {4.1, 5.1, 6.1};
int N_vec = N, inca = 1, incb = 1;
double result;
result = ddot(&N_vec, vec1, &inca, vec2, &incb);
printf("Vector product in double precision is %f\\n",result);
return 0;
}
While at compile time GCC shows the following linking error:
$ gcc -o test_ddot test_ddot.c -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -lpthread
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `sin'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `cos'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_core.so: undefined reference to `sqrt'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `log'
But if I replaced gcc with icc, then everything is good.
Any suggestions? Thanks a lot!
P.S. I installed libstdc++.so.5 seperately for icc, because Debian testing now only provides libstdc++.so.6.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
seems to be a error typical of not finding the math module, does explicitly specifying "-lm" do no good?
Cheers,
C.S.N
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes! It works.Thanks for help.
Because I did not use any standard math functions, so I didn't expect to link with math library. And Intel link advisor does not suggest -lm either. While it seems MKL does need math lib.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page