<?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 Vector size 10 000 000 memory problem in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810262#M3808</link>
    <description>Thank you very much for your comments.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I use the Intel Fortran 11 compiler with the MKL 10.3.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I run the x86_64 bit architecture on MAC OS X 10.6.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The processor is 2.13 GHZ Intel Core 2 Duo and memory 4GB 1067 MHZ&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I compute the Theil index, which is a concentration measure similar to the Gini coefficient.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I wrote a Theil function to compute the concentration index of the rev variable, which is a vector with sizeNNUm = 1 000 000 (in the ideal case higher, i.e. 10 000 000)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;!============================================================================&lt;/P&gt;
&lt;P&gt;function Theil(rev,NNum) result(T)&lt;/P&gt;
&lt;P&gt;	integer, intent(in) :: NNum&lt;/P&gt;&lt;P&gt;real rev(NNum)&lt;/P&gt;
&lt;P&gt;	real ts(NNum), AS(NNum) &lt;/P&gt;
&lt;P&gt;	real T, mean, nnul&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;AS=0&lt;/P&gt;&lt;P&gt;ts=0&lt;/P&gt;&lt;P&gt;nnul=0&lt;/P&gt;
&lt;P&gt;	do i=1,NNum&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;AS(i)=rev(i)&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;if (AS(i).gt.0) then&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;		&lt;/SPAN&gt;nnul=nnul+1 ! Count number of products&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;end if		&lt;/P&gt;
&lt;P&gt;	end do	&lt;/P&gt;
&lt;P&gt;!  Compute the mean&lt;/P&gt;
&lt;P&gt;	mean = sum(AS)/(max(1,nnul))&lt;/P&gt;
&lt;P&gt;!  Initialize Theil index&lt;/P&gt;
&lt;P&gt;	T=0&lt;/P&gt;
&lt;P&gt;	ts=0&lt;/P&gt;
&lt;P&gt;!  Calcuate the summation values&lt;/P&gt;
&lt;P&gt;	do k=1,NNum&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;if (AS(k).ne.0)then&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;ts(k) = (AS(k)/mean)*(log(AS(k)/mean))&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;end if&lt;/P&gt;
&lt;P&gt;end do &lt;/P&gt;
&lt;P&gt;	T=sum(ts)/(max(1,nnul))&lt;/P&gt;
&lt;P&gt;end function Theil&lt;/P&gt;&lt;P&gt;!============================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 15 Feb 2012 13:19:30 GMT</pubDate>
    <dc:creator>steingre</dc:creator>
    <dc:date>2012-02-15T13:19:30Z</dc:date>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810259#M3805</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I create a vector of size 10 million and I need to compute a distribution statistic from the numbers.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Once I call the function I wrote I get the following error message:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Program received signal: EXC_BAD_ACCESS.&lt;/P&gt;&lt;P&gt;sharedlibrary apply-load-rules all&lt;/P&gt;
&lt;P&gt;No memory available to program now: unsafe to call malloc&lt;/P&gt;
&lt;P&gt;Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot access memory at address 0x7fff5afb3618)&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Does that mean that fortran cannot handle the vector size? Do you have an idea of how I might be able to solve the problem? However, I do need the 10 million values in the vector to compute my summary statistic.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;If I do the same calculations with vector size 100 000 everything works fine.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I appreciate any help!&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Best,&lt;/DIV&gt;&lt;DIV&gt;steingre&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Feb 2012 14:41:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810259#M3805</guid>
      <dc:creator>steingre</dc:creator>
      <dc:date>2012-02-14T14:41:37Z</dc:date>
    </item>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810260#M3806</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;This looks a general program problem, other than specific MKL question. When I tested some simple code, it looks that such size of malloc could work well. I just test with the following code:&lt;/P&gt;&lt;P&gt;program test_malloc&lt;BR /&gt; integer i&lt;BR /&gt; real*8 x(*)&lt;BR /&gt; pointer(ptr_x,x)&lt;BR /&gt; i=80000000&lt;BR /&gt; ptr_x = malloc(i)&lt;BR /&gt;print *, ptr_x&lt;BR /&gt;end program test_malloc&lt;/P&gt;&lt;P&gt;In your code, does it have other large memory allocation, which already uses most of the memory space? Also is it a 64 bit application, or 32 bit?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Chao&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2012 07:38:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810260#M3806</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2012-02-15T07:38:31Z</dc:date>
    </item>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810261#M3807</link>
      <description>&lt;P&gt;Hello Steingre,&lt;/P&gt;&lt;P&gt;In addition to answers to Chao's questions if you could provide additional details, it would help us tobetter understand the issue you communicate and ways for its resolution:&lt;/P&gt;&lt;P&gt;1. your environment: OS, Fortran (compiler) version,CPU,its mode, IA-32 or Intel 64, Intel MKL version&lt;/P&gt;&lt;P&gt;2. compiler switches you use to build the application&lt;/P&gt;&lt;P&gt;3. short description of the computations you do (for example, compute mean and variance for a dataset of 1 million double precision numbers). If you could provide a short test case that would be even perfect.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Andrey&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2012 08:17:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810261#M3807</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2012-02-15T08:17:13Z</dc:date>
    </item>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810262#M3808</link>
      <description>Thank you very much for your comments.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I use the Intel Fortran 11 compiler with the MKL 10.3.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I run the x86_64 bit architecture on MAC OS X 10.6.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The processor is 2.13 GHZ Intel Core 2 Duo and memory 4GB 1067 MHZ&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I compute the Theil index, which is a concentration measure similar to the Gini coefficient.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I wrote a Theil function to compute the concentration index of the rev variable, which is a vector with sizeNNUm = 1 000 000 (in the ideal case higher, i.e. 10 000 000)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;!============================================================================&lt;/P&gt;
&lt;P&gt;function Theil(rev,NNum) result(T)&lt;/P&gt;
&lt;P&gt;	integer, intent(in) :: NNum&lt;/P&gt;&lt;P&gt;real rev(NNum)&lt;/P&gt;
&lt;P&gt;	real ts(NNum), AS(NNum) &lt;/P&gt;
&lt;P&gt;	real T, mean, nnul&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;AS=0&lt;/P&gt;&lt;P&gt;ts=0&lt;/P&gt;&lt;P&gt;nnul=0&lt;/P&gt;
&lt;P&gt;	do i=1,NNum&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;AS(i)=rev(i)&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;if (AS(i).gt.0) then&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;		&lt;/SPAN&gt;nnul=nnul+1 ! Count number of products&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;end if		&lt;/P&gt;
&lt;P&gt;	end do	&lt;/P&gt;
&lt;P&gt;!  Compute the mean&lt;/P&gt;
&lt;P&gt;	mean = sum(AS)/(max(1,nnul))&lt;/P&gt;
&lt;P&gt;!  Initialize Theil index&lt;/P&gt;
&lt;P&gt;	T=0&lt;/P&gt;
&lt;P&gt;	ts=0&lt;/P&gt;
&lt;P&gt;!  Calcuate the summation values&lt;/P&gt;
&lt;P&gt;	do k=1,NNum&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;if (AS(k).ne.0)then&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;ts(k) = (AS(k)/mean)*(log(AS(k)/mean))&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="white-space: pre;"&gt;	&lt;/SPAN&gt;end if&lt;/P&gt;
&lt;P&gt;end do &lt;/P&gt;
&lt;P&gt;	T=sum(ts)/(max(1,nnul))&lt;/P&gt;
&lt;P&gt;end function Theil&lt;/P&gt;&lt;P&gt;!============================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Feb 2012 13:19:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810262#M3808</guid>
      <dc:creator>steingre</dc:creator>
      <dc:date>2012-02-15T13:19:30Z</dc:date>
    </item>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810263#M3809</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;As Chao mentioned thisissue looks like general and is not related to the Intel Math Kernel Library.&lt;BR /&gt;There are several visible options to resolve issue of big arrays in your application:&lt;BR /&gt;1.The first, malloc basedoption is suggested earlier by Chao&lt;BR /&gt;&lt;BR /&gt;2. You also might want to try compiler switch -heap-arrays n whichhelps to allocate arrays of given minimum size n in kilobytes in heap memory, not on stack.&lt;BR /&gt;&lt;BR /&gt;3. Anotheroption is block-based modification of the algorithm for computation of Theil index. It is based on progressive processing of your dataset: instead of keeping huge arrays in memoryyou might have an array or "window" of the fixed size that well fits to memory (and caches) of your server. This windowmoves over your dataset and allows you to accumulate standartization coefficient/mean estimate/logarithms into temporary arrays of fixed size and variables. Using this option, you would eliminate the need to allocate big arrays in the code.&lt;BR /&gt;&lt;BR /&gt;4.Modification of the option #3which can be based on functionality of Intel Math Kernel Library, in particular, Vectorlogarithmic function and SummaryStatistics algorithm for computation of mean, which might help you to further improve the speed of your application, in addition to vectorization capabilities of Intel Fortran Compiler. Did you try Intel MKL in your code?&lt;BR /&gt;&lt;BR /&gt;Please, letus know if this answers your question.&lt;BR /&gt;Also, please, let me know if you need additional details behind the options above.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andrey&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2012 14:58:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810263#M3809</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2012-02-15T14:58:09Z</dc:date>
    </item>
    <item>
      <title>Vector size 10 000 000 memory problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810264#M3810</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1329318852609="58" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=540914" href="https://community.intel.com/en-us/profile/540914/" class="basic"&gt;steingre&lt;/A&gt;&lt;/DIV&gt;&lt;DIV style="background-color: #e5e5e5; margin-left: 2px; margin-right: 2px; border: 1px inset; padding: 5px;"&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;I create a vector of size 10 million and I need to compute a distribution statistic from the numbers.&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;[SergeyK] It isonly~&lt;STRONG&gt;76MB&lt;/STRONG&gt;! How much memory do you have on a system and how big is a &lt;STRONG&gt;Virtual &lt;/STRONG&gt;&lt;STRONG&gt;Memory&lt;/STRONG&gt; file?&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Does that mean that fortran cannot handle the vector size?&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;[SergeyK] &lt;SPAN style="text-decoration: underline;"&gt;It should work&lt;/SPAN&gt;.On &lt;STRONG&gt;Windows&lt;/STRONG&gt; platforms'&lt;STRONG&gt;malloc&lt;/STRONG&gt;' actuallyuses '&lt;STRONG&gt;HeapAlloc&lt;/STRONG&gt;' &lt;STRONG&gt;Win32&lt;/STRONG&gt; API&lt;BR /&gt;  function and it allows to allocate lots of memory in a single call.&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Do you have an idea of how I might be able to solve the problem?If I do the same calculations with vector size 100 000 everything works fine.&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;[SergeyK]&lt;/DIV&gt;&lt;BR /&gt;A '&lt;STRONG&gt;malloc&lt;/STRONG&gt;' CRT-function allocates memory from the heap. Here are some technical data on some limitations&lt;BR /&gt;from '&lt;STRONG&gt;malloc.h&lt;/STRONG&gt;' header:&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt; ...&lt;BR /&gt; /* Maximum heap request the heap manager will attempt */&lt;/P&gt;&lt;P&gt; #ifdef _WIN64&lt;BR /&gt; #define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0&lt;BR /&gt; #else&lt;BR /&gt; #define _HEAP_MAXREQ 0xFFFFFFE0&lt;BR /&gt; #endif&lt;BR /&gt; ...&lt;BR /&gt;&lt;BR /&gt;As you can see even on a &lt;STRONG&gt;32-bit&lt;/STRONG&gt; system it can allocate big chunks of memory. But, in a&lt;SPAN style="text-decoration: underline;"&gt;real life&lt;/SPAN&gt; situation is&lt;BR /&gt;very different.For example, on a &lt;STRONG&gt;32-bit&lt;/STRONG&gt; system &lt;SPAN style="text-decoration: underline;"&gt;it couldn't allocate more than &lt;STRONG&gt;1.09GB&lt;/STRONG&gt;&lt;/SPAN&gt; in a single call. That&lt;BR /&gt;is really strange and it puzzles me for a long time!&lt;BR /&gt;&lt;BR /&gt;In your case a&lt;STRONG&gt;76MB&lt;/STRONG&gt; of memory blockis well below &lt;STRONG&gt;1.09GB&lt;/STRONG&gt; limit ( a vector of size of ~146,000,000 double-precision elements ).&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Feb 2012 15:40:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Vector-size-10-000-000-memory-problem/m-p/810264#M3810</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2012-02-15T15:40:02Z</dc:date>
    </item>
  </channel>
</rss>

