MCR_CACHE_ROOT not working with 2016
8 views (last 30 days)
Show older comments
I have a Matlab routine that I have compiled as a standalone executable for use on a Linux computing cluster running PBSPro. There can be thousands of instances running at a time. With version 2012a I found that setting `MCR_CACHE_ROOT=${TMPDIR}` would increase execution speed by an order of magnitude. Our cluster is removing support for some older applications so I am moving to Matlab 2016a with the same code, all that is changing is the compiler version. When I compile the code and set the MCR cache as before I get an error that says
Could not access the MATLAB Runtime component cache
The 2016 version of the code will then proceed to use system RAM until the node is out of memory and the job terminates with a memory failure. If I don't specify an `MCR_CACHE_ROOT` the job runs fine, albeit slowly and then finishes.
The compile command is `mcc -v -o Program -m mFiles`, where `mFiles` is a cell array of files to compile. The only difference is compiler, MCR and corresponding LD_LIBRARY_PATH. I use the exact same compile script with the exact same source.
0 Comments
Answers (1)
Ashish Bhatt
on 25 Nov 2019
When launching or calling the same deployed component, deployed component instances share the same MCR_CACHE_ROOT directory. So if there are multiple instances running at the same time each instance could possibly read/write to the same file in MCR_CACHE_ROOT and end up conflicting. We could set MCR_CACHE_ROOT to a different folder every time when launching the component to avoid crashes due to read/write conflicts.
The deployed component could be a standalone application, .net assembly, python package, JAVA package, c/c++ library... Basically all the outputs of MATLAB Compiler and MATLAB Compiler SDK that utilize CTF.
1. User could change the MCR_CACHE_ROOT manually
2. User could create a script file to launch the application. For instance, on Windows platform, user could create a batch file with below commands. The script uses date-time to name folder, so that folder name will be unique every time.
See Also
Categories
Find more on Get Started with MATLAB Compiler 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!