Community
cancel
Showing results for 
Search instead for 
Did you mean: 
kangshiyin
Beginner
115 Views

A bug? Undefined reference to 'matmul_mkl_' when -O3 -parallel used in Eclipse CDT

The following code 'test.cpp' can not be built in eclipse when I add '-O3 -parallel' into build options.
[bash]$ icpc -O3 -parallel -c test.cpp $ icpc -parallel test.o test.o: In function `main': test.cpp:(.text+0x27b): undefined reference to `matmul_mkl_' [/bash]
But it works with the following cmdline:
[bash]$ icpc -O3 -parallel test.cpp [/bash]
And this works too.
[bash]$ icpc -O3 -parallel -c test.cpp $ icpc -O3 -parallel test.o [/bash] I think it's a bug of icc eclipse plugin. Why should it indicate '-O3' when linking, while eclipse plugin doesn't ?

[bash]$ icpc -v icpc version 12.1.3 (gcc version 4.1.2 compatibility) [/bash]



[cpp]#include using namespace std; int main(){ const int n = 500; double(*a) = (double(*))new double[n*n]; double(*b) = (double(*))new double[n*n]; double(*c) = (double(*))new double[n*n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++){ a = (double) rand() / RAND_MAX; b = (double) rand() / RAND_MAX; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++){ c = 0; for (int k = 0; k < n; k++) c += a * b; } double d1 = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d1 += c*c; cout << d1 << endl; return 0; } [/cpp]






0 Kudos
3 Replies
Miwako_T_Intel
Employee
115 Views

Hi. Thank you very much for a report. We will fix it.
For now, would you please work around by adding "-O3" to linker->miscellaneous->Additional Options?
Miwako
Miwako_T_Intel
Employee
115 Views

Hi.
The fix will be in the next 12.1 update (Update 11 that will come out next month). Thanks.
Miwako
TimP
Black Belt
115 Views

-O3 -parallel adds (by default) -opt-matmul, requiring linkage against MKL (-mkl for the defaults). This ought to be advantageous, if your matrix is at least 20x20 (otherwise, why are you trying to parallelize?). Maybe the bug fix will be to add -mkl implicitly.
Reply