Abstract
Operator overloading in Matlab allows for user-defined types to semantically augment existing Matlab codes without changes. However, given sufficient knowledge about types and operand semantics, operator overloading can be replaced by equivalent function calls. The ADiMat software tool provides automatic differentiation of Matlab functions using a hybrid approach that combines source transformation and operator overloading. It can also be used as a general framework for user-defined transformations of Matlab codes. Tests showed the potential for performance improvement in a derivative class providing essential linear algebra functionality for ADiMat. The Matlab runtime environment was benchmarked regarding function and method call overheads as well as property access overhead with Matlab’s objects. These tests identify the access to class properties of type cell array as the main performance culprit. Hence, an automatic method, transforming the XML based abstract syntax tree created with ADiMat’s toolchain through a set of stylesheets, was developed. This process completely removes the derivative object usage and hence the operator overloading and the property access overhead from any derivative function created with ADiMat. Experimental results show that performance is improved considerably depending on the data container storing the derivative directions.
This work was partially performed while the author “Johannes Willkomm” was employed at TU Darmstadt.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
From the Matlab documentation: ”A cell array is a data type with indexed data containers called cells, where each cell can contain any type of data.”
- 2.
From the release note of R2008a: ”JIT/Accelerator support provides significantly improved performance over the previous object oriented-programming system.”
References
Arsac, J.J.: Syntactic source to source transforms and program manipulation. Commun. ACM 22(1), 43–54 (1979)
Aslam, A., Hendren, L.: McFLAT: a profile-based framework for MATLAB loop analysis and transformations. In: Cooper, K., Mellor-Crummey, J., Sarkar, V. (eds.) Languages and Compilers for Parallel Computing. Lecture Notes in Computer Science, vol. 6548, pp. 1–15. Springer, Berlin/Heidelberg (2011). doi:10.1007/978-3-642-19595-2∖_1. http://www.dx.doi.org/10.1007/978-3-642-19595-2_1
Bischof, C., Bücker, H.M., Lang, B., Rasch, A., Vehreschild, A.: combining source transformation and operator overloading techniques to compute derivatives for MATLAB programs. In: Proceedings of the 2nd IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2002), pp. 65–72. IEEE Computer Society (2002)
Buble, A., Bulej, L., Tuma, P.: CORBA benchmarking: a course with hidden obstacles. In: Parallel and Distributed Processing Symposium, 2003. Proceedings. International, pp. 6–pp. IEEE (2003)
Bulej, L., Kalibera, T., Tuma, P.: Regression benchmarking with simple middleware benchmarks. In: IEEE International Conference on Performance, Computing, and Communications, 2004, pp. 771–776. IEEE (2004)
Casey, A., Li, J., Doherty, J., Chevalier-Boisvert, M., Aslam, T., Dubrau, A., Lameed, N., Aslam, A., Garg, R., Radpour, S., Belanger, O.S., Hendren, L., Verbrugge, C.: McLab: an extensible compiler toolkit for MATLAB and related languages. In: Proceedings of the 3rd C* Conference on Computer Science and Software Engineering, C3S2E ’10, pp. 114–117. ACM, New York, NY (2010). doi:10.1145/1822327.1822343. http://doi.acm.org/10.1145/1822327.1822343
Chauveau, S., Bodin, F.: Menhir: an environment for high performance Matlab. In: Languages, Compilers, and Run-Time Systems for Scalable Computers, pp. 27–40. Springer, Berlin (1998)
Clark, J.: Xsl transformations (XSLT). World Wide Web Consortium (W3C). http://www.w3.org/TR/xslt (1999)
De Rose, L., Padua, D.: A MATLAB to Fortran 90 translator and its effectiveness. In: Proceedings of the 10th International Conference on Supercomputing, pp. 309–316. ACM (1996)
Dubrau, A.W., Hendren, L.J.: Taming MATLAB. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, pp. 503–522. ACM (2012)
Getreuer, P.: Writing fast MATLAB code. http://www.getreuer.info/matopt.pdf (2009)
Griewank, A., Walther, A.: Evaluating Derivatives, 2nd edn. Society for Industrial and Applied Mathematics (SIAM), Philadelphia (2008). doi:10.1137/1.9780898717761. http://www.epubs.siam.org/doi/abs/10.1137/1.9780898717761
Jin, S., Xin, Z.: The relaxation schemes for systems of conservation laws in arbitrary space dimensions. Commun. Pure Appl. Math. 48(3), 235–276 (1995)
Li, X.: Mc2For: a Matlab to Fortran 95 compiler. Ph.D. thesis, McGill University (2014)
Loveman, D.B.: Program improvement by source-to-source transformation. J. ACM (JACM) 24(1), 121–145 (1977)
MathWorks: Accelerating MATLAB - The MATLAB JIT-Accelerator. http://www.ee.columbia.edu/~marios/matlab/accel_matlab.pdf (2002)
MathWorks: Improvements to tic and toc Functions for Measuring Absolute Elapsed Time Performance in MATLAB. http://www.mathworks.com/tagteam/68600_91934v00_TicToc.pdf (2011)
MathWorks: MATLAB Object-Oriented Programming. Tech. Report (2013). https://www.mathworks.com/help/pdf_doc/matlab/matlab_oop.pdf
Menon, V., Pingali, K.: A case for source-level transformations in MATLAB. In: ACM SIGPLAN Notices, vol. 35, pp. 53–65. ACM (1999)
Radpour, S., Hendren, L., Schäfer, M.: Refactoring MATLAB. In: Jhala, R., Bosschere, K. (eds.) Compiler Construction. Lecture Notes in Computer Science, vol. 7791, pp. 224–243. Springer, Berlin/Heidelberg (2013). doi:10.1007/978-3-642-37051-9∖_12. http://www.dx.doi.org/10.1007/978-3-642-37051-9_12
Schordan, M., Quinlan, D.: A source-to-source architecture for user-defined optimizations. In: Böszörményi, L., Schojer, P. (eds.) Modular Programming Languages. Lecture Notes in Computer Science, vol. 2789, pp. 214–223. Springer, Berlin/Heidelberg (2003)
Shure, L.: Considering performance in object-oriented MATLAB code. Technical Report, MathWorks (2012). http://www.blogs.mathworks.com/loren/2012/03/26/considering-performance-in-object-oriented-matlab-code/
Willkomm, J., Bischof, C., Bücker, H.M.: The new user interface of ADiMat and how to use it with DAE solvers in Matlab and Octave. In: ICCE 2011 Conference (2011). http://www.sc.rwth-aachen.de/adimat/willkomm-handout-12th-euro-ad.pdf
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Hück, A., Willkomm, J., Bischof, C. (2015). Source Transformation for the Optimized Utilization of the Matlab Runtime System for Automatic Differentiation. In: Mehl, M., Bischoff, M., Schäfer, M. (eds) Recent Trends in Computational Engineering - CE2014. Lecture Notes in Computational Science and Engineering, vol 105. Springer, Cham. https://doi.org/10.1007/978-3-319-22997-3_7
Download citation
DOI: https://doi.org/10.1007/978-3-319-22997-3_7
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-22996-6
Online ISBN: 978-3-319-22997-3
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)