<?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 Linking MKL within Python-C++-C-Fortran 2003 program in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976515#M17120</link>
    <description>&lt;P&gt;[repost from: http://stackoverflow.com/questions/13951953/linking-intels-mkl-within-python-c-c-fortran-2003-program]&lt;/P&gt;
&lt;P&gt;I am trying to link a program which nature is pretty complicated:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;developed and run under Linux Fedora&lt;/LI&gt;
&lt;LI&gt;main code written in fortran 2003 is heavily relies on Intel's MKL library and small pieces of ANSI C code&lt;/LI&gt;
&lt;LI&gt;it has C++ interface (use iso_c_binding)&lt;/LI&gt;
&lt;LI&gt;the c++ interface is accessed from python via boost.python&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;During the runtime I get the following text&lt;/P&gt;
&lt;P&gt;MKL FATAL ERROR:Cannot load neither libmkl_avx.so nor libmkl_def.so&lt;/P&gt;
&lt;P&gt;after which program stops.&lt;/P&gt;
&lt;P&gt;I have checked that bothlibmkl_avx.soandlibmkl_def.soare in $LD_LIBRARY_PATH&lt;/P&gt;
&lt;P&gt;The final linking is done via:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;g++-g3-shared-Wl,-soname,libFrrBoost_rt.so interfejs.o t83.o gen_random2.o-L/opt/intel/composerxe/mkl/lib/intel64-lpython2.7-lifport-lifcore-lboost_python-Wl,--start-group-lmkl_sequential-lmkl_intel_lp64-lmkl_core-Wl,--end-group-o libFrrBoost_rt.so&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;libFrrBoost is the module that is linked, then&lt;/P&gt;
&lt;P&gt;runningpython t83.py(in particular linker does not complain when preparing the binary file) which imports the module libFrrBoost causes the error.&lt;/P&gt;
&lt;P&gt;Tried to google. All the info I found was connected with "usual programs" written in C/Fortran and simply including Intel's MKL. I am able to run this sort of programs with no problem. I think the MKL part of the linking line in the Makefile is equivalent in both cases, but there must be somewhere a hidden mystery. The problem was usually bad linking - which I do not see applicable (the libraries are exactly as in Intel's manual - Interface, Threading and computational libraries are pretty standard)&lt;/P&gt;
&lt;P&gt;Used compilers:&lt;/P&gt;
&lt;P&gt;ifort 12.1.0, icpc 12.1.0, python Python 2.7.1, icc 12.1.0 (the small C snippet also calls MKL, but)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ADDITION (due to a comment of HirstoIliev@Stackoverflow)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have run the strace in this way:strace python t83.py; The result is (after grepping libmkl):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/libmkl_avx.so", O_RDONLY)=3&lt;/P&gt;
&lt;P&gt;open("/usr/bin/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory) open("/opt/slurm-2.2.5/lib/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/debugger/lib/intel64/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/libmkl_avx.so", O_RDONLY)=3&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I understand that the specification for open is as in &lt;A href="http://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html"&gt;here&lt;/A&gt; an, in particular, as 3,4 are positive and indicate that open has found a file and assigned it file discriptors. I have verified that the file does exist in that place.&lt;/P&gt;
&lt;P&gt;also this is "good" Intel compiler directory as:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;czeslaw@stefan:~/prog/FoCpy3 $ which ifort/opt/intel/composer_xe_2011_sp1.7.256/bin/intel64/ifort&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So the version is the same - aparently it is not a version issue.&lt;/P&gt;
&lt;P&gt;Everything is the same forlibmkl_def.so.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DISCLAIMER&lt;/STRONG&gt;: Although I may sound confident in what I write I am not. Every sentence should begin with "If I am not mistaken".&lt;/P&gt;</description>
    <pubDate>Wed, 19 Dec 2012 15:49:27 GMT</pubDate>
    <dc:creator>lacek</dc:creator>
    <dc:date>2012-12-19T15:49:27Z</dc:date>
    <item>
      <title>Linking MKL within Python-C++-C-Fortran 2003 program</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976515#M17120</link>
      <description>&lt;P&gt;[repost from: http://stackoverflow.com/questions/13951953/linking-intels-mkl-within-python-c-c-fortran-2003-program]&lt;/P&gt;
&lt;P&gt;I am trying to link a program which nature is pretty complicated:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;developed and run under Linux Fedora&lt;/LI&gt;
&lt;LI&gt;main code written in fortran 2003 is heavily relies on Intel's MKL library and small pieces of ANSI C code&lt;/LI&gt;
&lt;LI&gt;it has C++ interface (use iso_c_binding)&lt;/LI&gt;
&lt;LI&gt;the c++ interface is accessed from python via boost.python&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;During the runtime I get the following text&lt;/P&gt;
&lt;P&gt;MKL FATAL ERROR:Cannot load neither libmkl_avx.so nor libmkl_def.so&lt;/P&gt;
&lt;P&gt;after which program stops.&lt;/P&gt;
&lt;P&gt;I have checked that bothlibmkl_avx.soandlibmkl_def.soare in $LD_LIBRARY_PATH&lt;/P&gt;
&lt;P&gt;The final linking is done via:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;g++-g3-shared-Wl,-soname,libFrrBoost_rt.so interfejs.o t83.o gen_random2.o-L/opt/intel/composerxe/mkl/lib/intel64-lpython2.7-lifport-lifcore-lboost_python-Wl,--start-group-lmkl_sequential-lmkl_intel_lp64-lmkl_core-Wl,--end-group-o libFrrBoost_rt.so&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;libFrrBoost is the module that is linked, then&lt;/P&gt;
&lt;P&gt;runningpython t83.py(in particular linker does not complain when preparing the binary file) which imports the module libFrrBoost causes the error.&lt;/P&gt;
&lt;P&gt;Tried to google. All the info I found was connected with "usual programs" written in C/Fortran and simply including Intel's MKL. I am able to run this sort of programs with no problem. I think the MKL part of the linking line in the Makefile is equivalent in both cases, but there must be somewhere a hidden mystery. The problem was usually bad linking - which I do not see applicable (the libraries are exactly as in Intel's manual - Interface, Threading and computational libraries are pretty standard)&lt;/P&gt;
&lt;P&gt;Used compilers:&lt;/P&gt;
&lt;P&gt;ifort 12.1.0, icpc 12.1.0, python Python 2.7.1, icc 12.1.0 (the small C snippet also calls MKL, but)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ADDITION (due to a comment of HirstoIliev@Stackoverflow)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have run the strace in this way:strace python t83.py; The result is (after grepping libmkl):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/libmkl_avx.so", O_RDONLY)=3&lt;/P&gt;
&lt;P&gt;open("/usr/bin/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory) open("/opt/slurm-2.2.5/lib/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/debugger/lib/intel64/libmkl_avx.so", O_RDONLY)=-1 ENOENT(No such file or directory)&lt;/P&gt;
&lt;P&gt;open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/libmkl_avx.so", O_RDONLY)=3&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I understand that the specification for open is as in &lt;A href="http://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html"&gt;here&lt;/A&gt; an, in particular, as 3,4 are positive and indicate that open has found a file and assigned it file discriptors. I have verified that the file does exist in that place.&lt;/P&gt;
&lt;P&gt;also this is "good" Intel compiler directory as:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;czeslaw@stefan:~/prog/FoCpy3 $ which ifort/opt/intel/composer_xe_2011_sp1.7.256/bin/intel64/ifort&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So the version is the same - aparently it is not a version issue.&lt;/P&gt;
&lt;P&gt;Everything is the same forlibmkl_def.so.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DISCLAIMER&lt;/STRONG&gt;: Although I may sound confident in what I write I am not. Every sentence should begin with "If I am not mistaken".&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2012 15:49:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976515#M17120</guid>
      <dc:creator>lacek</dc:creator>
      <dc:date>2012-12-19T15:49:27Z</dc:date>
    </item>
    <item>
      <title>It seems the solution is to</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976516#M17121</link>
      <description>It seems the solution is to link with -lmkl_rt instead of -lmkl_sequential -lmkl_intel_lp64 -lmkl_core. I do not see why one should give advantageous over te other. I am confused but that works (so far).</description>
      <pubDate>Thu, 20 Dec 2012 07:06:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976516#M17121</guid>
      <dc:creator>lacek</dc:creator>
      <dc:date>2012-12-20T07:06:52Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976517#M17122</link>
      <description>Hi,

In case of creating your libFrrBoost_rt.so which depends explicitly from mkl_intel_lp64 + mkl_sequential + mkl_core MKL dynamic libraries please try to locate libFrrBoost_rt together with all MKL dynamic libraires (required on run-time) in the same directory.</description>
      <pubDate>Mon, 24 Dec 2012 07:48:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-within-Python-C-C-Fortran-2003-program/m-p/976517#M17122</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2012-12-24T07:48:22Z</dc:date>
    </item>
  </channel>
</rss>

