<?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 Using Intel MPI from .NET in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763272#M22</link>
    <description>Hi Jon,&lt;BR /&gt;&lt;BR /&gt;Could you please submit a tracker at premier.intel.com&lt;BR /&gt;In this case I'll be able to upload an engineering version of the Intel MPI Library to check the performance issue.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt; Dmitry&lt;BR /&gt;</description>
    <pubDate>Fri, 29 Apr 2011 13:22:21 GMT</pubDate>
    <dc:creator>Dmitry_K_Intel2</dc:creator>
    <dc:date>2011-04-29T13:22:21Z</dc:date>
    <item>
      <title>Using Intel MPI from .NET</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763268#M18</link>
      <description>&lt;DIV&gt;I wrote a simple ping-pong program in F# that uses Intel MPI. The measured latencies are great (around 10us for the smallest messages) but I need to transfer this functionality over to a production system that is a large multi-threaded F# program and I'm having great difficulty doing so.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I learned that I need to use the impimt.dll library instead of the usual impi.dll one and that I must initialize MPI using MPI_Init_thread instead of the usual MPI_Init. This works but the performance is literally 100,000s times worse. I'm seeing &lt;I&gt;four second latencies&lt;/I&gt;!&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is this to be expected?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;If so, how should I use Intel MPI for my latency-critical multithreaded program? The best idea I have come up with so far is to implement a token ring using my ping-pong code, sending messages back and forth that may or may not contain data. This seems hugely wasteful but I cannot see any other way to make it work.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Apr 2011 18:13:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763268#M18</guid>
      <dc:creator>Jon_Harrop</dc:creator>
      <dc:date>2011-04-14T18:13:08Z</dc:date>
    </item>
    <item>
      <title>Using Intel MPI from .NET</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763269#M19</link>
      <description>Hi Jon,&lt;BR /&gt;&lt;BR /&gt;Of cause this is unexpected behavior. It's very difficult to identify the reason of such perfomance degradation. We will try to reproduce the issue on our servers and understand the reason (if it's reproducable).&lt;BR /&gt;Have you tied to use C# (or C++) instead of F#? Does F# use its own mechanism (library) to create threads?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt; Dmitry&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2011 08:44:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763269#M19</guid>
      <dc:creator>Dmitry_K_Intel2</dc:creator>
      <dc:date>2011-04-18T08:44:57Z</dc:date>
    </item>
    <item>
      <title>Using Intel MPI from .NET</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763270#M20</link>
      <description>Hi Dmitry,&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;I have gathered some more information. The problem only manifests when using the MPI_THREAD_MULTIPLE setting (to allow arbitrarily multi-threaded programs) and not when the program only makes calls from a single thread.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;However, I have worked around the problem by creating an MPI thread, initializing with MPI_THREAD_SERIALIZED and going into an infinite loop sending messages back and forth between the two machines as fast as possible, feeding sends from a concurrent queue (sending dummy data is no real data is available) and posting received data back to my application. This way any thread can send data by enqueuing it and incoming messages can be received in any way. The performance is great in my test code, I just have to graft the new code into my production system now...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;The F# standard library creates threads indirectly but only using ordinary .NET calls. I was using asynchronous agents to send and receive data over MPI.&lt;/SPAN&gt;Here's the code I was using:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;DIV id="_mcePaste"&gt;let send =&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let agent = new MailboxProcessor&amp;lt;_&amp;gt;(fun inbox -&amp;gt; async {&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;DIV style="font-family: verdana, sans-serif; padding: 0px; margin: 0px;" id="_mcePaste"&gt;  initialize()&lt;/DIV&gt;  while true do&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    let! (buf : byte []) = inbox.Receive()&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    if buf.Length &amp;gt;= maxSize then&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;     printfn "WARNING: %d-byte message is too long for MPI" buf.Length&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    else&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;     let nativeArray = NativeInterop.PinnedArray.of_array buf&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;     let dst = if rank() = 0 then 1 else 0&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;     Internal.send(nativeArray.Ptr, buf.Length, Internal.MPI_BYTE, dst, 0, Internal.MPI_COMM_WORLD) |&amp;gt; check&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; })&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; agent.Start()&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; agent.Post&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;let receive =&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let buf = Array.create maxSize 0uy&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let nativeBuf = NativeInterop.PinnedArray.of_array buf&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let status = [|Internal.MPI_Status()|]&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let nativeStatus = NativeInterop.PinnedArray.of_array status&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; let queue = System.Collections.Concurrent.ConcurrentQueue&amp;lt;_&amp;gt;()&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; async {&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;DIV style="font-family: verdana, sans-serif; padding: 0px; margin: 0px;" id="_mcePaste"&gt;  initialize()&lt;/DIV&gt;  while true do&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    Internal.recv(nativeBuf.Ptr, buf.Length, Internal.MPI_BYTE, Internal.MPI_ANY_SOURCE, Internal.MPI_ANY_TAG, Internal.MPI_COMM_WORLD, nativeStatus.Ptr) |&amp;gt; check&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    let buf = Array.sub buf 0 status.[0].count&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;    queue.Enqueue buf&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; } |&amp;gt; Async.Start&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; queue&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;My "send" is an asynchronous agent that serializes messages posted to it from any thread and sends them over MPI. My "receive" is an infinite loop that sits in a thread on the thread pool waiting for any message to be received. Note that this means there will be a call to "MPI_Recv" blocking one thread while another thread is calling "MPI_Send".&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;Jon.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Apr 2011 09:40:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763270#M20</guid>
      <dc:creator>Jon_Harrop</dc:creator>
      <dc:date>2011-04-18T09:40:23Z</dc:date>
    </item>
    <item>
      <title>Using Intel MPI from .NET</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763271#M21</link>
      <description>Hi Jon,&lt;BR /&gt;&lt;BR /&gt;We've checked performance of mt version of the Intel MPI Library and it's just a bit (&amp;lt;10% for some message sizes) slower than single thread version. &lt;BR /&gt;You can check performance by yourself starting IMB from the installation package.&lt;BR /&gt;If IMB shows comparable performance of 2 libraries than probably means that's something wrong in F#'s MPI wrappers.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt; Dmitry&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Apr 2011 10:12:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763271#M21</guid>
      <dc:creator>Dmitry_K_Intel2</dc:creator>
      <dc:date>2011-04-21T10:12:29Z</dc:date>
    </item>
    <item>
      <title>Using Intel MPI from .NET</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763272#M22</link>
      <description>Hi Jon,&lt;BR /&gt;&lt;BR /&gt;Could you please submit a tracker at premier.intel.com&lt;BR /&gt;In this case I'll be able to upload an engineering version of the Intel MPI Library to check the performance issue.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt; Dmitry&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Apr 2011 13:22:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Using-Intel-MPI-from-NET/m-p/763272#M22</guid>
      <dc:creator>Dmitry_K_Intel2</dc:creator>
      <dc:date>2011-04-29T13:22:21Z</dc:date>
    </item>
  </channel>
</rss>

