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

how to tell mkl the underlying microarchitecture

Chaowen_G_
Beginner
306 Views

Hi:

    I read the gcc document as well as intel compiler document, they both said that the default behavior will not detect the underlying microarchitecture in linux x86-64 (default is -xsse2). As a result, I need to put -march=nehalem in CXXFLAGS in g++ and put -xsse4.2 in CXXFLAGS in icpc. However, while linking with mkl, there is no flag to tell mkl that my microarchitecture is nehalem:

g++:

g++ -std=c++11 -O2 -march=nehalem -c main.cpp

g++ main.o -lmkl_rt

icpc:

icpc -std=c++11 -xsse4.2 -c main.cpp

icpc -mkl main.o

So, how to guarantee mkl can take full advantage of nehalem and get the highest performance?

Thank you very much

Chaowen GUO

0 Kudos
1 Reply
Zhang_Z_Intel
Employee
306 Views

You don't need it. MKL has a built-in dispatcher that detects the microarchitecture at run time and dispatch the execution to the appropriate code path. The compiler flags don't affect MKL code path in any way. These flags only affect the user code to be compiled, not the libraries to be linked.

0 Kudos
Reply