<?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 Segmentation fault on declaring variable while using mkl for ma in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831122#M5608</link>
    <description>Which OS, C compiler, what version of MKL, and what were the compiler options used?&lt;BR /&gt;&lt;BR /&gt;With Intel C 11.1.073 (IA32 or intel64) on SuSE Linux 11.3, the program, copied exactly from your post, can be compiled and run with no error messages when compiled with "icc -mkl -O &lt;FILE.C&gt;".&lt;/FILE.C&gt;</description>
    <pubDate>Mon, 03 Jan 2011 12:58:44 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2011-01-03T12:58:44Z</dc:date>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for matrix vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831121#M5607</link>
      <description>&lt;SPAN style="font-size: x-small;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;Hello ,&lt;BR /&gt;I am trying to use mkl library to do matrix vector multiplication .When I am declaring a variable char t3 ,its giving segmentation fault&lt;BR /&gt;and when I am commenting it ,its running fine.Please help me debug this problem&lt;BR /&gt;I have bolded the line and wrote a comment on it to identify it.&lt;BR /&gt;&lt;BR /&gt;The error that I am getting is as follows:&lt;SPAN style="font-size: x-small;"&gt;Output :&lt;/SPAN&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;SPAN style="font-size: x-small;"&gt;
./matrixVectorMultMKL2.o 10 10 1&lt;/SPAN&gt;&lt;BR /&gt;
&lt;SPAN style="font-size: x-small;"&gt;
Intializing.. size = 10&lt;/SPAN&gt;&lt;BR /&gt;
&lt;SPAN style="font-size: x-small;"&gt;
Performing multiplication 100 times..&lt;/SPAN&gt;&lt;BR /&gt;
&lt;SPAN style="font-size: x-small;"&gt;
Segmentation fault&lt;BR /&gt;&lt;BR /&gt;Please help!!!&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include "mkl_cblas.h"&lt;BR /&gt;#include "mkl.h"&lt;BR /&gt;#include&lt;UNISTD.H&gt;&lt;BR /&gt;&lt;BR /&gt;#include&lt;TIME.H&gt;&lt;BR /&gt;void DisplayVector(double *vector, int size)&lt;BR /&gt;{&lt;BR /&gt; int i;&lt;BR /&gt; for (i=0 ; i&lt;SIZE&gt;&lt;/SIZE&gt;  printf("%lf ",vector&lt;I&gt;);&lt;BR /&gt; }&lt;BR /&gt; printf("\\n");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;static inline unsigned long long getticks() {&lt;BR /&gt; unsigned int _hi,_lo;&lt;BR /&gt; __asm__ __volatile__("rdtsc":"=a"(_lo),"=d"(_hi));&lt;BR /&gt; return ((unsigned long long)_hi &amp;lt;&amp;lt; 32) | _lo;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;double getTimeInSeconds(long long ticks) {&lt;BR /&gt;&lt;BR /&gt; // first calculate processor speed&lt;BR /&gt; long long t1,t2,processorSpeed;&lt;BR /&gt; double timeInSeconds;&lt;BR /&gt; t1 = getticks();&lt;BR /&gt;&lt;BR /&gt; sleep(1);&lt;BR /&gt; t2 = getticks();&lt;BR /&gt; processorSpeed = t2 - t1;&lt;BR /&gt; // now calculate time&lt;BR /&gt; timeInSeconds = ((double) ticks) / ((double) processorSpeed);&lt;BR /&gt;&lt;BR /&gt; //timeInSeconds = ((double) ticks) / CLOCKS_PER_SEC ;&lt;BR /&gt; return timeInSeconds; &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main(int argc,char *argv[])&lt;BR /&gt;{ &lt;BR /&gt; int i, size = atoi(argv[1]);&lt;BR /&gt; //int i;&lt;BR /&gt; //int size = 3;&lt;BR /&gt; long long t1,t2;&lt;BR /&gt; double *matrix = (double *) mkl_malloc (size * size * sizeof(double),16);&lt;BR /&gt; double *vector = (double *) mkl_malloc (size * sizeof(double),16);&lt;BR /&gt; double *resultVector = (double *) mkl_malloc (size * sizeof(double),16);&lt;BR /&gt;&lt;BR /&gt; char t3; //Segmentation fault is coming due to this line&lt;BR /&gt;&lt;BR /&gt; printf("Intializing.. size = %d\\n",size);&lt;BR /&gt; for (i=0; i&amp;lt;(size*size); i++) {&lt;BR /&gt;  //matrix&lt;I&gt; = i+1;&lt;BR /&gt;  matrix&lt;I&gt; = 1;&lt;BR /&gt; }&lt;BR /&gt; for (i=0;i&lt;SIZE&gt;&lt;/SIZE&gt;  //vector&lt;I&gt; = i+1;&lt;BR /&gt;  vector&lt;I&gt; = 1;&lt;BR /&gt;  resultVector&lt;I&gt; = 0;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /* &lt;BR /&gt; void cblas_dgemv(const CBLAS_ORDER order,&lt;BR /&gt; const CBLAS_TRANSPOSE TransA, const MKL_INT M, const MKL_INT N,&lt;BR /&gt; const double alpha, const double *A, const MKL_INT lda,&lt;BR /&gt; const double *X, const MKL_INT incX, const double beta,&lt;BR /&gt; double *Y, const MKL_INT incY);&lt;BR /&gt;&lt;BR /&gt; typedef enum {CblasRowMajor=101, CblasColMajor=102} CBLAS_ORDER;&lt;BR /&gt; typedef enum {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113} CBLAS_TRANSPOSE; */&lt;BR /&gt;&lt;BR /&gt; mkl_set_num_threads ( 8 );&lt;BR /&gt; printf("Performing multiplication 100 times..\\n");&lt;BR /&gt; &lt;BR /&gt; t1 = getticks();&lt;BR /&gt; //printf("t1 = %Ld\\n",t1);&lt;BR /&gt; for (i=0;i&amp;lt;100;i++) {&lt;BR /&gt;  cblas_dgemv(CblasRowMajor, CblasNoTrans, size, size,1,matrix,size,vector,1,0,resultVector,1);&lt;BR /&gt; }&lt;BR /&gt; t2 = getticks();&lt;BR /&gt; &lt;BR /&gt; //printf("Clock ticks required : %Ld\\n",t2 - t1);&lt;BR /&gt;&lt;BR /&gt; //t = getTimeInSeconds(t2 - t1);&lt;BR /&gt;&lt;BR /&gt; printf("Time for multiplication : %lf\\n",(getTimeInSeconds(t2 - t1)) / 100.0);&lt;BR /&gt; &lt;BR /&gt; //printf("Result vector : ");&lt;BR /&gt; //DisplayVector(resultVector,size);&lt;BR /&gt; &lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/TIME.H&gt;&lt;/UNISTD.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Mon, 03 Jan 2011 10:53:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831121#M5607</guid>
      <dc:creator>prakrati</dc:creator>
      <dc:date>2011-01-03T10:53:06Z</dc:date>
    </item>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for ma</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831122#M5608</link>
      <description>Which OS, C compiler, what version of MKL, and what were the compiler options used?&lt;BR /&gt;&lt;BR /&gt;With Intel C 11.1.073 (IA32 or intel64) on SuSE Linux 11.3, the program, copied exactly from your post, can be compiled and run with no error messages when compiled with "icc -mkl -O &lt;FILE.C&gt;".&lt;/FILE.C&gt;</description>
      <pubDate>Mon, 03 Jan 2011 12:58:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831122#M5608</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-01-03T12:58:44Z</dc:date>
    </item>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for ma</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831123#M5609</link>
      <description>&lt;DIV&gt;Yes, more details will help to reproduce the problem.&lt;/DIV&gt;I used to try with the latest Intel compiler v12 bundled ( aka Composer XE 2011). no problems..&lt;DIV&gt;--Gennady&lt;/DIV&gt;</description>
      <pubDate>Mon, 03 Jan 2011 16:34:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831123#M5609</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2011-01-03T16:34:25Z</dc:date>
    </item>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for ma</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831124#M5610</link>
      <description>&lt;SPAN style="font-size: x-small;"&gt;I am compiling it with GCC .The version of gcc and mkl is as follows:&lt;BR /&gt;GCC version used : gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size: x-small;"&gt;
MKL version used : /app/intel/mkl/10.2.5.035&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;gcc matrixVectorMultMKL3.c -Wall -L $(MKLPATH) -I $(MKLINCLUDE) -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -o matrixVectorMultMKL3.o&lt;BR /&gt;&lt;BR /&gt;When I compiled using your command ,it ran successfully so I am just confused why its not running with the previous command&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Prakrati</description>
      <pubDate>Tue, 04 Jan 2011 06:55:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831124#M5610</guid>
      <dc:creator>prakrati</dc:creator>
      <dc:date>2011-01-04T06:55:27Z</dc:date>
    </item>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for ma</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831125#M5611</link>
      <description>That's very strange. Please try to remove all mkl routines calling. Will then be the same result?</description>
      <pubDate>Tue, 04 Jan 2011 11:07:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831125#M5611</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2011-01-04T11:07:31Z</dc:date>
    </item>
    <item>
      <title>Segmentation fault on declaring variable while using mkl for ma</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831126#M5612</link>
      <description>If you want to use ILP64 libraries, you probably have to tell GCC through suitable options that the default integer should be 64 bits.</description>
      <pubDate>Tue, 04 Jan 2011 13:00:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Segmentation-fault-on-declaring-variable-while-using-mkl-for/m-p/831126#M5612</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-01-04T13:00:39Z</dc:date>
    </item>
  </channel>
</rss>

