<?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 How to compile and run a simple program in C using MKL in linux in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803463#M3253</link>
    <description>Thank you so much guys.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;It finally worked after I tried to understand what the huge link line was about, and after being more comfortable with linux commands. I have a different problem now, which I suppose I should ask in a different thread.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks again !!&lt;/DIV&gt;</description>
    <pubDate>Sat, 18 Jun 2011 16:02:43 GMT</pubDate>
    <dc:creator>shitij90</dc:creator>
    <dc:date>2011-06-18T16:02:43Z</dc:date>
    <item>
      <title>How to compile and run a simple program in C using MKL in linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803459#M3249</link>
      <description>Hi !!&lt;BR /&gt;&lt;BR /&gt;I have tried googling and searching the answer on this site, but to no avail. I am a beginner in linux as well as MKL, but I can compile and run programs in linux (not using MKL) fine. Intel's manual is a tad too technical for me, I cant understand if i have to link statically, dynamically, and with what options......&lt;BR /&gt;&lt;BR /&gt;This is a simple program I am trying to run: &lt;BR /&gt;&lt;BR /&gt;----------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include "mkl.h"&lt;BR /&gt;&lt;BR /&gt;/*below is the declaration as given in header file*/&lt;BR /&gt;/*float cblas_sasum(const MKL_INT N, const float *X, const MKL_INT incX);*/&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;int n=5,inc=1;&lt;BR /&gt;float arr[]={1,2,3,4,5};&lt;BR /&gt;float result;&lt;BR /&gt;result=cblas_sasum(n, arr, inc);&lt;BR /&gt;&lt;BR /&gt;/*or sasum(&amp;amp;n,arr,&amp;amp;inc) ?? --- both give similar errors*/&lt;BR /&gt;&lt;BR /&gt;printf("result");&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;-------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;now the problems and doubts:&lt;BR /&gt;1. Is the program itself fine ?&lt;BR /&gt;2. How do I compile it? I read about long link commands for this and the intel's link advisor (and the manual), tried them as it is, but they dont work. &lt;BR /&gt;3. If I simply write "icc exp4.c", where exp4.c is the name of the program, I get the error:-&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;/usr/include/gnu/stubs.h(7): catastrophic error: could not open source file "gnu/stubs-32.h"&lt;BR /&gt; # include &lt;GNU&gt;&lt;BR /&gt; ^&lt;/GNU&gt;&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;compilation aborted for exp4.c (code 4)&lt;/I&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;what is this error ?&lt;BR /&gt;&lt;BR /&gt;4. If I compile by gcc, which I guess I shouldnt/cant, but still.... I get&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;/tmp/ccCqahjj.o: In function `main':&lt;BR /&gt;exp4.c:(.text+0x53): undefined reference to `cblas_sasum'&lt;BR /&gt;collect2: ld returned 1 exit status&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for your help in advance !!&lt;BR /&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Fri, 17 Jun 2011 07:29:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803459#M3249</guid>
      <dc:creator>shitij90</dc:creator>
      <dc:date>2011-06-17T07:29:16Z</dc:date>
    </item>
    <item>
      <title>How to compile and run a simple program in C using MKL in linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803460#M3250</link>
      <description>&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;We can recommend you to read the User's Guide first of all.&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;- after that please see at the examples which you can find into the package.For example the similar test you can find in ..\ComposerXE-2011\mkl\examples\cblas\source\ directoty ( on windows, but on linux it would be the similar folder).&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;-Please see the cblas_sasumx.c example.You can find there the makefiles which you can use for building these examples also.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;- how to link with MKL? there are several KB articles, but first we recomend to see how to link with MKL - &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/"&gt;these article&lt;/A&gt; in the case if your version is 10.*&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 Jun 2011 08:19:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803460#M3250</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2011-06-17T08:19:43Z</dc:date>
    </item>
    <item>
      <title>How to compile and run a simple program in C using MKL in linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803461#M3251</link>
      <description>&lt;P&gt;here is the link to &lt;A href="https://community.intel.com/en-us/forums/intel-math-kernel-library"&gt;the MKL Knowledge Base&lt;/A&gt;&lt;/P&gt;

&lt;H1&gt;&amp;nbsp;&lt;/H1&gt;</description>
      <pubDate>Fri, 17 Jun 2011 08:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803461#M3251</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2011-06-17T08:24:00Z</dc:date>
    </item>
    <item>
      <title>How to compile and run a simple program in C using MKL in linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803462#M3252</link>
      <description>Code that contains calls to special libraries, such as MKL, needs to be linked with these libraries in addition to the standard C and system libraries. This is done either by specifying compiler options, configuration files or simply by specifying the special library in the linker command.&lt;BR /&gt;&lt;BR /&gt;Change&lt;BR /&gt;&lt;BR /&gt; #include "mkl.h"&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt; #include &lt;MKL.H&gt;&lt;BR /&gt;&lt;BR /&gt;Depending on the version of Linux and MKL, the command can be as simple as&lt;BR /&gt;&lt;BR /&gt; icc -mkl xcblas.c&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;with the help of the MKL Link Line Advisor Tool, with suitable choices for your setup,&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash]$ gcc -I$MKLROOT/include xcblas.c -L $MKLROOT/lib/64 -L $MKLROOT/lib/64 -lmkl_solver_lp64_sequ&lt;BR /&gt;ential -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -lm[/bash]&lt;/PRE&gt;&lt;/MKL.H&gt;</description>
      <pubDate>Fri, 17 Jun 2011 14:20:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803462#M3252</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-06-17T14:20:33Z</dc:date>
    </item>
    <item>
      <title>How to compile and run a simple program in C using MKL in linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803463#M3253</link>
      <description>Thank you so much guys.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;It finally worked after I tried to understand what the huge link line was about, and after being more comfortable with linux commands. I have a different problem now, which I suppose I should ask in a different thread.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks again !!&lt;/DIV&gt;</description>
      <pubDate>Sat, 18 Jun 2011 16:02:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-compile-and-run-a-simple-program-in-C-using-MKL-in-linux/m-p/803463#M3253</guid>
      <dc:creator>shitij90</dc:creator>
      <dc:date>2011-06-18T16:02:43Z</dc:date>
    </item>
  </channel>
</rss>

