<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic static linking of MKL has the in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945428#M14824</link>
    <description>&lt;P&gt;static linking of MKL has the additional problem of circular dependencies which has to be resolved by --start-group ..... &amp;nbsp; --end-group linker directives, and full path names of the libraries,&amp;nbsp;as shown in the MKL link advisor &amp;nbsp;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/P&gt;

&lt;P&gt;-mkl=sequential is a good idea for initial testing, but I think it may&amp;nbsp;not work with -static.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Dec 2013 15:12:00 GMT</pubDate>
    <dc:creator>TimP</dc:creator>
    <dc:date>2013-12-25T15:12:00Z</dc:date>
    <item>
      <title>Problems with Static Linking with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945426#M14822</link>
      <description>Hello,
We need your assistance with using the MKL library.
We are using the following configuration:
OS – Ubuntu 12.04 LTS 32 bit.
SDK – Eclipse 3.7.2.
Compiler - Intel IA-32 C++ Compiler (v13.0.0), using composer_xe_2013.1.117.
We are trying to run the following code:
int main()
{
double a[100], yr[100], yi[100[ ;
int n = 100;
vdSinCos(n,a,yi,yr);
double p1r[10], p2r[20], resultrr[30];
int n1 = 10, n2 = 20, start = 0, stride = 1;
vSLConvTaskPtr m_task;
vsldConvNewTask1D(&amp;amp;m_task, VSL_CONV_MODE_AUTO, n1, n2, n1);
vslConvSetStart(m_task, &amp;amp;start);
vsldConvExec(m_task, &amp;amp;p1r[0], &amp;amp;stride, &amp;amp;p2r[0], &amp;amp;stride, &amp;amp;resultrr[0], &amp;amp;stride);
vslConvDeleteTask(&amp;amp;m_task);
}
When we define dynamic linking to the MKL library the compilation and linking phase are completed with success
and we can run the program.
Our problem starts when we are trying to link the MKL statically.
From our knowledge, when using the –mkl flag the static linking should work without and further requirement of
us to specify any additional libraries of the MKL that should be linked since using the –mkl flag should enable all
the library functionality. But still, we are getting the following errors during the linking phase:
Building target: TestMath
Invoking: Intel IA-32 C++ Linker
icpc -static -L/opt/intel/composer_xe_2013.1.117/mkl/lib/ia32 -mkl=sequential -o "TestMath" ./src/TestMath.o
/. src/TestMath.o: In function `main ' :
/ home/user/workspace/TestMath/Debug/../src/TestMath.cpp:17: undefined reference to `vdSinCos '
/ home/user/workspace/TestMath/Debug/../src/TestMath.cpp:23: undefined reference to `vsldConvNewTask1D '
/ home/user/workspace/TestMath/Debug/../src/TestMath.cpp:24: undefined reference to `vslConvSetStart '
/ home/user/workspace/TestMath/Debug/../src/TestMath.cpp:25: undefined reference to `vsldConvExec '
/ home/user/workspace/TestMath/Debug/../src/TestMath.cpp:26: undefined reference to `vslConvDeleteTask '
We have tried to manually link specific libraries in order to overcome this linking issue and only after we have
specifically linked the mkl_intel, mkl_core and mkl_sequential libraries the project linking phase completes
without any error, with the exception of the vsIdConvExec function, so we have commented.
make -k all
Building file: ../src/TestMath.cpp
Invoking: Intel IA-32 C++ Compiler
icpc -g -mkl=sequential -I/opt/intel/composer_xe_2013.1.117/mkl/include -MMD -MP -MF"src/TestMath.d" -
MT"src/TestMath.d" -c -o "src/TestMath.o" "../src/TestMath.cpp"
Finished building: ../src/TestMath.cpp
Building target: TestMath
Invoking: Intel IA-32 C++ Linker
icpc  -static  -L/opt/intel/composer_xe_2013.1.117/mkl/lib/ia32  -mkl=sequential  -o  "TestMath"
./src/TestMath.o -lmkl_intel -lmkl_core -lmkl_sequential
Finished building target: TestMath
When we have tryied to uncomment the call to the vsIdConvExec function we got enormous number of
undefined reference errors.
Even when we`ve tried to statically link all the .a libraries in the ia32 folder we still got the undefined reference
erros.
Please advise how to configure correctly our static linking (shouldn’t –mkl be enough?) since dynamic linking is
not possible in order environment.
Thanks.</description>
      <pubDate>Wed, 25 Dec 2013 11:31:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945426#M14822</guid>
      <dc:creator>zeev_B_</dc:creator>
      <dc:date>2013-12-25T11:31:28Z</dc:date>
    </item>
    <item>
      <title>When you use static linking,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945427#M14823</link>
      <description>&lt;P&gt;When you use static linking, and you list one or more .o objects &lt;EM&gt;after &lt;/EM&gt;one or more static libraries that contain symbols needed by the object(s), the linking will fail. See, for example, the explanation in&amp;nbsp;&lt;A href="http://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking/"&gt;http://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking/&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The solution is quite simple: list the names of the .o files to be linked &lt;EM&gt;before&lt;/EM&gt; the list of libraries in the command that invokes the linker ld. In your makefile, you should have something similar to:&lt;/P&gt;

&lt;P&gt;[bash]&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;icpc&amp;nbsp;-static&amp;nbsp;./src/TestMath.o&amp;nbsp;-L/opt/intel/composer_xe_2013.1.117/mkl/lib/ia32 -mkl=sequential -o "TestMath"&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;[/bash]&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2013 12:17:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945427#M14823</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2013-12-25T12:17:16Z</dc:date>
    </item>
    <item>
      <title>static linking of MKL has the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945428#M14824</link>
      <description>&lt;P&gt;static linking of MKL has the additional problem of circular dependencies which has to be resolved by --start-group ..... &amp;nbsp; --end-group linker directives, and full path names of the libraries,&amp;nbsp;as shown in the MKL link advisor &amp;nbsp;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/P&gt;

&lt;P&gt;-mkl=sequential is a good idea for initial testing, but I think it may&amp;nbsp;not work with -static.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2013 15:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945428#M14824</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-12-25T15:12:00Z</dc:date>
    </item>
    <item>
      <title>Hello, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945429#M14825</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;As mecej4 and Tim pointed out, &amp;nbsp;one key is &amp;nbsp;the order of linked library,&amp;nbsp;&amp;nbsp;another key is the -mkl and -static combination. &amp;nbsp;Here is one KB talking about the problem: &amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/articles/link-error-when-static-linking-to-intel-mkl-on-linux-6" target="_blank"&gt;http://software.intel.com/en-us/articles/link-error-when-static-linking-to-intel-mkl-on-linux-6&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So the recommend static link line is&amp;nbsp;&lt;/P&gt;

&lt;P&gt;icpc -intel-static ./src/TestMath.o -L/opt/intel/composer_xe_2013.1.117/mkl/lib/ia32 -mkl=sequential -o TestMath&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2013 01:05:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945429#M14825</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2013-12-26T01:05:01Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945430#M14826</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;this simple Fortran90&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/scisoft/autocmake/blob/master/test/fc_blas/src/example.f90" style="font-size: 1em; line-height: 1.5;"&gt;program&lt;/A&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp;does not link statically with --mkl=sequential/parallel:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:;"&gt;milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/./mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort   -static-intel  -mkl=sequential    -O3 src/CMakeFiles/example.dir/example.f90.o  -o bin/example
src/CMakeFiles/example.dir/example.f90.o: In function `MAIN__':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/src/example.f90:(.text+0x37a): undefined reference to `dgemm_'
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/.
&lt;/PRE&gt;

&lt;PRE class="brush:;"&gt;milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/./mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort   -static-intel  -mkl=parallel    -O3 src/CMakeFiles/example.dir/example.f90.o  -o bin/example
src/CMakeFiles/example.dir/example.f90.o: In function `MAIN__':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/src/example.f90:(.text+0x37a): undefined reference to `dgemm_'
&lt;/PRE&gt;

&lt;P&gt;Without -static-intel flag it works:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/./mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort    -mkl=parallel    -O3 src/CMakeFiles/example.dir/example.f90.o  -o bin/example
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/.bin/example
 PASSED
&lt;/PRE&gt;

&lt;P&gt;Any help ? I guess --mkl=&amp;lt;sequential/parallel/cluster&amp;gt; is intended with dynamical linking only. Comments please ?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 20:37:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problems-with-Static-Linking-with-MKL/m-p/945430#M14826</guid>
      <dc:creator>miro_ilias</dc:creator>
      <dc:date>2015-08-28T20:37:14Z</dc:date>
    </item>
  </channel>
</rss>

