Monday, April 5, 2010

How to solve MCR cache access problems on a cluster

Often when I run compiled matlab applications on a cluster, I get the error message

"Could not access the MCR component cache."

This tends to happen because matlab is not able to access the MCE cache directory. By default this happens to be your home directory. When a large number of compiled matlab programs are starting off/running simultaneously (e.g. you submit a job array), the load on the file system is too great giving rise to the problem.

The simplest way to solve this problem, if to point the MCR_CACHE_ROOT environment variable to a local temporary directory on each node on the cluster.


This redirects the cache to a temp directory that is able to handle the traffic.


Experiencing Life said...

hi, I found your post interesting. can you give me more details on how to point the enviroment variable to a local directory? I suppose I need to edit certain file on each node. am I right?

Anshul said...

No you dont need to do that. In your job submit script you just need a line that says

export MCR_CACHE_ROOT=[tmpdirname]

where tmpdirname is the path to a local temporary directory

Some clusters automatically create local temporary directories on each node which is normally stored in an environment variable such as $TMPDIR or $TMP or $TEMPDIR. You will need to check how your cluster is configured.

Another easy option is to simply create a temporary directory in your submit script

mkdir $TMPDIR
[Call your matlab script/function]
rm -rf $TMPDIR

Nam Gi VU said...

Thank you! Your post is helpful to my situation - using Matlab compiled stuffs in Ubuntu 11 Natty

Eddie said...

hye, i wanna ask you how bout if i use window n netbean? do Isolve it?

richard said...

Thanks. This helped me diagnose a problem with some legacy software where the "MCR_CACHE_ROOT" was hardcoded to a non-standard location.