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

No performance boost with mkl on Pentium 4 ! Why ?

misko_st
Beginner
480 Views
Hello,

I am compiling very simple program for my school like this:
gfortran ddot.f ddot_long.g -o ddot_long.exe

and this is working fine.

ddot.f can be downloaded from:
http://lavica.fesb.hr/VPR/vektorske_operacije/ddot.f
ddot_long.g can be downloaded from:
http://lavica.fesb.hr/VPR/vektorske_operacije/ddot_1.f

with this compiling I get
Mflops = 113.62863

If I use:
gfortran -O3 ddot.f ddot_long.g -o ddot_long_03.exe
-O3 is maximum at my machine
then I get Mflops = 124.99220

Which is normal because I use optimizations (-O3).

But when I use mkl for optimization i do not get any performance.
Why is that so ?
I compile it like this:
gfortran -L/opt/intel/mkl/10.2.6.038/lib/32/ -lmkl_core ddot.f ddot_long.f -o ddot_long_mkl.exe

When I compile it like this I get Mflops = 113.62990, just like with no optimization.
Why is that so ?
Is it possible because I have old computer and I downloaded the newest mkl that mkl are not optimized anymore for my old processor (Pentimum 4 at 2.6Ghz).
Or am I just compiling it wrong ?

I am working on debian-linux on P4 at 2.6 GHz

thanks
0 Kudos
5 Replies
mecej4
Honored Contributor III
480 Views
You are mistaken in assuming that the last compilation actually uses MKL. Since you included ddot.f in the command line, the linker would have no unsatisfied external routines that it would need to search for in the MKL libraries. If you asked a map file to be produced by the linker, you would see in it that no MKL routines were included in your executable. Alternatively, you can use nm on the executable and try to see if any MKL symbols are included.

Leave out ddot.f from the command line and try again.
0 Kudos
TimP
Honored Contributor III
480 Views
As mecej4 said, the presence of a ddot.o object in your build will prevent loading of ddot.o from MKL library, regardless of whether your ddot.f has the same or different function than the usual BLAS function. I don't think we can guess what your .g file is, or what use gfortran or ifort could make of it.
If you have vectorized ddot by your own compilation, the gain you may get from MKL ddot may be limited.
0 Kudos
misko_st
Beginner
480 Views
I understand what you have said.

but when I try:
gfortran ddot_long.f -L/opt/intel/mkl/10.2.6.038/lib/32/ -lmkl_core -o ddot_long_mkl.exe

I get:
/tmp/ccTxEZ73.o: In function `MAIN__':
ddot_long.f:(.text+0xb6): undefined reference to `ddot_'
collect2: ld returned 1 exit status


It look like that ddot can not be found in MKL.
Is my conclusion correct ?

ddot_long.f can be downloded from:
http://lavica.fesb.hr/VPR/vektorske_operacije/ddot_long.f

So can you please explain me how to compile ddot_long.f with mkl.

Thanks
0 Kudos
mecej4
Honored Contributor III
480 Views
The MKL library comprises many pieces, and linking it properly from Intel Fortran, and more so from another Fortran compiler, is not trivial.

However, if you use the link line advisor , things work fine. For example, using the 32-bit compiler and libraries, link using

[bash]gfortran -m32 ddot_long.o -L$MKLPATH $MKLPATH/libmkl_solver_sequential.a -Wl,--start-group -lmkl_gf -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread[/bash]

0 Kudos
misko_st
Beginner
480 Views
Thnak you mecej4, it is working for me.
0 Kudos
Reply