<?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 Re: Incorrect use of MKL Library random generator in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449673#M34220</link>
    <description>&lt;P&gt;Yes, Thank you so much!&lt;/P&gt;
&lt;P&gt;Solved my problem!&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 17:49:20 GMT</pubDate>
    <dc:creator>Alechiove</dc:creator>
    <dc:date>2023-01-24T17:49:20Z</dc:date>
    <item>
      <title>Incorrect use of MKL Library random generator</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1446891#M34169</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I'm new with oneapi and i'm trying to do a simple program for my university project doing a custom version of Pi Montecarlo Estimation.&lt;/P&gt;
&lt;P&gt;I'm almost done, but i have troubles creating the random numbers using uniform distribution.&lt;/P&gt;
&lt;P&gt;Can someone please help me with this errors that i keep getting?&lt;/P&gt;
&lt;P&gt;Leaving the code and logs of errors under this line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#include &amp;lt;sycl/sycl.hpp&amp;gt;
#include &amp;lt;oneapi/mkl/rng.hpp&amp;gt;

using namespace sycl;

static const int N_POINTS  = 10;
static const int N_SIM  = 10;


int create_points_and_calculate_eq(queue q){
    
    // create basic random number generator object
    oneapi::mkl::rng::philox4x32x10 engine(q, 777);
    // create distribution object
    oneapi::mkl::rng::uniform&amp;lt;double, oneapi::mkl::rng::uniform_method::standard&amp;gt; distr(0.0, 1.0);
    // creating vectors to store the points
    std::vector&amp;lt;double&amp;gt; sum_squared(N_POINTS);
    std::vector&amp;lt;double&amp;gt; x_sim(N_POINTS);
    std::vector&amp;lt;double&amp;gt; y_sim(N_POINTS);
    // creating Buffers for X/Y
    buffer&amp;lt;double&amp;gt; buf_x(x_sim.data(),x_sim.size());
    buffer&amp;lt;double&amp;gt; buf_y(y_sim.data(),y_sim.size());
    //Generating points
    oneapi::mkl::rng::generate(distr, engine, N_POINTS, buf_x);
    oneapi::mkl::rng::generate(distr, engine, N_POINTS, buf_y);
    //Creating buffer to store the sum of x**2 + y**2
    buffer&amp;lt;double&amp;gt; sum_sq(sum_squared.data(),sum_squared.size());
    q.submit([&amp;amp;](handler &amp;amp;h){
            auto V_x = buf_x.get_access&amp;lt;access::mode::read_write&amp;gt;(h);
            auto V_y = buf_y.get_access&amp;lt;access::mode::read_write&amp;gt;(h);
            auto X_PLUS_Y_SQ = sum_sq.get_access&amp;lt;access::mode::read_write&amp;gt;(h);
            h.parallel_for(range&amp;lt;1&amp;gt;(N_POINTS),[=] (id&amp;lt;1&amp;gt; i){
                double sum = V_x[i] * V_x[i] + V_y[i] * V_y[i];
                if (sum&amp;gt;1){X_PLUS_Y_SQ[i] = 0;}
                else{X_PLUS_Y_SQ[i] = 1;}

        }); 
    });
    //counts points inside radius=1 circle
    int pts_in_circle = 0;
    for(int i=0;i&amp;lt;N_POINTS;i++){pts_in_circle+=sum_squared[i];};
    return pts_in_circle;
};

int main(){
    
    queue queue_of_simulations;
    std::cout &amp;lt;&amp;lt; "Device : " &amp;lt;&amp;lt; queue_of_simulations.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; "\n";
    //std::vector&amp;lt;int&amp;gt; results(N_SIM);
    
    int tot_pts_created = N_SIM * N_POINTS;
    int pts_in_circle = 0;
    for(int i=0;i&amp;lt;N_SIM;i++){pts_in_circle += create_points_and_calculate_eq(queue_of_simulations);};
    
    double pi = 4 * pts_in_circle / tot_pts_created;
    std::cout &amp;lt;&amp;lt; "Pi Estimated:\t" &amp;lt;&amp;lt; pi &amp;lt;&amp;lt; std::endl;
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;icpx: error: linker command failed with exit code 1 (use -v to see invocation)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2023 22:46:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1446891#M34169</guid>
      <dc:creator>Alechiove</dc:creator>
      <dc:date>2023-01-15T22:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect use of MKL Library random generator</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1447062#M34170</link>
      <description>&lt;P&gt;Hi Alessio,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;Could you please try the below command and see if it works on your end?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;icpx -fsycl -qmkl *.cpp&lt;/LI-CODE&gt;
&lt;P&gt;Please get back to us if you still face any issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vidya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 13:06:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1447062#M34170</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2023-01-16T13:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect use of MKL Library random generator</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449548#M34212</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/271732"&gt;@Alechiove&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven't heard back from you, could you please provide us with an update regarding the issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vidya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 08:14:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449548#M34212</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2023-01-24T08:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect use of MKL Library random generator</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449673#M34220</link>
      <description>&lt;P&gt;Yes, Thank you so much!&lt;/P&gt;
&lt;P&gt;Solved my problem!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 17:49:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449673#M34220</guid>
      <dc:creator>Alechiove</dc:creator>
      <dc:date>2023-01-24T17:49:20Z</dc:date>
    </item>
    <item>
      <title>Re:Incorrect use of MKL Library random generator</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449859#M34221</link>
      <description>&lt;P&gt;Hi Alessio,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for accepting the solution.&lt;/P&gt;&lt;P&gt;Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Have a Great Day!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jan 2023 04:12:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Incorrect-use-of-MKL-Library-random-generator/m-p/1449859#M34221</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2023-01-25T04:12:40Z</dc:date>
    </item>
  </channel>
</rss>

