- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider some very simple c program, vec_example.c:
"
#include
#include
#define N 16
double in = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
11.0, 12.0, 13.0, 14.0, 15.0, 16.0 };
double out;
int main ()
{
int i;
for (i = 0; i < N; i++)
out = exp (in);
for (i = 0; i < N; i++)
printf ("%f\\n", out);
return 0;
}
"
Now, suppose we want to compile using gcc (4.5.0 from MinGW on Windows XP) and use Intel MKL for SSE instructions of the "exp":
"
gcc -c vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
"
That works. Problems come with linking:
gcc vec_example.o -o vec_example "-LC:\\Program Files\\Intel\\Composer XE 2011 SP1\\mkl\\lib"
or with
gcc vec_example.o -o vec_example "-LC:\\Program Files\\Intel\\Composer XE 2011 SP1\\mkl\\lib\\ia32"
(The latter directory has the mkl_*.lib and mkl_*_dll.lib files)
Both give the same error message:
"
vec_example.o:vec_example.c:(.text+0x1d): undefined reference to `vmldExp2'
collect2: ld returned 1 exit status
"
How should I fix this?
"
#include
#include
#define N 16
double in
11.0, 12.0, 13.0, 14.0, 15.0, 16.0 };
double out
int main ()
{
int i;
for (i = 0; i < N; i++)
out = exp (in);
for (i = 0; i < N; i++)
printf ("%f\\n", out);
return 0;
}
"
Now, suppose we want to compile using gcc (4.5.0 from MinGW on Windows XP) and use Intel MKL for SSE instructions of the "exp":
"
gcc -c vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
"
That works. Problems come with linking:
gcc vec_example.o -o vec_example "-LC:\\Program Files\\Intel\\Composer XE 2011 SP1\\mkl\\lib"
or with
gcc vec_example.o -o vec_example "-LC:\\Program Files\\Intel\\Composer XE 2011 SP1\\mkl\\lib\\ia32"
(The latter directory has the mkl_*.lib and mkl_*_dll.lib files)
Both give the same error message:
"
vec_example.o:vec_example.c:(.text+0x1d): undefined reference to `vmldExp2'
collect2: ld returned 1 exit status
"
How should I fix this?
Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Short Vector Math Library" (SVML)is a part ofthe Intel compiler
but not MKL.So, please try additionally link with svml_disp*.lib (e.g. svml_dispmt.lib) where symbol `vmldExp2' is defined.
The Intel compiler has intrinsic names for the SVML functions in the header file ia32intrin.h
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. So I added svml_dispmt.lib to this directory "C:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32" and then linked using this line:
gcc vec_example.o -o vec_example "-LC:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32" "-IC:\Program Files\Intel\Composer XE 2011 SP1\mkl\include" -lsvml_dispmt
However, that gave many error messages like this one:
"
C:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32/svml_dispmt.lib(D:/users/nbtester/x86win_nightly/branch-12_1/20110812_000000/dev/build_objs/qax86win
_d0p0flexlm/libobj/svml/staticmt/svml_dsincos2_la_maskiface.obj):(.text[___svml_sincos2_mask]+0x21): undefined reference to `__intel_cpu_indicator_init'
"
Any clue?
gcc vec_example.o -o vec_example "-LC:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32" "-IC:\Program Files\Intel\Composer XE 2011 SP1\mkl\include" -lsvml_dispmt
However, that gave many error messages like this one:
"
C:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32/svml_dispmt.lib(D:/users/nbtester/x86win_nightly/branch-12_1/20110812_000000/dev/build_objs/qax86win
_d0p0flexlm/libobj/svml/staticmt/svml_dsincos2_la_maskiface.obj):(.text[___svml_sincos2_mask]+0x21): undefined reference to `__intel_cpu_indicator_init'
"
Any clue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I don`t see any calls to MKL in your source. So, you should be able to build executable by run followinc command:
gccvec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
Is it true?
I don`t see any calls to MKL in your source. So, you should be able to build executable by run followinc command:
gccvec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
Is it true?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have doubts as to whether this gcc svml option was ever implemented in MinGW. The Windows ICL libraries weren't set up with any requirement for gcc compatibility.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I was thinking that the "-mveclibabi=svml" at compilation would translate the "exp" from math.h to
a vectorized call to the Intel mkl sse instruction set, after proper linking.
So I was thinking that no explicit calls to mkl were needed in the code.
Is that not so?
Anyway,
gcc vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
gives
"
C:\DOCUME~1\H44B3~1.SPR\LOCALS~1\Temp\cc65Yp4X.o:vec_example.c:(.text+0x1d): undefined reference to `vmldExp2'
collect2: ld returned 1 exit status
"
a vectorized call to the Intel mkl sse instruction set, after proper linking.
So I was thinking that no explicit calls to mkl were needed in the code.
Is that not so?
Anyway,
gcc vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
gives
"
C:\DOCUME~1\H44B3~1.SPR\LOCALS~1\Temp\cc65Yp4X.o:vec_example.c:(.text+0x1d): undefined reference to `vmldExp2'
collect2: ld returned 1 exit status
"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I should have added that I also got multiple times this warning:
"
Warning: .drectve `-defaultlib:"libirc" ' unrecognized
"
"
Warning: .drectve `-defaultlib:"libirc" ' unrecognized
"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>> So I added svml_dispmt.lib to this directory "C:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32"
You need to add the following path"C:\Program Files\Intel\Composer XE 2011 SP1\compiler\lib\ia32\" where you can find all svml libs.
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting L. Ploeger
Sorry, I was thinking that the "-mveclibabi=svml" at compilation would translate the "exp" from math.h to
a vectorized call to the Intel mkl sse instruction set, after proper linking.
So I was thinking that no explicit calls to mkl were needed in the code.
Is that not so?
"
a vectorized call to the Intel mkl sse instruction set, after proper linking.
So I was thinking that no explicit calls to mkl were needed in the code.
Is that not so?
"
No, that GCC option tells GCC to use svml library in vectorizer.
If you want to use exp from MKL, you need to call it manually. You need to read "Vector Mathematical Functions" chapter from Intel Math Kernel Library Reference Manual (http://software.intel.com/sites/products/documentation/hpc/mkl/updates/10.3.5/mklman/index.htm).
Andrey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't understand what you mean, I linked to that directory:
"-LC:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32"
"-LC:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\ia32"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, but would that make any difference with respect to speed, direct linking to mkl or using the vml library as a vectorizer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have the Intel compiler installed, it's difficult to see why you are attempting to link against the Intel libraries in MinGW.
My expectation would be that SVML would give you good vector speedup on shorter loops, beginning around a loop count of 50, while VML should be faster on longer loops, perhaps upwards of 1000, until you reach a length where the memory system limits performance, and then the SVML may be faster again if your exp is embedded in a loop with other calculations, taking advantage of cache locality. So, if you really want to know, or don't want to divulge sufficient data, you'll need to test it yourself.
My expectation would be that SVML would give you good vector speedup on shorter loops, beginning around a loop count of 50, while VML should be faster on longer loops, perhaps upwards of 1000, until you reach a length where the memory system limits performance, and then the SVML may be faster again if your exp is embedded in a loop with other calculations, taking advantage of cache locality. So, if you really want to know, or don't want to divulge sufficient data, you'll need to test it yourself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works now. libirc.lib should be linked against, too.
So, to summarize:
gcc -c vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
gcc vec_example.o "-LC:\Program Files\Intel\Composer XE\compiler\lib\ia32" -lsvml_dispmt -llibirc
---> a.exe
Warning: .drectve `-defaultlib:"libirc" ' unrecognized
remains.
So, to summarize:
gcc -c vec_example.c -O2 -msse2 -ffast-math -ftree-vectorize -mveclibabi=svml
gcc vec_example.o "-LC:\Program Files\Intel\Composer XE\compiler\lib\ia32" -lsvml_dispmt -llibirc
---> a.exe
Warning: .drectve `-defaultlib:"libirc" ' unrecognized
remains.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page