<?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 Thank you Ying; that has in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030292#M20101</link>
    <description>&lt;P class="p1"&gt;Thank you Ying; that has worked!&lt;/P&gt;

&lt;P class="p1"&gt;I’m surprised that my use case is a rare one: what I’m doing is to build a library of high-performance math functions that are called from a main application written in Java. The library was written in Fortran 2003 from the beginning, so uses Fortran 95 interfaces for BLAS and LAPACK throughout.&lt;/P&gt;

&lt;P class="p1"&gt;I have one supplementary question… At the moment I’m not using a Xeon Phi coprocessor, but I plan to get one within the next three months or so. When I do, then presumably I’ll need to link with the versions of libmkl_blas95_lp64.a and libmkl_lapack95_lp64.a given in the /opt/intel/mkl/lib/mic directory. A quick check with ‘readelf’ shows that these don’t have offset tables either, even though the other .a files in the same directory do. I expect I’ll have to build my own versions of these as well, but again I can’t see an explicit option for this in the provided makefile. When the time comes, what should I do?&lt;/P&gt;

&lt;P class="p1"&gt;Many thanks,&lt;/P&gt;

&lt;P class="p1"&gt;Eos.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jun 2014 08:46:26 GMT</pubDate>
    <dc:creator>eos_pengwern</dc:creator>
    <dc:date>2014-06-03T08:46:26Z</dc:date>
    <item>
      <title>Linking BLA95 and LAPACK 95 to a shared library in Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030290#M20099</link>
      <description>&lt;P&gt;I'm in the process of porting an application from Windows to Linux, and one component of my application is a shared library (a DLL on Windows) compiled with Intel Fortran and with heavy use of the BLAS and LAPACK libraries.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;When trying to compile the library in Linux, my first preference was to link the MKL libraries to it statically. According to the link line advisor, the required definition for LINKLIBS in my makefile was to be:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt; $(MKLROOT)/lib/intel64/libmkl_blas95_lp64.a $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -lm&lt;/PRE&gt;

&lt;P&gt;Using this, I obtained the following error message:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;ld: /opt/intel/composer_xe_2013_sp1.3.174/mkl/lib/intel64/libmkl_lapack95_lp64.a(dgesdd.o): relocation R_X86_64_32 against `__STRLITPACK_1' can not be used when making a shared object; recompile with -fPIC
/opt/intel/composer_xe_2013_sp1.3.174/mkl/lib/intel64/libmkl_lapack95_lp64.a: could not read symbols: Bad value&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;What this implies is that libkml_lapack95_lp64.a is only intended for being linked to main applications or other static libraries, not to dynamic libraries. I verified this by typing:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;readelf --relocs libmkl_lapack95_lp64.a | egrep '(GOT|PLT|JU?MP|SLOT)'&lt;/PRE&gt;

&lt;P&gt;as suggested &lt;A href="http://stackoverflow.com/questions/1340402/how-can-i-tell-with-something-like-objdump-if-an-object-file-has-been-built-wi"&gt;here&lt;/A&gt; and, sure enough, there is no offset table (even though most of the other MKL static libraries &lt;EM&gt;do&lt;/EM&gt; in fact have them).&lt;/P&gt;

&lt;P&gt;This is frustrating (I have another C shared library which I link with the static versions of the IPP libraries without any issues) but I can live with it. So, I went back to the MKL link-line advisor to find how to link the MKL dynamically, and the advice is:&lt;/P&gt;

&lt;P&gt;"Use this link line:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt; $(MKLROOT)/lib/intel64/libmkl_blas95_lp64 $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64 -L$(MKLROOT)/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm"&lt;/PRE&gt;

&lt;P&gt;I obeyed this to the letter, and the result is:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;ifort: error #10236: File not found:  '/opt/intel/composer_xe_2013_sp1.3.174/mkl/lib/intel64/libmkl_blas95_lp64'
ifort: error #10236: File not found:  '/opt/intel/composer_xe_2013_sp1.3.174/mkl/lib/intel64/libmkl_lapack95_lp64'&lt;/PRE&gt;

&lt;P&gt;Not altogether surprising, because indeed there aren't any files with these names that have either no suffix or a .so suffix. There are just the ".a" ones, and if I add the ".a" at the ends of the filenames in my link line then of course I'm using the same static libraries as before and I get the same relocation error as before. By the way, the same happens if I use the "-lmkl_blas95_lp64" syntax that I've seen documented elsewhere.&lt;/P&gt;

&lt;P&gt;So, should I compile my own shared library? It seems that not even this is supported, since if I dig down into&amp;nbsp;/opt/intel/composer_xe_2013_sp1.3.174/mkl/interfaces/blas95 and examine the makefile that is provided for doing a custom build, even that only supports static builds.&lt;/P&gt;

&lt;P&gt;So, finally, my question: what should I do? I see three alternatives:&lt;/P&gt;

&lt;P&gt;(1) Manually edit the Intel makefiles to recompile libmkl_blas95_lp64.a and libmkl_lapack95_lp64.a with the ifort equivalent to '-fPIC' (if there is one).&lt;/P&gt;

&lt;P&gt;(2)&amp;nbsp;Manually edit the Intel makefiles to create ibmkl_blas95_lp64.so and libmkl_lapack95_lp64.so.&lt;/P&gt;

&lt;P&gt;(3) Conclude that I'm doing something which, for some reason I can't discern, is unsupported and inadvisable.&lt;/P&gt;

&lt;P&gt;Hopefully, there is a fourth alternative which is simpler than any of the above, but I don't know what that may be. I'd very much appreciate some advice.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2014 10:13:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030290#M20099</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2014-06-02T10:13:34Z</dc:date>
    </item>
    <item>
      <title>Dear eos pengwern, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030291#M20100</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;A href="https://software.intel.com/en-us/user/283941" style="font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;eos pengwern&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you for the nicety reports. &amp;nbsp;It seems a rare case to build a shared library based on the blas95 library, relative to using them in main program. &amp;nbsp; As i understand, &amp;nbsp;the No. 1 should be an easiest way.&lt;/P&gt;

&lt;P&gt;(just add -fPIC in Makefile)&lt;/P&gt;

&lt;P&gt;opts0 &amp;nbsp; &amp;nbsp;= -fPIC&lt;BR /&gt;
	optsc &amp;nbsp; &amp;nbsp;= -c $(opts0)&lt;/P&gt;

&lt;P&gt;and rebuild them with the command :&amp;nbsp;make libintel64 INSTALL_DIR=lib95. Then use the libraries instead of the prebuild.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Regarding the shared library of blas95/lapack95, you are right, at present we only provide static library, there is not *.so. So the *.a shoud be &amp;nbsp;add&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;libmkl_blas95_lp64.a&amp;nbsp;&lt;/SPAN&gt;and&amp;nbsp;&lt;FONT color="#000000" face="Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace"&gt;&lt;SPAN style="line-height: 14.30880069732666px;"&gt;libmkl_lapack95_lp64.a. I will ask our developer to fix the problem in MKL link adviser.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;One tiny question, you mentioned your application&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;with heavy use of the BLAS and LAPACK libraries.&amp;nbsp;&lt;/SPAN&gt;are you using Fortran 95 interface or just common fortran interface? if just fortran interface, then the lapack95, blas95 linterface library are not needed.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2014 03:08:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030291#M20100</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-06-03T03:08:04Z</dc:date>
    </item>
    <item>
      <title>Thank you Ying; that has</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030292#M20101</link>
      <description>&lt;P class="p1"&gt;Thank you Ying; that has worked!&lt;/P&gt;

&lt;P class="p1"&gt;I’m surprised that my use case is a rare one: what I’m doing is to build a library of high-performance math functions that are called from a main application written in Java. The library was written in Fortran 2003 from the beginning, so uses Fortran 95 interfaces for BLAS and LAPACK throughout.&lt;/P&gt;

&lt;P class="p1"&gt;I have one supplementary question… At the moment I’m not using a Xeon Phi coprocessor, but I plan to get one within the next three months or so. When I do, then presumably I’ll need to link with the versions of libmkl_blas95_lp64.a and libmkl_lapack95_lp64.a given in the /opt/intel/mkl/lib/mic directory. A quick check with ‘readelf’ shows that these don’t have offset tables either, even though the other .a files in the same directory do. I expect I’ll have to build my own versions of these as well, but again I can’t see an explicit option for this in the provided makefile. When the time comes, what should I do?&lt;/P&gt;

&lt;P class="p1"&gt;Many thanks,&lt;/P&gt;

&lt;P class="p1"&gt;Eos.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2014 08:46:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030292#M20101</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2014-06-03T08:46:26Z</dc:date>
    </item>
    <item>
      <title>Hi Eos Pengwern, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030293#M20102</link>
      <description>&lt;P&gt;Hi Eos Pengwern,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for sharing. Yes, it seems a problem when using a Xeon Phi coprocessor. &amp;nbsp;You need to rebuild your own version. &amp;nbsp;You may need edit the makefile to add option mic&amp;nbsp;&lt;/P&gt;

&lt;P&gt;and the key for mic is to add -mmic option. &amp;nbsp;Please try it and let us know if any problem.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;opts0 &amp;nbsp; &amp;nbsp;= -fPIC -mmic&lt;BR /&gt;
	optsc &amp;nbsp; &amp;nbsp;= -c $(opts0)&lt;/P&gt;

&lt;P&gt;make libintel64 IA=mic INSTALL_DIR=mic&lt;/P&gt;

&lt;P&gt;and the *.mod and *.a &amp;nbsp;are in mic folder.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Fri, 06 Jun 2014 06:00:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030293#M20102</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-06-06T06:00:02Z</dc:date>
    </item>
    <item>
      <title>Thank you Ying. I think that</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030294#M20103</link>
      <description>&lt;P&gt;Thank you Ying. I think that worked. When I did the build, each file gave me an error message saying:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;ifort: warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.
&lt;/PRE&gt;

&lt;P&gt;...which I have an inkling may be just because I was compiling on a computer without an MIC. In any case, I got the .a files at the end of the process, but I won't be able to test them until I &lt;EM&gt;do&lt;/EM&gt; get an MIC system in a few months' time.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 19:27:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030294#M20103</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2014-06-06T19:27:19Z</dc:date>
    </item>
    <item>
      <title>You should be able to install</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030295#M20104</link>
      <description>&lt;P&gt;You should be able to install the MIC library components (included in MPSS) even if you don't have a MIC.&amp;nbsp; As it's entirely cross compilation and linking, the coprocessor isn't used until run time.&amp;nbsp; I haven't heard of any changes which would allow the MIC linker to use ordinary .a files; you would need the special tools.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 21:28:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030295#M20104</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2014-06-06T21:28:40Z</dc:date>
    </item>
    <item>
      <title>Thank you Tim. </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030296#M20105</link>
      <description>&lt;P&gt;Thank you Tim.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I looked into this; you're absolutely right, MPSS can be installed on a system without a Xeon Phi, but it looks like there's another snag: the downloadable versions are only supported on Red Hat or Suse, whilst I'm running Debian. It's clearly possible to install it on Debian (&lt;A href="http://erik.deblan.org/blog/index.php?article15/installing-a-xeon-phi-co-processor-on-debian-squeeze"&gt;see here for example&lt;/A&gt;) but it still looks like a bit of hackery is involved. As this won't be on my critical path until 3-6 months from now, I think I'll leave off getting to grips with this until then.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jun 2014 10:40:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030296#M20105</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2014-06-07T10:40:25Z</dc:date>
    </item>
    <item>
      <title>Hi Stephen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030297#M20106</link>
      <description>&lt;P&gt;Hi Stephen,&lt;/P&gt;

&lt;P&gt;I don't mean to hi-jack this thread, but I noticed your issues with trying to find out which MKL DLLs to distribute with your application in a 2011 thread =&amp;gt;&amp;nbsp;https://software.intel.com/en-us/forums/topic/282514. Did you find a resolution to the problem?&lt;/P&gt;

&lt;P&gt;I have a similar issue. I'm only using two MKL routines (Pardiso and&amp;nbsp;DFeast_scsrgv) and I can't find out which DLLs to distribute. I want to make sure that my application will work with all the different client's hardware.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
	Peter&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2014 07:33:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030297#M20106</guid>
      <dc:creator>schulzey</dc:creator>
      <dc:date>2014-07-10T07:33:13Z</dc:date>
    </item>
    <item>
      <title>Having successfully got</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030298#M20107</link>
      <description>&lt;P&gt;Having successfully got static linking to work on Linux, I actually then went back to my Windows build and got static linking to work there as well. Two things were necessary: first of all I put the static linking versions of the libraries onto the "Additional dependencies" line of my Linker/Input dialog within Visual Studio's project properties:&lt;/P&gt;

&lt;P&gt;mkl_blas95_lp64.lib mkl_lapack95_lp64.lib mkl_intel_lp64.lib mkl_core.lib mkl_sequential.lib (in my case, but the Link Line Advisor may tell you something different for the libraries you're using).&lt;/P&gt;

&lt;P&gt;Secondly (and somewhat counter-intuitively), in the Fortran/Libraries dialog I set the 'Runtime Library' to 'Multithread DLL' (or 'Debug Multithread DLL for the debug build) and &lt;EM&gt;set 'Use Math Kernel Library' to 'No'.&amp;nbsp;&lt;/EM&gt;This is because, even with static linking of the MKL, it is desirable to use dynamic linking for the other Intel Fortran runtime libraries, but by default if you set 'Use Math Kernel Library' to 'Yes' in this dialog th&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;en it ignores whatever you put in your Linker dialog and links the dynamic versions of the MKL anyway! Hence in effect what you need to do is to override the automatic linking of the MKL and specify it manually instead, which is what the above steps accomplish.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;When I look at my compiled DLL, the size of it (~40MB) indicates that pretty much the whole of the MKL has been linked into it anyway, since there are so many cross-dependencies that it is difficult for the linker to separate things out. Nonetheless, it is still simpler to distribute this one very large file than many small ones which added up to the same total size.&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, 10 Jul 2014 08:22:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030298#M20107</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2014-07-10T08:22:34Z</dc:date>
    </item>
    <item>
      <title>Thanks for that comprehensive</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030299#M20108</link>
      <description>&lt;P&gt;Thanks for that comprehensive reply. I'll give it a go and see what happens. I was actually trying to minimize the overall size of the MKL DLLs I have to distribute but it sounds like there won't be much saving.&lt;/P&gt;

&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2014 22:30:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-BLA95-and-LAPACK-95-to-a-shared-library-in-Linux/m-p/1030299#M20108</guid>
      <dc:creator>schulzey</dc:creator>
      <dc:date>2014-07-10T22:30:34Z</dc:date>
    </item>
  </channel>
</rss>

