Sharing large .mat files by placing them in /dev/shm
3 views (last 30 days)
Show older comments
I have mat files on a server that are used by many standalone exes. Currently, each exe loads the .mat files from disk whenever they're called. The problem is that loading the files take a long time and each time the exe gets called it loads them again. Is it possible to make these mat files available in /dev/shm (in RAM) and load them from there? If so, when I load them from /dev/shm, will the load() call place them in RAM in a different location? I.e., will Matlab think it's loading them from disk and duplicate the .mat files in ram or will it recognize that they're already in memory?
0 Comments
Accepted Answer
Ken Atwell
on 10 Apr 2014
MATLAB would load the contents of the MAT-File into a new location as part of your workspace. The binary representation of a MAT-File is very different from MATLAB's in-memory representation, so MATLAB cannot treat a MAT-File on a RAM disk as-if it was a workspace variable.
If you have not done so already, check out the MATLAB doc section on memory mapping; you will need to save your data in a raw format (not a MAT-File), but you may be able to use memory-mapped data this to reduce the number of loads and/or the number of copies existing simultaneously in memory.
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Code Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!