<?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 simple example: calling MKL prevents program exit  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811301#M3950</link>
    <description>The program ran fine on a Linux system (not Ubuntu). One check that you may easily do is to make sure that the target of the system call (/bin/ls) exists on your $PATH and is executable. You may try replacing "/bin/ls" by just "ls" in the system call.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash]&lt;PRE name="code" class="bash"&gt;[mecej4@login2 LANG]$ . /opt/intel/Compiler/11.1/072/bin/iccvars.sh  ia64
[mecej4@login2 LANG]$ icc -mkl hang.c
[mecej4@login2 LANG]$ ./a.out
0.000000
F51          cmplx.cxx     hang.c                        perfs.f90  test.bin
MP           correct       hashtbl.f90                   pptr.f90   tsc.f90
Makefile     d2.F          hola.f90                      prob.f90   tst.f90
Pemb         dpotrx.c      hola.tgz                      psx.f90    vfe.f90
a.out        dstx.c        ibug.f90                      pth.f90    wang.f90
allo.f90     dstxda.c      kr.f90                        rci.F      zb.c
archive.zip  error         makefile.moelle               rci.F90    zb.f90
bend.f       escribir.f90  moelle.f90                    rndg.f90   zb1.f90
bob.f90      example.tar   moelle.ftn                    side.f90   zd.f90
bugmod.f90   ffunc.f90     pc_checkcgsmks__genmod.f90    splt.f90
cmain.c      gemm.cpp      pc_makelowercase__genmod.f90  str.f90[/bash]&lt;/PRE&gt; &lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Jun 2011 10:59:14 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2011-06-07T10:59:14Z</dc:date>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811300#M3949</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;The attached example program hangs after it finishes (0% CPU usage), but doesn't quit back to shell.&lt;BR /&gt;&lt;BR /&gt;The critical part is that a call to "cblas_sgemm" is followed by a call to "system".&lt;BR /&gt;&lt;BR /&gt;I'm new to using MKL, so perhaps I'm not linking correctly, or making some other stupid mistake.&lt;BR /&gt;&lt;BR /&gt;I'm using GCC (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 to compile and link this as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;gcc -static -I/home/t/local/intel_mkl/mkl/include -o mkl_hangs mkl_hangs.c -L/home/t/local/intel_mkl/composerxe-2011.4.191/mkl/lib/intel64 -L/home/t/local/intel_mkl/lib/intel64 -lmkl_intel_lp64 -Wl,--start-group -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -fopenmp&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;(This is on Ubuntu 11.04, AMD64, and /home/t/local/intel_mkl is where I installed MKL)&lt;BR /&gt;&lt;BR /&gt;Please let me know if you can or cannot reproduce this behavior, and thanks in advance for any suggestions!&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jun 2011 22:50:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811300#M3949</guid>
      <dc:creator>olegsd</dc:creator>
      <dc:date>2011-06-06T22:50:48Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811301#M3950</link>
      <description>The program ran fine on a Linux system (not Ubuntu). One check that you may easily do is to make sure that the target of the system call (/bin/ls) exists on your $PATH and is executable. You may try replacing "/bin/ls" by just "ls" in the system call.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash]&lt;PRE name="code" class="bash"&gt;[mecej4@login2 LANG]$ . /opt/intel/Compiler/11.1/072/bin/iccvars.sh  ia64
[mecej4@login2 LANG]$ icc -mkl hang.c
[mecej4@login2 LANG]$ ./a.out
0.000000
F51          cmplx.cxx     hang.c                        perfs.f90  test.bin
MP           correct       hashtbl.f90                   pptr.f90   tsc.f90
Makefile     d2.F          hola.f90                      prob.f90   tst.f90
Pemb         dpotrx.c      hola.tgz                      psx.f90    vfe.f90
a.out        dstx.c        ibug.f90                      pth.f90    wang.f90
allo.f90     dstxda.c      kr.f90                        rci.F      zb.c
archive.zip  error         makefile.moelle               rci.F90    zb.f90
bend.f       escribir.f90  moelle.f90                    rndg.f90   zb1.f90
bob.f90      example.tar   moelle.ftn                    side.f90   zd.f90
bugmod.f90   ffunc.f90     pc_checkcgsmks__genmod.f90    splt.f90
cmain.c      gemm.cpp      pc_makelowercase__genmod.f90  str.f90[/bash]&lt;/PRE&gt; &lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2011 10:59:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811301#M3950</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-06-07T10:59:14Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811302#M3951</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;"/bin/ls" definitely exists. In fact it runs, and "system" returns. I suspect some kind of memory/stack corruption (possibly related to the threading libraries and static linking), which is why the program doesn't quit.&lt;BR /&gt;&lt;BR /&gt;By the way, it seems that you compiled with ICC. I'm seeing this problem while I'm compiling with GCC.</description>
      <pubDate>Wed, 08 Jun 2011 22:28:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811302#M3951</guid>
      <dc:creator>olegsd</dc:creator>
      <dc:date>2011-06-08T22:28:24Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811303#M3952</link>
      <description>This might be related to this &lt;A href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176"&gt;issue&lt;/A&gt;. I plan to investigate later.</description>
      <pubDate>Wed, 08 Jun 2011 23:11:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811303#M3952</guid>
      <dc:creator>olegsd</dc:creator>
      <dc:date>2011-06-08T23:11:31Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811304#M3953</link>
      <description>&lt;B&gt;Update:&lt;/B&gt; Nope. The GCC issue I linked to earlier appears to be unrelated. &lt;BR /&gt;&lt;BR /&gt;I get exactly the same problem while doing dynamic linking, which is simpler:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;gcc -I/home/t/local/intel_mkl/mkl/include -o mkl_hangs 
mkl_hangs.c 
-L/home/t/local/intel_mkl/composerxe-2011.4.191/mkl/lib/intel64 
-L/home/t/local/intel_mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -fopenmp -lm&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;Anyone with a 64-bit Linux care to try to reproduce this?</description>
      <pubDate>Thu, 09 Jun 2011 22:07:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811304#M3953</guid>
      <dc:creator>olegsd</dc:creator>
      <dc:date>2011-06-09T22:07:07Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811305#M3954</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I can see several problems here but your example works OK on my Linux.&lt;BR /&gt;&lt;BR /&gt;1) it's not good to link with both OpenMP libraries: -liomp5 -fopenmp&lt;BR /&gt;2) Link line should use groupping for MKL-libs (try &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/"&gt;Intel MKL Link Line Advisor&lt;/A&gt;)&lt;BR /&gt;3) For -fopenmp please also try -lmkl_gnu_thread instead of -lmkl_intel_thread&lt;BR /&gt;4) -static option will need static libpthread but some OSes do not have it&lt;BR /&gt;&lt;BR /&gt;Please try something like as followsif you need static linking :&lt;BR /&gt;&lt;I&gt;gcc-I/home/t/local/intel_mkl/mkl/include -o mkl_hangs mkl_hangs.c -L/home/t/local/intel_mkl/composerxe-2011.4.191/mkl/lib/intel64 -L/home/t/local/intel_mkl/lib/intel64 &lt;STRONG&gt;-Bstatic &lt;/STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;-Wl,--start-group&lt;/SPAN&gt; -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core &lt;SPAN style="text-decoration: underline;"&gt;-Wl,--end-group&lt;/SPAN&gt; -liomp5 &lt;STRONG&gt;-Bdynamic&lt;/STRONG&gt; -lpthread -lm&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;or for dynamic linking&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;gcc -I/home/t/local/intel_mkl/mkl/include -o mkl_hangs mkl_hangs.c -L/home/t/local/intel_mkl/composerxe-2011.4.191/mkl/lib/intel64 -L/home/t/local/intel_mkl/lib/intel64&lt;STRONG&gt;-Bdynamic&lt;/STRONG&gt; -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2011 09:24:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811305#M3954</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2011-06-10T09:24:41Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811306#M3955</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I tried your suggestions&lt;A&gt; and what the web site generated&lt;B&gt;, with some tweaks:&lt;BR /&gt;&lt;BR /&gt;Linking with "GNU threads" works, and the program terminates:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;(1) gcc -I${MKLROOT}/mkl/include mkl_hangs.c -Wl,--start-group ${MKLLIB}/libmkl_intel_lp64.a ${MKLLIB}/libmkl_gnu_thread.a ${MKLLIB}/libmkl_core.a -Wl,--end-group -fopenmp&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;This solves the problem for me, I hope.&lt;BR /&gt;&lt;BR /&gt;However, linking with "Intel threads" still creates a binary that doesn't terminate.&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;(2) gcc -I${MKLROOT}/mkl/include mkl_hangs.c -Wl,--start-group ${MKLLIB}/libmkl_intel_lp64.a ${MKLLIB}/libmkl_intel_thread.a ${MKLLIB}/libmkl_core.a -Wl,--end-group ${MKLROOT}/composerxe-2011.4.191/compiler/lib/intel64/libiomp5.a -lpthread&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;where:&lt;BR /&gt;&lt;BR /&gt;MKLROOT=/home/t/local/intel_mkl&lt;BR /&gt;MKLLIB=${MKLROOT}/composerxe-2011.4.191/mkl/lib/intel64&lt;BR /&gt;&lt;BR /&gt;By the way, icc also creates binaries that fail to terminate:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;(3) icc mkl_hangs.c -mkl&lt;BR /&gt;(4) icc -static mkl_hangs.c -mkl&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;If you'd like the three bad binaries, please email me.&lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/B&gt;&lt;/A&gt;&lt;A&gt; -Bstatic seems to be ignored on my system&lt;BR /&gt;&lt;B&gt; The web site generates incorrect paths for me:&lt;BR /&gt; gcc: /home/t/local/intel_mkl/lib/intel64/libmkl_intel_lp64.a: No such file or directory&lt;BR /&gt;(The long chain of symlinks doesn't resolve to where the library actually is)&lt;BR /&gt;&lt;BR /&gt;&lt;/B&gt;&lt;/A&gt;</description>
      <pubDate>Mon, 13 Jun 2011 00:01:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811306#M3955</guid>
      <dc:creator>olegsd</dc:creator>
      <dc:date>2011-06-13T00:01:06Z</dc:date>
    </item>
    <item>
      <title>simple example: calling MKL prevents program exit</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811307#M3956</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It's strange however, that icc code fails. Please try intel-threads with icc.&lt;BR /&gt;I mean use icc in the case (2) above.&lt;BR /&gt;&lt;BR /&gt;Also, it's interesting that cases (3) and (4) fail. I'll try to reproduce them.&lt;BR /&gt;&lt;BR /&gt;As to your note (b) you could manually substitute correct path to the static libmkl_intel_lp64 library...</description>
      <pubDate>Tue, 14 Jun 2011 09:59:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/simple-example-calling-MKL-prevents-program-exit/m-p/811307#M3956</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2011-06-14T09:59:32Z</dc:date>
    </item>
  </channel>
</rss>

