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

is MKL compatible with windows g++

zhouxingchi
Beginner
2,230 Views

Hi,

I see some threads saying that they have no luck in getting MKL 10 linked to g++ under windows? Is MKL built to behave like this, i.e., not compatible with g++ under windows, or is that we have not find the right way to link the libraries?

I am trying to run the sample code in dev c++ 4.9.9.2

#include
#include "mkl.h"
//typedef struct{ double re; double im; } complex16;
//extern "C" void zdotc (complex16*, int *, complex16 *, int *, complex16*, int *);
#define N 5
int main()
{
int n, inca = 1, incb = 1, i;
MKL_Complex16 a, b, c;
n = N;
for( i = 0; i < n; i++ ){
a.real = (double)i; a.imag = (double)i * 2.0;
b.real = (double)(n - i); b.imag = (double)i * 2.0;
}
zdotc(&c, &n, a, &inca, b, &incb );
printf( "The complex dot product is: ( %6.2f, %6.2f) ", c.real, c.imag);
}

I have tried to link

-llibguide
-lmkl_c

But I get the following error

.drectve `-defaultlib:mkl_intel_c ' unrecognized

.drectve `-defaultlib:mkl_intel_thread ' unrecognized

.drectve `-defaultlib:mkl_core ' unrecognized

[Linker error] undefined reference to `zdotc'


Is that I need to include extra lib or that MKL just cant compile with windows g++?


0 Kudos
5 Replies
Andrey_G_Intel2
Employee
2,230 Views

Looks like GNU linker under windows doesn`t sopport -defaultlib directive. Try to link mkl_intel_c.lib; mkl_intel_thread.lib; mkl_core.lib manualy instead mkl_c.lib.

Andrey

0 Kudos
zhouxingchi
Beginner
2,230 Views

Hi

thanks for the reply, i have tried to include the following

-llibguide
-lmkl_c
-lmkl_intel_c
-lmkl_intel_thread
-lmkl_core

But I still get the following errors

.drectve `-defaultlib:mkl_intel_c ' unrecognized

.drectve `-defaultlib:mkl_intel_thread ' unrecognized

.drectve `-defaultlib:mkl_core ' unrecognized

[Linker error] undefined reference to `mkl_serv_cpu_detect'

0 Kudos
zhouxingchi
Beginner
2,230 Views

Hi

please also see the errors after using g++ in MS DOS mode

D:Financial ResearchCDO2CDO2 ModelsTest of MKL>g++ main.cpp -llibguide -lmkl_c -lmkl_intel_c -lmkl_intel_thread -lmkl_core -lm -Llib
Warning: .drectve `-defaultlib:mkl_intel_c ' unrecognized
Warning: .drectve `-defaultlib:mkl_intel_thread ' unrecognized
Warning: .drectve `-defaultlib:mkl_core ' unrecognized
C:/Program Files/Intel/MKL/10.0.2.019/ia32/libmkl_core.lib(_zdotc_fb.obj)(.text
[_mkl_blas_zdotc]+0x2e):_zdotc_iface_dyn.c: undefined reference to `mkl_serv_cpu
_detect'
collect2: ld returned 1 exit status

0 Kudos
Andrey_G_Intel2
Employee
2,230 Views

You forgot to remove mkl_c.lib from linkage line.

Andrey

0 Kudos
zhouxingchi
Beginner
2,230 Views
Ok, I have contacted the Intel Technical support, basically they do not want to test windows g++ with MKL. So I think the best solution is switch VC++9, which now has a free version, and the compiled code runs faster than g++.
0 Kudos
Reply