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 ?
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.
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.