<?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: Thread safety of a third party DLL in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959007#M5281</link>
    <description>&lt;P&gt;Henry,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Consider&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;The above is a storage conflict. What you might want is&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt;!$OMP MASTER&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt;!$OMP END MASTER&lt;/P&gt;
&lt;P&gt;!$OMP BARRIER&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt;!$OMP BARRIER&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The above is simplified and should be examined for usefulness&lt;/P&gt;
&lt;DIV&gt;Jim Dempsey&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 08 Dec 2005 05:38:19 GMT</pubDate>
    <dc:creator>jim_dempsey</dc:creator>
    <dc:date>2005-12-08T05:38:19Z</dc:date>
    <item>
      <title>Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959005#M5279</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT face="Times New Roman" color="blue" size="3"&gt;&lt;SPAN&gt;Interested in finding if your third party DLL is thread safe? See &lt;A href="http://www.intel.com/support/performancetools/sb/CS-021533.htm" target="_blank"&gt;http://www.intel.com/support/performancetools/sb/CS-021533.htm&lt;/A&gt;for details. New features will be highlighted on the product support pages regularly. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT color="blue"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" color="blue" size="3"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman" size="3"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2005 09:15:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959005#M5279</guid>
      <dc:creator>Shwetha_D_Intel</dc:creator>
      <dc:date>2005-12-06T09:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959006#M5280</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;This is a useful essay but I have a couple of minor comments. First, the DLL source codeshould show where the gPrimesFound variable is declared. Second, the statement "If Intel Thread Checker identifies issues...this indicates the dll is not threadsafe" is a little overstated. Consider the following function:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;static int var;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face="Courier New"&gt;void InitOnce ()&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New"&gt; var = 0;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If the function &lt;FONT face="Courier New"&gt;InitOnce&lt;/FONT&gt; is added to the DLL and called from the OpenMP parallel region, Intel Thread Checker will report a write/write storage conflict on the variable &lt;FONT face="Courier New"&gt;var&lt;/FONT&gt;. This is a legitimate storage conflict but it is benign because all threads initialize &lt;FONT face="Courier New"&gt;var&lt;/FONT&gt; to the same value.&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;I oftensee one-time initializations when I analyze DLL's for threadsafety. I usually have the DLL source code so I know that this type of storage conflict can be ignored. Without source code, I have no way of knowing if the storage conflicts reported by Thread Checker are serious or benign so I have to err on the side of caution and not call the DLL with multiple threads.&lt;/P&gt;
&lt;P&gt;Henry&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Dec 2005 03:38:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959006#M5280</guid>
      <dc:creator>Henry_G_Intel</dc:creator>
      <dc:date>2005-12-08T03:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959007#M5281</link>
      <description>&lt;P&gt;Henry,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Consider&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;The above is a storage conflict. What you might want is&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt;!$OMP MASTER&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt;!$OMP END MASTER&lt;/P&gt;
&lt;P&gt;!$OMP BARRIER&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;!$OMP PARALLEL&lt;/P&gt;
&lt;P&gt; call InitOnce()&lt;/P&gt;
&lt;P&gt;!$OMP BARRIER&lt;/P&gt;
&lt;P&gt; call DoSomethingThatModifiesVar()&lt;/P&gt;
&lt;P&gt;!$OMP END PARALLEL&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The above is simplified and should be examined for usefulness&lt;/P&gt;
&lt;DIV&gt;Jim Dempsey&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Dec 2005 05:38:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959007#M5281</guid>
      <dc:creator>jim_dempsey</dc:creator>
      <dc:date>2005-12-08T05:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959008#M5282</link>
      <description>&lt;P&gt;I forgot to add...&lt;/P&gt;
&lt;P&gt;If "var" is in a module that is part of the DLL then if two applications share the DLL the 2nd app could possibly reset "var" after the 1st app has modifyed it past 0.&lt;/P&gt;
&lt;P&gt;If "var" is in the calling app's address space then there would be no conflict provided the InitVar was called once and before var is used.&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Dec 2005 05:43:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959008#M5282</guid>
      <dc:creator>jim_dempsey</dc:creator>
      <dc:date>2005-12-08T05:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959009#M5283</link>
      <description>&lt;P&gt;Jim,&lt;/P&gt;
&lt;P&gt;You're correct that initializing variables in a parallel region then modifying those variables can result in potentially serious storage conflicts. However, I was trying to illustrate that not all storage conflicts reported by Thread Checker are serious. One-time initializationsoften fall into the category of real yet benign conflicts.&lt;/P&gt;
&lt;DIV&gt;Henry&lt;/DIV&gt;</description>
      <pubDate>Fri, 09 Dec 2005 06:11:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959009#M5283</guid>
      <dc:creator>Henry_G_Intel</dc:creator>
      <dc:date>2005-12-09T06:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Thread safety of a third party DLL</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959010#M5284</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Henry -&lt;/P&gt;
&lt;P&gt;Perhaps amore realistic example of a benign data contention would be using a shared variable to signal that a condition has been met, e.g., threads searching for the same item in a data set and two threads find the desired item within their assigned subset. If more than one thread determines that the condition has been met, they could both set the variable to the same value as the signal.&lt;/P&gt;
&lt;DIV&gt;--clay&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Dec 2005 05:50:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Thread-safety-of-a-third-party-DLL/m-p/959010#M5284</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2005-12-23T05:50:44Z</dc:date>
    </item>
  </channel>
</rss>

