<?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 Linux ...calling MKL 10.2 from Python in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802701#M3194</link>
    <description>There is also an article published in the MKL KB with some samples on using MKL in Python applications.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://software.intel.com/en-us/articles/using-intel-mkl-in-your-python-programs/" target="_blank"&gt;http://software.intel.com/en-us/articles/using-intel-mkl-in-your-python-programs/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;--Vipin&lt;BR /&gt;</description>
    <pubDate>Tue, 14 Dec 2010 06:49:40 GMT</pubDate>
    <dc:creator>VipinKumar_E_Intel</dc:creator>
    <dc:date>2010-12-14T06:49:40Z</dc:date>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802696#M3189</link>
      <description>I have a Python extension ( SWIG generated) that calls MKL. There were initially various problems with missing shared libraries at runtime when MKL dynamically loaded processor specific libraries, but that was resolved with --start-group, --end-group being passed to the linker.&lt;BR /&gt;&lt;BR /&gt;For example &lt;BR /&gt;&lt;BR /&gt;MKLLIBS=-L$(MKLROOT)/lib/em64t $(MKLROOT)/lib/em64t/libmkl_solver_lp64.a -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_mc -lmkl_p4n -lmkl_mc3 -lmkl_def -lmkl_vml_mc -lmkl_vml_mc3 -lintlc -Wl,--end-group -liomp5 -lpthread&lt;BR /&gt;&lt;BR /&gt;However, the python extension is now failing on specific processor architecture( e.g. Xeon) with a bus error. It does not fail on, say, a Core 2 Duo. The GDB stack is as follows.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#0 0x00002aaaaf25e49f in mkl_blas_ztrsm_lln () from /home/sz9lzw-e/vaone2010/libmkl_mc.so&lt;BR /&gt;#1 0x00002aaab1ba2993 in mkl_blas_ztrsm_left_ker () from /home/sz9lzw-e/vaone2010/libmkl_mc3.so&lt;BR /&gt;#2 0x00002aaab1ba0411 in mkl_blas_ztrsm_left () from /home/sz9lzw-e/vaone2010/libmkl_mc3.so&lt;BR /&gt;#3 0x00002aaab1b98b4b in mkl_blas_xztrsm () from /home/sz9lzw-e/vaone2010/libmkl_mc3.so&lt;BR /&gt;#4 0x00002aaaada0bba9 in mkl_blas_xztrsm () from /home/sz9lzw-e/vaone2010/libmkl_intel_thread.so&lt;BR /&gt;#5 0x00002aaaadb3ec41 in mkl_blas_ztrsm () from /home/sz9lzw-e/vaone2010/libmkl_intel_thread.so&lt;BR /&gt;#6 0x00002aaab49693d3 in __kmp_invoke_microtask () from /home/sz9lzw-e/vaone2010/libiomp5.so&lt;BR /&gt;#7 0x00002aaab4946796 in __kmpc_invoke_task_func () from /home/sz9lzw-e/vaone2010/libiomp5.so&lt;BR /&gt;#8 0x00002aaab49478e3 in __kmp_launch_thread () from /home/sz9lzw-e/vaone2010/libiomp5.so&lt;BR /&gt;#9 0x00002aaab496f347 in ?? () from /home/sz9lzw-e/vaone2010/libiomp5.so&lt;BR /&gt;#10 0x00002aaaaae96193 in start_thread () from /lib64/libpthread.so.0&lt;BR /&gt;#11 0x00002aaaab3c7dfd in clone () from /lib64/libc.so.6&lt;BR /&gt;&lt;BR /&gt;If I write a "C" version of the calling python, and link to MKL to create a standalone exectutable, that runs fine on all machine architectures (i.e. it is not a known bug in "my" code).&lt;BR /&gt;&lt;BR /&gt;My guess, is that somehow the wrong processor core functions are getting loaded? Anyone have ideas?&lt;BR /&gt;&lt;BR /&gt;GDB "info shared" shows&lt;BR /&gt;&lt;BR /&gt;0x00002aaaad5afff0 0x00002aaaad6f98cc Yes /home/sz9lzw-e/vaone2010/libmkl_intel_lp64.so&lt;BR /&gt;0x00002aaaada08690 0x00002aaaae3bdce8 Yes /home/sz9lzw-e/vaone2010/libmkl_intel_thread.so&lt;BR /&gt;0x00002aaaaeb86a50 0x00002aaaaec77b10 Yes /home/sz9lzw-e/vaone2010/libmkl_core.so&lt;BR /&gt;0x00002aaaaef7c7a0 0x00002aaab0168040 Yes /home/sz9lzw-e/vaone2010/libmkl_mc.so&lt;BR /&gt;0x00002aaab0486cf0 0x00002aaab1502bf0 Yes /home/sz9lzw-e/vaone2010/libmkl_p4n.so&lt;BR /&gt;0x00002aaab18141c0 0x00002aaab29c7eb0 Yes /home/sz9lzw-e/vaone2010/libmkl_mc3.so&lt;BR /&gt;0x00002aaab2cd3e30 0x00002aaab3c47440 Yes /home/sz9lzw-e/vaone2010/libmkl_def.so&lt;BR /&gt;0x00002aaab3eb6e10 0x00002aaab40840d0 Yes /home/sz9lzw-e/vaone2010/libmkl_vml_mc.so&lt;BR /&gt;0x00002aaab433b9f0 0x00002aaab44fb964 Yes /home/sz9lzw-e/vaone2010/libmkl_vml_mc3.so&lt;BR /&gt;0x00002aaab47b0d90 0x00002aaab47d8b60 Yes /home/sz9lzw-e/vaone2010/libintlc.so.5&lt;BR /&gt;0x00002aaab4907b80 0x00002aaab4972174 Yes /home/sz9lzw-e/vaone2010/libiomp5.so&lt;BR /&gt;0x00002aaab4aac2e0 0x00002aaab4bf4ea0 Yes /home/sz9lzw-e/vaone2010/libimf.so&lt;BR /&gt;0x00002aaab4e35b20 0x00002aaab4e8d940 Yes /home/sz9lzw-e/vaone2010/libsvml.so&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Oct 2010 16:29:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802696#M3189</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2010-10-20T16:29:32Z</dc:date>
    </item>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802697#M3190</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Is &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=77535"&gt;this &lt;/A&gt;recent thread releavant to your issue?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Dima</description>
      <pubDate>Thu, 21 Oct 2010 03:45:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802697#M3190</guid>
      <dc:creator>Dmitry_B_Intel</dc:creator>
      <dc:date>2010-10-21T03:45:09Z</dc:date>
    </item>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802698#M3191</link>
      <description>Yes, highly likely.&lt;BR /&gt;&lt;BR /&gt;The original problem was that when the python .so was loaded there was an error&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: sans-serif; font-size: x-small;"&gt;python: symbol lookup error: /home/sz9lzw-e/vaone2010/libmkl_vml_mc3.so:
undefined symbol: mkl_serv_mkl_malloc&lt;BR /&gt;&lt;BR /&gt;So I added all the CPU specific libraries to the link line - as the thread you reference indicated this creates more problems.&lt;BR /&gt;&lt;BR /&gt;So I see I either have to create a custom MKL .so or cause the functions to be preloaded.&lt;/SPAN&gt;</description>
      <pubDate>Thu, 21 Oct 2010 15:32:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802698#M3191</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2010-10-21T15:32:38Z</dc:date>
    </item>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802699#M3192</link>
      <description>Never mind, found it.</description>
      <pubDate>Thu, 21 Oct 2010 17:42:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802699#M3192</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2010-10-21T17:42:08Z</dc:date>
    </item>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802700#M3193</link>
      <description>Hi Dima,&lt;BR /&gt;I managed to get this problem resiloved using the following technique - as suggested in the other thread&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;Create a .c file with the following&lt;/LI&gt;&lt;LI&gt;&lt;PRE&gt;[bash]#include &lt;DLFCN.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;int start_fn2 () __attribute__ ((constructor));&lt;BR /&gt;int start_fn2()&lt;BR /&gt;{&lt;BR /&gt;        int flags = RTLD_GLOBAL|RTLD_LAZY;&lt;BR /&gt;        void *dlh2 = dlopen("libmkl_core.so",flags);&lt;BR /&gt;       void *dlh3 = dlopen("libmkl_intel_lp64.so",flags);&lt;BR /&gt;      void *dlh4 = dlopen("libmkl_intel_thread.so",flags);&lt;BR /&gt;	    printf( "Loaded MKL DLLS  %p %p %pn",dlh2,dlh3,dlh4);fflush(stdout);&lt;BR /&gt;			return 0;	&lt;BR /&gt;}[/bash]&lt;/STDIO.H&gt;&lt;/DLFCN.H&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;Compile that file and link it into my python module .so&lt;/LI&gt;&lt;LI&gt;Add "-z initfirst" to the link line for my python module .so. This was important as some of the other dependent DLL's linked against MKL.&lt;/LI&gt;&lt;LI&gt;I did need to dlopen all three DLL's, just libmkl_core.so was not enough. &lt;/LI&gt;&lt;/UL&gt;&lt;BR /&gt;Andrew</description>
      <pubDate>Thu, 21 Oct 2010 20:04:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802700#M3193</guid>
      <dc:creator>AndrewC</dc:creator>
      <dc:date>2010-10-21T20:04:36Z</dc:date>
    </item>
    <item>
      <title>Linux ...calling MKL 10.2 from Python</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802701#M3194</link>
      <description>There is also an article published in the MKL KB with some samples on using MKL in Python applications.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://software.intel.com/en-us/articles/using-intel-mkl-in-your-python-programs/" target="_blank"&gt;http://software.intel.com/en-us/articles/using-intel-mkl-in-your-python-programs/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;--Vipin&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Dec 2010 06:49:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linux-calling-MKL-10-2-from-Python/m-p/802701#M3194</guid>
      <dc:creator>VipinKumar_E_Intel</dc:creator>
      <dc:date>2010-12-14T06:49:40Z</dc:date>
    </item>
  </channel>
</rss>

