-funsafe-math-optimizations effect on linking mkl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everybody,

My name is Nicola Giuliani and I am a researcher in numerical analysis. I
have encountered a strange behavior when compiling a very simple piece of
code using g++. In this piece of code I link the InterlOneAPI MKL PARDISO
solver and ask it to solve a linear system. I don't do any mathematical
operation, I simply call the MKL libraries that I have dynamically linked.

This is the original compilation line I use

g++ kernel_only_pardiso.cpp -m64 -L${MKLROOT}/lib -Wl,--no-as-needed
-lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
-I"${MKLROOT}/include" -o gnu_gnu.out

I also try the intel compiler

icpx kernel_only_pardiso.cpp -m64 -L${MKLROOT}/lib -Wl,--no-as-needed
-lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
-I"${MKLROOT}/include" -o intel_gnu.out

Even if the two line link the same version of the MKL library the intel
compiled version is between 2 and 5 time faster w.r.t. the gcc compiled
one.

I recover the same timing if I use -Ofast as optimization flag with g++
(-O2, -O3 do not change the timing). Digging even further I isolated
-funsafe-math-optimizations  as the compiler flag that makes the
difference. On gcc man page I have found "When used at link time, it may
include libraries or startup files that change the default FPU control word
or other similar optimizations.", I am guessing that this is the reason why
the compilation flag is so effective.

What do you think of this particular problem? Does it make any sense to
you? Can you tell me how to recover the same behavior at linking time
without turning on the unsafe math optimizations? If you believe it to be
useful the example file can be downloaded from here

 here
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/PARDISO-performance-fluctuation-on-INTEL-processor/m-p/1693601/emcs_t/S2h8ZW1haWx8bWVudGlvbl9zdWJzY3JpcHRpb258TUJCNzJMQ0ZJRUFWQ0J8MTY5MzYwMXxBVF9NRU5USU9OU3xoSw

Thanking you in advance,
Best regards,
Nicola Giuliani



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux