<?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 Hi Evarist, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093992#M23449</link>
    <description>&lt;P&gt;Hi Evarist,&lt;/P&gt;

&lt;P&gt;Thanks - your comment helped me fix CMake. I hadn't realised the linker looked for a .a if it couldn't find a .so. It was a case of messed up paths, so, problem of unresolved symbols now solved.&lt;/P&gt;

&lt;P&gt;Would be nice if Intel would supply pre-built shared libraries for these though. I'm a little mystified why Intel would make shared libraries for everything else except blas and lapack, unless there is some underlying problem with having those as shared libraries in which case I might run into some further problems?&lt;/P&gt;

&lt;P&gt;Regards, Nick&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2016 14:24:09 GMT</pubDate>
    <dc:creator>Nick_D_1</dc:creator>
    <dc:date>2016-03-02T14:24:09Z</dc:date>
    <item>
      <title>blas and lapack shared library</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093987#M23444</link>
      <description>&lt;P&gt;Hi, I'm trying to port a Fortran library to Linux. This must be dynamic(shared) because its called from C# using DllImport (on Linux this will run under mono). There are dependencies on blas and lapack. Only static versions of libmkl_blas95 and libmkl_lapack95 are supplied by Intel (at least with this compiler version - composer XE 2015.5.223). As result, though the library builds happily and many functions can be used, other functions crash with unresolved symbols from lapack.&lt;/P&gt;

&lt;P&gt;Since it seems possible, at least in C, to pull a static library into a shared library, I tried that, by in CMakeLists.txt&amp;nbsp; putting&amp;nbsp; TARGET_LINK_LIBRARIES("NameOfOurSharedLib" mkl_blas95_ilp64 mkl_lapack95_ilp64) . This get rejected with:&lt;/P&gt;

&lt;P&gt;ld: /opt/intel/mkl/lib/intel64/libmkl_lapack95_ilp64.a(dgecon.o): relocation R_X86_64_32 against `__STRLITPACK_1' can not be used when making a shared object; recompile with -fPIC&lt;BR /&gt;
	/opt/intel/mkl/lib/intel64/libmkl_lapack95_ilp64.a: could not read symbols: Bad value&lt;/P&gt;

&lt;P&gt;(Note, our shared library itself was compiled with -fPIC and doesn't have a problem until one tries to pull in these extra ones).&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/525275"&gt;This page&lt;/A&gt; advises "Shared libraries must not be linked with archive libraries.", so maybe the above is a bad idea? I wondered instead about building shared versions of blas and lapack myself, as described &lt;A href="https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/516014"&gt;here&lt;/A&gt;.&amp;nbsp; I followed instructions on that page to add -fPic in the makefile but that still builds libmkl_lapack95_lp64.a, not a .so. Is there something else I need to change in that makefile?&lt;/P&gt;

&lt;P&gt;Failing this, the only other thing I can think of is to pull in every .f90 file from lapack95 to my shared library, but that doesn't seem very nice.&lt;/P&gt;

&lt;P&gt;Any suggestions?, Thanks, Nick&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 17:49:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093987#M23444</guid>
      <dc:creator>Nick_D_1</dc:creator>
      <dc:date>2016-03-01T17:49:48Z</dc:date>
    </item>
    <item>
      <title>If you can use the netlib</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093988#M23445</link>
      <description>&lt;P&gt;If you can use the netlib source code for&amp;nbsp; functions you need from those libraries, it might be best to build them yourself.&amp;nbsp; You can't affect the code in a pre-built object by setting -fPIC.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 19:08:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093988#M23445</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2016-03-01T19:08:44Z</dc:date>
    </item>
    <item>
      <title>Hi Nick,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093989#M23446</link>
      <description>&lt;P&gt;Hi Nick,&lt;/P&gt;

&lt;P&gt;MKL provides the sources for these two libraries (blas95 and lapack95). Please find them in $MKLROOT/interfaces/{blas95,lapack95}.&lt;/P&gt;

&lt;P&gt;You can add -fPIC option in the makefile and rebuild shared object libraries on your side.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 03:03:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093989#M23446</guid>
      <dc:creator>Evarist_F_Intel</dc:creator>
      <dc:date>2016-03-02T03:03:07Z</dc:date>
    </item>
    <item>
      <title>Thanks Evarist and Tim for</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093990#M23447</link>
      <description>&lt;P&gt;Thanks Evarist and Tim for replies. Adding the -fPIC option in the makefile wasn't enough on its own because it still tries to make an archive library. In the end I managed to interrupt the make operation and then do:&lt;/P&gt;

&lt;P&gt;gcc -shared -o libmkl_lapack95_lp64.so lib95/lib/intel64/obj_lapack95_intel64_/*.o&lt;/P&gt;

&lt;P&gt;to generate a shared library&amp;nbsp; (and did similar for blas).&lt;/P&gt;

&lt;P&gt;This makes shared libraries, but I'm now struggling to get CMake to link my local shared library to these (it keeps wanting to look at the archive libraries instead).&lt;/P&gt;

&lt;P&gt;I might now try instead pulling all the .o s from blas and lapack into my local shared library. That's ugly but hopefully should work.&lt;/P&gt;

&lt;P&gt;Suggestions welcome. :)&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 10:52:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093990#M23447</guid>
      <dc:creator>Nick_D_1</dc:creator>
      <dc:date>2016-03-02T10:52:16Z</dc:date>
    </item>
    <item>
      <title>This makes shared libraries,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093991#M23448</link>
      <description>&lt;BLOCKQUOTE&gt;
	&lt;P&gt;This makes shared libraries, but I'm now struggling to get CMake to link my local shared library to these (it keeps wanting to look at the archive libraries instead).&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Could you please clarify this statement? By default (if -lfoo specified) linker tries to use shared object libfoo.so. If it cannot find it, it tries to use libfoo.a. So, I would expect dynamic libraries to be used, unless -Wl,-Bstatic is used or the directory with the shared library is not specified.&lt;/P&gt;

&lt;P&gt;BTW, creating *.so from *.a is absolutely ok (if objects are built with -fPIC). You might probably do something like this:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;gcc -shared -olibmkl95.so \
  -Wl,--whole-arhive \
    libmkl_intel_blas95.a libmkl_intel_lapack95.a \
  -Wl,--no-whole-archive \
  -L$MKLROOT/lib/intel64 \
  -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:02:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093991#M23448</guid>
      <dc:creator>Evarist_F_Intel</dc:creator>
      <dc:date>2016-03-02T11:02:37Z</dc:date>
    </item>
    <item>
      <title>Hi Evarist,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093992#M23449</link>
      <description>&lt;P&gt;Hi Evarist,&lt;/P&gt;

&lt;P&gt;Thanks - your comment helped me fix CMake. I hadn't realised the linker looked for a .a if it couldn't find a .so. It was a case of messed up paths, so, problem of unresolved symbols now solved.&lt;/P&gt;

&lt;P&gt;Would be nice if Intel would supply pre-built shared libraries for these though. I'm a little mystified why Intel would make shared libraries for everything else except blas and lapack, unless there is some underlying problem with having those as shared libraries in which case I might run into some further problems?&lt;/P&gt;

&lt;P&gt;Regards, Nick&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 14:24:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/blas-and-lapack-shared-library/m-p/1093992#M23449</guid>
      <dc:creator>Nick_D_1</dc:creator>
      <dc:date>2016-03-02T14:24:09Z</dc:date>
    </item>
  </channel>
</rss>

