MATLAB MATLAB - how to increase memory?

Click For Summary
To increase memory available to MATLAB, users can consider upgrading physical RAM or adjusting virtual memory settings, although the latter may slow execution. The discussion highlights a specific issue with a large sparse matrix and its transpose, which requires additional memory that exceeds current limits. Users are advised to optimize code to avoid unnecessary duplication of data, such as referencing elements directly instead of creating a transpose copy. The Parallel Computing Toolbox is suggested for distributing memory load across multiple computers, but concerns remain about data fitting on the main node. Overall, increasing physical memory is the most effective solution for handling large datasets in MATLAB.
mikeph
Messages
1,229
Reaction score
18
Hello,

I have a problem with my code, it uses too much memory. Aside from optimisation of the code (which I am constantly working on), how can I increase the memory which is available to MATLAB?

Code:
>> memory
Maximum possible array:             435 MB (4.564e+008 bytes) *
Memory available for all arrays:    902 MB (9.463e+008 bytes) **
Memory used by MATLAB:              820 MB (8.601e+008 bytes)
Physical Memory (RAM):             1980 MB (2.076e+009 bytes)

*  Limited by contiguous virtual address space available.
** Limited by virtual address space available.

I understand why RAM is limited, but I can't understand in the help file how I can increase the memory used by MATLAB.

I have three matrices in my workspace, two are about 1 MB and the third is huge (it is a sparse double matrix with 30 million elements), about 255 MB. I am trying to implement an algorithm which uses this matrix, and its transpose, and the code always fails when it needs to use the transpose, presumably because it needs another 255 MB to store the result.

But the memory for all arrays is 920 MB , and I have no array which is larger than 435 MB, so I don't understand what is taking up so much space.

Is there a MATLAB command that I can do which effectively says "ok you are allowed to use 1.5 GB of my 1.98 GB physical memory so do whatever you want? Or if this fails, and I buy more RAM, (and apparently you can use a windows switch to increase the max for anyone program from 2 to 3 GB), will it even help my problem?


Thanks for any help,
 
Physics news on Phys.org
Wrichik Basu said:
Use the Parallel Computing Toolbox of Matlab. You'll be able to partition the array into different computers, thereby sharing the memory space.
I'm not sure that this would work. From what I understand of the way Matlab is parallelized, all data will still need to fit on the main node.

Without changing anything to the code, I see two possibilities. The best is to increase the memory on the computer. If that is not possible, it might be possible to increase the amount of virtual memory. The latter would most probably result in a much slower execution, however.
 
The transpose doesn't have any additional information so there isn't really a need to create that second copy of your matrix. Can you rewrite the algorithm to work with just the original matrix, reference A(j,i) when you want the (i,j)-th element of A'?
 
  • Like
Likes Wrichik Basu
DrClaude said:
I'm not sure that this would work. From what I understand of the way Matlab is parallelized, all data will still need to fit on the main node.
It can be done; I had seen someone parallelizing a huge matrix and it's transpose without saving it on the client. But I don't remember how he did it. Very limited resources exist on the net regarding the parallel computing toolbox. I'll try to get hold of the exact code by posting in matlab's community forums.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
793
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 2 ·
Replies
2
Views
3K