Decrease compilation time with mex using compiler cache (e.g. ccache in Linux)
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am using the Matlab codegen command quite often to decrease the runtime of my Matlab functions and compile them as mex. However, when working on my algorithm, I often need to recompile my functions in between my tests and validations. This takes up to 5min for complex functions which decreases my productivity.
Does anyone have experience using a compiler cache such as ccache (I am using Ubuntu 18.04) together with Matlab (R2021a)? I did a first attempt to implement this, but the compilation time did not really decrease, despite that ccache is used.
Workflow so far:
- Install ccache (Ubuntu 18.04): sudo apt install ccache
- use ccache for all compilers: sudo /usr/sbin/update-ccache-symlinks
- call Matlab with ccache path: PATH="/usr/lib/ccache/:$PATH" matlab
- check path in Matlab: !echo $PATH gives /usr/lib/ccache/:/home/username/bin:....
- compile a function using the Matlab codegen command (with wrapper matlabfcn2mex)
That ccache is used can be seen in the buildLog.log file (in fcndir/codegen/mex/fcnname/build/glnxa64). Alle lines begin with /usr/lib/ccache/gcc instead of /usr/bin/gcc as before. The ccache statistics (ccache -s) gives increased values for "cache hit (direct)" and "cache hit (preprocessed)" after each call of codegen in Matlab. For my example file (6 DoF serial robot inverse kinematics using Newton Raphson) I still need around 120s, despite the file is not changed and should be fully in the cache. Without the cache the time is around the same. I would expect a drastic decrease of compilation time, as can be seen when using ccache+cmake e.g. in building a ROS workspace.
Any ideas or comments?
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Troubleshooting in MATLAB Compiler SDK in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!