<?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 Insufficient virtual memory in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024824#M19836</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm using MKL pardiso on a 64-bit Windows 7 machine with 32 GB of RAM.&amp;nbsp; I am running a solver using backward Euler, with a steadily increasing number of variables.&amp;nbsp; When the sparse matrix that I'm inverting gets to about 600x600 the program crashes with the "Insufficient virtual memory" message.&amp;nbsp; This is not a problem with any of the memory that I control directly - I am careful about deallocating after allocating.&amp;nbsp; This is recent a MKL - with IVF Composer XE 2013.&lt;/P&gt;

&lt;P&gt;I am using OpenMP, and the crash occurs with ncpu = 8.&lt;/P&gt;

&lt;P&gt;I don't understand why the program needs virtual memory anyway - at the peak the total memory usage reported by Task Manager is less than 7 GB.&lt;/P&gt;

&lt;P&gt;Since I have just started using MKL and pardiso I will not be surprised to learn that I am missing something simple.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Gib&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 17 Aug 2014 09:44:36 GMT</pubDate>
    <dc:creator>Gib_B_</dc:creator>
    <dc:date>2014-08-17T09:44:36Z</dc:date>
    <item>
      <title>Insufficient virtual memory</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024824#M19836</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm using MKL pardiso on a 64-bit Windows 7 machine with 32 GB of RAM.&amp;nbsp; I am running a solver using backward Euler, with a steadily increasing number of variables.&amp;nbsp; When the sparse matrix that I'm inverting gets to about 600x600 the program crashes with the "Insufficient virtual memory" message.&amp;nbsp; This is not a problem with any of the memory that I control directly - I am careful about deallocating after allocating.&amp;nbsp; This is recent a MKL - with IVF Composer XE 2013.&lt;/P&gt;

&lt;P&gt;I am using OpenMP, and the crash occurs with ncpu = 8.&lt;/P&gt;

&lt;P&gt;I don't understand why the program needs virtual memory anyway - at the peak the total memory usage reported by Task Manager is less than 7 GB.&lt;/P&gt;

&lt;P&gt;Since I have just started using MKL and pardiso I will not be surprised to learn that I am missing something simple.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Gib&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Aug 2014 09:44:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024824#M19836</guid>
      <dc:creator>Gib_B_</dc:creator>
      <dc:date>2014-08-17T09:44:36Z</dc:date>
    </item>
    <item>
      <title>If you have statically</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024825#M19837</link>
      <description>&lt;P&gt;If you have statically allocated array(s) try to increase thread's stack size maybe up to 1GB. I suppose that your thread is using default stack size 1MB. For more in depth troubleshooting please use VMmap and RAMmap tools.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms686774(v=vs.85).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686774(v=vs.85).aspx&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Aug 2014 17:35:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024825#M19837</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2014-08-17T17:35:47Z</dc:date>
    </item>
    <item>
      <title>How does one set thread stack</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024826#M19838</link>
      <description>&lt;P&gt;How does one set thread stack size in Fortran?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Aug 2014 20:46:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024826#M19838</guid>
      <dc:creator>Gib_B_</dc:creator>
      <dc:date>2014-08-17T20:46:02Z</dc:date>
    </item>
    <item>
      <title>I found the /F command-line</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024827#M19839</link>
      <description>&lt;P&gt;I found the /F command-line option for setting stack size, and used /F0x100000000.&amp;nbsp; The program crashes at the same points.&amp;nbsp; I should mention that the Fortran code is built as a DLL.&amp;nbsp; Is the stack size to be set in the DLL build, or in the calling program build?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have now seen that the stack size can be set in the IDE via Properties &amp;gt; Linker &amp;gt; System &amp;gt; Stack Reserve Size and &amp;gt; Stack Commit Size.&amp;nbsp; It is not clear which should be set, so I have set both to 0x10000000, which seems to be the maximum permitted for 32-bit operation.&amp;nbsp; This I did in both the DLL build and the main program build.&amp;nbsp; In any case, it made no difference - the program still crashes in the same way.&lt;/P&gt;

&lt;P&gt;I'm starting to get the impression that the documentation for MKL, or for pardiso anyway, leaves something to be desired.&amp;nbsp; Surely it should not be such trouble to find out how to execute what is a rather small problem case.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 00:36:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024827#M19839</guid>
      <dc:creator>Gib_B_</dc:creator>
      <dc:date>2014-08-18T00:36:49Z</dc:date>
    </item>
    <item>
      <title>I suggest that the Fortran</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024828#M19840</link>
      <description>&lt;P&gt;I suggest that the Fortran runtime error messages be taken with a bit of skepticism. Even with 32-bit code on a 32-bit OS, a &lt;STRONG&gt;dense &lt;/STRONG&gt;600 X 600 matrix would occupy 2.88 megabytes, so there should be no memory problems on your system. I have run Pardiso-32-bit on matrices that were much larger.&lt;/P&gt;

&lt;P&gt;If there is a mismatch between 4-byte integers and 8-byte integers exchanged between your program and MKL, strange error messages are to be expected.&lt;/P&gt;

&lt;P&gt;Is is feasible for you post a reproducer with a statement of the compiler options used, or at least a description of the &amp;nbsp;arguments passed to Pardiso?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 01:28:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024828#M19840</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-08-18T01:28:53Z</dc:date>
    </item>
    <item>
      <title>I agree, it makes no sense. </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024829#M19841</link>
      <description>&lt;P&gt;I agree, it makes no sense.&amp;nbsp; I'll try to set up a simple example.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 01:34:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024829#M19841</guid>
      <dc:creator>Gib_B_</dc:creator>
      <dc:date>2014-08-18T01:34:37Z</dc:date>
    </item>
    <item>
      <title>I first played with a simple</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024830#M19842</link>
      <description>&lt;P&gt;I first played with a simple program to test my matrix inversion subroutine, which uses pardiso.&amp;nbsp; I found that with /Qmkl:parallel I can invert a 4000x4000 sparse matrix.&amp;nbsp; With Qmkl:sequential I can go to 5000x5000.&amp;nbsp; So there seems to be no problem with my pardiso code.&amp;nbsp; As far as I can see the compiler settings are the same as in my real program.&amp;nbsp; The only obvious difference is that I am invoking the inversion code repeatedly in the real program, which suggests that some memory is not getting freed.&amp;nbsp; I can't see that anywhere in my code, but I will search more closely.&amp;nbsp; Here is my subroutine (REAL_KIND is double precision):&lt;/P&gt;

&lt;P&gt;module pardiso_mod&lt;BR /&gt;
	use csr_mod&lt;BR /&gt;
	use MKL_PARDISO&lt;BR /&gt;
	implicit none&lt;/P&gt;

&lt;P&gt;contains&lt;/P&gt;

&lt;P&gt;subroutine invert(A,N,Ainv,res)&lt;BR /&gt;
	real(REAL_KIND) :: A(N,N), Ainv(N,N)&lt;BR /&gt;
	integer :: N, res&lt;BR /&gt;
	TYPE(MKL_PARDISO_HANDLE), allocatable :: PT(:)&lt;BR /&gt;
	integer, allocatable :: perm(:), ivect(:), jvect(:)&lt;BR /&gt;
	real(REAL_KIND), allocatable :: b(:), x(:), AS(:)&lt;BR /&gt;
	INTEGER :: maxfct, mnum, mtype, phase, nrhs, msglvl, i, j, k&lt;BR /&gt;
	INTEGER :: iparm(64)&lt;BR /&gt;
	integer :: NN, NE, err&lt;/P&gt;

&lt;P&gt;maxfct = 1&lt;BR /&gt;
	mnum = 1&lt;BR /&gt;
	nrhs = N&amp;nbsp;&amp;nbsp;&amp;nbsp; ! matrix inversion&lt;BR /&gt;
	NN = N*N&lt;/P&gt;

&lt;P&gt;allocate( PT(64), perm(N), b(nrhs*N), x(nrhs*N), AS(NN), ivect(NN), jvect(NN) )&lt;BR /&gt;
	! ivect(:) is row_index(:)&lt;BR /&gt;
	! jvect(:) is col_index(:)&lt;BR /&gt;
	&amp;nbsp;&lt;BR /&gt;
	do i = 1, 64&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; iparm(i) = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; PT(i)%DUMMY = 0&lt;BR /&gt;
	end do&lt;BR /&gt;
	iparm(1) = 0 ! solver default&lt;/P&gt;

&lt;P&gt;err = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; ! initialize error flag&lt;BR /&gt;
	msglvl = 0 ! 1 = print statistical information&lt;BR /&gt;
	mtype = 11 ! real unsymmetric&lt;BR /&gt;
	phase = 13 ! solve&lt;/P&gt;

&lt;P&gt;call to_csr3_1(A,N,NN,AS,ivect,jvect,NE,err)&amp;nbsp; ! 1-based&lt;BR /&gt;
	if (err /= 0) then&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; deallocate(PT, perm, b, x, AS, ivect, jvect)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res = 1&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;BR /&gt;
	endif&lt;/P&gt;

&lt;P&gt;b = 0&lt;BR /&gt;
	do i = 1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; b(i+(i-1)*N) = 1&lt;BR /&gt;
	enddo&lt;BR /&gt;
	err = 0&lt;BR /&gt;
	CALL pardiso (PT, maxfct, mnum, mtype, phase, N, AS, ivect, jvect, perm, nrhs, iparm, msglvl, b, x, err)&lt;BR /&gt;
	if (err /= 0) then&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; deallocate(PT, perm, b, x, AS, ivect, jvect)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res = 2&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;BR /&gt;
	endif&lt;/P&gt;

&lt;P&gt;k = 0&lt;BR /&gt;
	do j = 1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = k+1&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ainv(i,j) = x(k)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; enddo&lt;BR /&gt;
	enddo&lt;BR /&gt;
	deallocate(PT, perm, b, x, AS, ivect, jvect)&lt;BR /&gt;
	res = 0&lt;BR /&gt;
	end subroutine&lt;/P&gt;

&lt;P&gt;end module&lt;/P&gt;

&lt;P&gt;......&lt;/P&gt;

&lt;P&gt;&amp;lt;ahem&amp;gt; You will have noticed the lack of a call to pardiso with phase = -1 at the conclusion.&amp;nbsp; This I was unaware of, and now that I have added it I find that my program is running past the point where it was crashing.&amp;nbsp; In other words, it seems to be a case of RTFM :(&lt;/P&gt;

&lt;P&gt;Thanks for your help :)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 02:50:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024830#M19842</guid>
      <dc:creator>Gib_B_</dc:creator>
      <dc:date>2014-08-18T02:50:18Z</dc:date>
    </item>
    <item>
      <title>Your analysis is plausible.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024831#M19843</link>
      <description>&lt;P&gt;Your analysis is plausible. Each call of your subroutine caused Pardiso to leak a little molehill of memory, but that would go unnoticed before you had made hundreds or thousands of calls and the accumulated leaked memory &amp;nbsp;then amounted to a mountain, and the OS finally took notice.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 03:59:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024831#M19843</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-08-18T03:59:17Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;&gt;Is the stack size to be</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024832#M19844</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;Is the stack size to be set in the DLL build, or in the calling program build?&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;

&lt;P&gt;Probably program build.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2014 05:25:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Insufficient-virtual-memory/m-p/1024832#M19844</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2014-08-18T05:25:24Z</dc:date>
    </item>
  </channel>
</rss>

