<?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 allocate array in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786414#M319</link>
    <description>&lt;P&gt;In a parallel region, there are several ALLOCATE statements, the questions is do we need to enclosethese statementswith OMP Critical directives explicitly,without the Critical directives, arethe statementsexecuted in a critical session? &lt;BR /&gt;&lt;BR /&gt;I have seen some strange errors with the ALLOCATE function, sometimes the functions return the error of #41, insufficient virtual memory, though the allocated space is not big.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2011 13:54:25 GMT</pubDate>
    <dc:creator>stydofe1</dc:creator>
    <dc:date>2011-07-20T13:54:25Z</dc:date>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786414#M319</link>
      <description>&lt;P&gt;In a parallel region, there are several ALLOCATE statements, the questions is do we need to enclosethese statementswith OMP Critical directives explicitly,without the Critical directives, arethe statementsexecuted in a critical session? &lt;BR /&gt;&lt;BR /&gt;I have seen some strange errors with the ALLOCATE function, sometimes the functions return the error of #41, insufficient virtual memory, though the allocated space is not big.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 13:54:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786414#M319</guid>
      <dc:creator>stydofe1</dc:creator>
      <dc:date>2011-07-20T13:54:25Z</dc:date>
    </item>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786415#M320</link>
      <description>If you're allocating a shared data region, and can't do it outside the parallel region, I suppose (if OpenMP) you would use omp single. I'd be concerned about critical being slow. But I'm probably not answering your question. &lt;BR /&gt;If allocating a private data region, I would think you could let each thread do its own allocation.&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jul 2011 18:13:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786415#M320</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2011-07-20T18:13:19Z</dc:date>
    </item>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786416#M321</link>
      <description>&lt;P&gt;Thanks for your reply. I am allocating a private data region, in particular, the data region for allocatable arrays is allocated in the routines that are called by the statements within the parallel region, they are temporary arrays in the routines. I agree with you that each thread does its own allocation, and each thread should have its own copies of these allocatalbe variables, while thread data sharing detection monitor detects the variables being accessed by multiple threads. I understand that these messages do not indicate errors, but sometimes the program has trouble allocating data space for these allocatable arrays due to insufficient virtual memory problem.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2011 20:29:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786416#M321</guid>
      <dc:creator>stydofe1</dc:creator>
      <dc:date>2011-07-20T20:29:58Z</dc:date>
    </item>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786417#M322</link>
      <description>If the allocation (or other) is once-only you can also use something like this&lt;BR /&gt;&lt;BR /&gt;if(.not. allocated(YourArray)) then&lt;BR /&gt;!$omp critical(critical_allocate_YourArray)&lt;BR /&gt;if(.not. allocated(YourArray)) then&lt;BR /&gt; allocate(YourArray(YourSize(s)))&lt;BR /&gt;endif&lt;BR /&gt;!$omp end critical(critical_allocate_YourArray)&lt;BR /&gt;do while((.not. allocated(YourArray))&lt;BR /&gt; call sleepqq(0)&lt;BR /&gt;end do&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;The above avoids a barrier when it is not needed.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Wed, 20 Jul 2011 20:31:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786417#M322</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2011-07-20T20:31:18Z</dc:date>
    </item>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786418#M323</link>
      <description>Because these routines are called N times, where N is the number of Do loop iterations, these arrays will be allocated and deallocated N times, I would like to avoid using Critical directive. Since they are just local arrays to the routines, each thread should execute its own copies of the routines and do its own allocation. The program should work just fine without defining these allocate statements in critical region, why the programs always crash when trying to allocate the arrays?</description>
      <pubDate>Thu, 21 Jul 2011 15:53:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786418#M323</guid>
      <dc:creator>stydofe1</dc:creator>
      <dc:date>2011-07-21T15:53:25Z</dc:date>
    </item>
    <item>
      <title>allocate array</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786419#M324</link>
      <description>When the arrays are large (.gt. 100KB), you should not allocate them off the stack. Stack space is a limited resource on some operating systems. While you can specify largerstack size, the heap or static arrays are more suitable alternatives. Note, the sum total of static data is limited to 2GB.&lt;BR /&gt;&lt;BR /&gt;You have a valid concern.&lt;BR /&gt;&lt;BR /&gt;For &lt;EM&gt;shared&lt;/EM&gt; arrays, consider making the large shared array SAVE'd (and allocate it once). The code I provided earlier would perform the allocation once, enter critical section once by the allocating threadand potentially enter the critical section once by the other threads. Subsequent to the first call the critical section is bypassed.&lt;BR /&gt;&lt;BR /&gt;As (?) TimP pointed out, you could "lift" the allocation outside the parallel region then pass in the array by reference on the CALL's issued within the parallel region.&lt;BR /&gt;&lt;BR /&gt;How do you multi-thread and not allocate large &lt;EM&gt;private&lt;/EM&gt; arrays N times when calling a subroutine N times?&lt;BR /&gt;&lt;BR /&gt;A way to do this is to use(static) thread private allocatable arrays&lt;BR /&gt;&lt;BR /&gt;IOW each thread has its own thread private array descriptor that they allocate from the heap once.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Fri, 22 Jul 2011 12:39:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/allocate-array/m-p/786419#M324</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2011-07-22T12:39:33Z</dc:date>
    </item>
  </channel>
</rss>

