When I do matrix multiplication ( C# ), the problem : System.OutOfMemoryException” MathNet.Numerics.dll happens. The equation I use can be simplified as C=AB , where A is a double matrix of 5000 * 2000 and B is a double matrix of 2000 * 3000. I know the matrix is very large, but I do need to do the calculation. How can I solve this problem?
These matrices would need 76, 45 and 114 MB of RAM for A, B and C, so this in itself should not cause much problems (but is large enough that you may want to enable the Intel MKL native provider to do the computations).
Is this a forced 64 bit process (i.e. not AnyCPU or x86)?
Thank you for your kind help.
I was wrote a program (C#) on a 32-bit operating system, so the memory need is not only for the three matrices A, B and C I pointed.
I know the matrix is large and the computation need a lot of time. I want to know if there are some ways to extend the memory of MathNet.Numerics.dll when do computation of large matrices?
Math.NET Numerics does not limit itself in any way in how much memory it can consume. That is controlled entirely by the .NET runtime and the operating system.
If you are on .Net 4.5.1 or higher you could maybe try to compact the LOH by calling the following once before doing the multiplication:
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect();
I got Out of Memory problem with Mono + Math.NET when I tried create a dense 270k x 300 matrix (I already have others matrices created). I tried in Ubuntu with 64gb ram and MacOS with 16gb, both with Mono 4.6.2 using Mono/.Net 4.5.
CreateMatrix.Dense (27000 x 270000)
Do you know why this Out of Memory problem occurs?