<?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 Nguyen, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153646#M27377</link>
    <description>&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Hi Nguyen,&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;I suggest to continue use vdRngUniform() routine with generation by blocks.&lt;BR /&gt;Here I mean that you can generate matrix of the needed size block by block, as shown below:&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VSLStreamStatePtr stream;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;vslNewStream( &amp;amp;stream, BRNG,&amp;nbsp; SEED );&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const int64_t size = 40000*40000;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;const int64_t block_size = 1000;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double* matrix;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;matrix = (double*) malloc (size*sizeof(double));&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int64_t i = 0; i &amp;lt; size; i+=block_size) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;vdRngUniform( VSL_RNG_METHOD_UNIFORM_STD, stream, block_size, matrix + i, 0.0, 1.0 );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; free(matrix);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;vslDeleteStream( &amp;amp;stream );&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Please, let me know, if it addresses your question.&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 12:27:37 GMT</pubDate>
    <dc:creator>Pavel_D_Intel1</dc:creator>
    <dc:date>2020-04-02T12:27:37Z</dc:date>
    <item>
      <title>Create a random matrix with MKL library</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153645#M27376</link>
      <description>&lt;P&gt;When I use&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;vdRngUniform()&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;routine to create a random matrix, the maximum size matrix I can use only 40000 x 40000. Do we have any other routine from MKL to create with the bigger size? I can create by the normal way on C but it affects performance. So please guide me with other routines from MKL&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 01:26:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153645#M27376</guid>
      <dc:creator>Tuyen__Nguyen</dc:creator>
      <dc:date>2020-04-02T01:26:20Z</dc:date>
    </item>
    <item>
      <title>Hi Nguyen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153646#M27377</link>
      <description>&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Hi Nguyen,&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;I suggest to continue use vdRngUniform() routine with generation by blocks.&lt;BR /&gt;Here I mean that you can generate matrix of the needed size block by block, as shown below:&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VSLStreamStatePtr stream;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;vslNewStream( &amp;amp;stream, BRNG,&amp;nbsp; SEED );&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const int64_t size = 40000*40000;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;const int64_t block_size = 1000;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double* matrix;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;matrix = (double*) malloc (size*sizeof(double));&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int64_t i = 0; i &amp;lt; size; i+=block_size) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;vdRngUniform( VSL_RNG_METHOD_UNIFORM_STD, stream, block_size, matrix + i, 0.0, 1.0 );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; free(matrix);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;vslDeleteStream( &amp;amp;stream );&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Please, let me know, if it addresses your question.&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 12:27:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153646#M27377</guid>
      <dc:creator>Pavel_D_Intel1</dc:creator>
      <dc:date>2020-04-02T12:27:37Z</dc:date>
    </item>
    <item>
      <title>plus two cents - I am not</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153647#M27378</link>
      <description>&lt;P&gt;plus two cents - I am not sure if using RNGUniform is important to your case, but you may take a look at the&amp;nbsp;https://software.intel.com/en-us/mkl-developer-reference-c-lagge routine which generates M x N&amp;nbsp;matrix. You may link with ILP64 mkl API and generate matrix beyond of 40k by 40K&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 14:47:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153647#M27378</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-04-02T14:47:25Z</dc:date>
    </item>
    <item>
      <title>Hi Pavel,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153648#M27379</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;&lt;P&gt;Your program is correct with size 40000x40000 but with the bigger size as 50000x50000 it will be fault&amp;nbsp;&lt;STRONG&gt;"&lt;/STRONG&gt;Segmentation fault (core dumped)".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please tell me if you have another way to solve this problem.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;DIV id="eJOY__extension_root" style="all:unset"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Apr 2020 08:02:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153648#M27379</guid>
      <dc:creator>Tuyen__Nguyen</dc:creator>
      <dc:date>2020-04-03T08:02:39Z</dc:date>
    </item>
    <item>
      <title>Hi Gennady F.,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153649#M27380</link>
      <description>&lt;P&gt;Hi Gennady F.,&lt;/P&gt;&lt;P&gt;Thanks for your recommendation but I also have a problem, please see my program:&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;#include "stdio.h"
#include "mkl.h"
#include "mkl_lapack.h"


#define LAPACK_ROW_MAJOR  101
#define LAPACK_COL_MAJOR  102

#define MIN(a,b) ((a &amp;lt; b) ? (a) : (b))

double  main()
{
    int m = 5000;
    int n = 5000;
    int kl = m-1 ;
    int ku = n-1;
    int len_d = MIN(m,n);
    const double *d ;
    double *a;
    int lda = n ;
    int * iseed;
    *iseed = 999;
    a = (double *)malloc(m*n*sizeof(double));
    d = (double *)malloc(len_d*sizeof(double));
    LAPACKE_dlagge (LAPACK_ROW_MAJOR , m , n , kl , ku , &amp;amp;d[0] , &amp;amp;a[0] , lda , iseed );
    free(a);

}&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;icc -I/opt/intel/compilers_and_libraries_2018.5.274/linux/mkl/include/ -mkl -lmkl_intel_ilp64 matrix.c -o matrix&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;In this case, I want sure it works well with the small size before I check bigger than 40000x40000. But it&amp;nbsp;shows&amp;nbsp;me the error "&lt;EM&gt;&lt;STRONG&gt;Intel MKL ERROR: Parameter 4 was incorrect on entry to DLAGGE&lt;/STRONG&gt;&lt;/EM&gt;."&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know how to fix the problem?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 08:32:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153649#M27380</guid>
      <dc:creator>Tuyen__Nguyen</dc:creator>
      <dc:date>2020-04-03T08:32:00Z</dc:date>
    </item>
    <item>
      <title>Hi Nguyen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153650#M27381</link>
      <description>&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Hi Nguyen,&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;I think that the root cause of your problem is integer overflow.&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;To avoid it you can change the line with size in my program as follows:&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const int64_t size = (int64_t)50000*(int64_t)50000;&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;I checked the program with 100&amp;nbsp;000 x 100&amp;nbsp;000 size – it works fine.&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Hope it helps you.&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;&lt;P style="margin-left:0cm; margin-right:0cm"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 09:12:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153650#M27381</guid>
      <dc:creator>Pavel_D_Intel1</dc:creator>
      <dc:date>2020-04-03T09:12:47Z</dc:date>
    </item>
    <item>
      <title>if you link with ILP64 lib,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153651#M27382</link>
      <description>&lt;P&gt;if you link with ILP64 lib, then you have to use -DMKL_ILP64 compiler option. Please refer the mkl linker adviser or mkl user guide for more details&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 09:14:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Create-a-random-matrix-with-MKL-library/m-p/1153651#M27382</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-04-03T09:14:39Z</dc:date>
    </item>
  </channel>
</rss>

