Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Changing the first OpenMP loop from 1000000 to 2000000 will cause the same error. This indicates that the out of memory problem is with OpenMP stack limit.</p> <p>Try setting the OpenMP stack limit to unlimit in bash with</p> <pre><code>ulimit -s unlimited </code></pre> <p>You can also change the OpenMP environment variable OMP_STACKSIZE and setting it to 100MB or more.</p> <p>UPDATE 1: I change the first loop to</p> <pre><code>{ std::vector&lt;std::vector&lt;int*&gt; &gt; nts(100); #pragma omp for schedule(static) ordered for(int begin = 0; begin &lt; int(nts.size()); ++begin) { for(int i = 0; i &lt; 2000000; ++i) { nts[begin].push_back(new int(5)); } } std::cout &lt;&lt; " pre delete " &lt;&lt; std::endl; for(int begin = 0; begin &lt; int(nts.size()); ++begin) { for(int j = 0; j &lt; nts[begin].size(); ++j) { delete nts[begin][j] } } } </code></pre> <p>Then, I get a memory error at i=1574803 on the Main thread.</p> <p>UPDATE 2: If you are using the Intel compiler, you can add the following to the top of your code and it will solve the problem (providing you have enough memory for the extra overhead).</p> <pre><code>std::cout &lt;&lt; "Previous stack size " &lt;&lt; kmp_get_stacksize_s() &lt;&lt; std::endl; kmp_set_stacksize_s(1000000000); std::cout &lt;&lt; "Now stack size " &lt;&lt; kmp_get_stacksize_s() &lt;&lt; std::endl; </code></pre> <p>UPDATE 3: For completeness, like mentioned by another member, if you are performing some numerical computation, it is best to preallocate everything in a single <strong>new float[1000000]</strong> instead of using OpenMP to do 1000000 allocations. This applies to allocating objects as well.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload