Skip to main content

Source Transformation for the Optimized Utilization of the Matlab Runtime System for Automatic Differentiation

  • Chapter
Recent Trends in Computational Engineering - CE2014

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 2.

    From the release note of R2008a: ”JIT/Accelerator support provides significantly improved performance over the previous object oriented-programming system.”

References

  1. Arsac, J.J.: Syntactic source to source transforms and program manipulation. Commun. ACM 22(1), 43–54 (1979)

    Article  MATH  Google Scholar 

  2. 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

  3. 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)

    Google Scholar 

  4. 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)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. 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

  7. 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)

    Google Scholar 

  8. Clark, J.: Xsl transformations (XSLT). World Wide Web Consortium (W3C). http://www.w3.org/TR/xslt (1999)

  9. 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)

    Google Scholar 

  10. 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)

    Google Scholar 

  11. Getreuer, P.: Writing fast MATLAB code. http://www.getreuer.info/matopt.pdf (2009)

  12. 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

  13. 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)

    Article  MATH  MathSciNet  Google Scholar 

  14. Li, X.: Mc2For: a Matlab to Fortran 95 compiler. Ph.D. thesis, McGill University (2014)

    Google Scholar 

  15. Loveman, D.B.: Program improvement by source-to-source transformation. J. ACM (JACM) 24(1), 121–145 (1977)

    Google Scholar 

  16. MathWorks: Accelerating MATLAB - The MATLAB JIT-Accelerator. http://www.ee.columbia.edu/~marios/matlab/accel_matlab.pdf (2002)

  17. 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)

  18. MathWorks: MATLAB Object-Oriented Programming. Tech. Report (2013). https://www.mathworks.com/help/pdf_doc/matlab/matlab_oop.pdf

  19. Menon, V., Pingali, K.: A case for source-level transformations in MATLAB. In: ACM SIGPLAN Notices, vol. 35, pp. 53–65. ACM (1999)

    Google Scholar 

  20. 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

  21. 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)

    Chapter  Google Scholar 

  22. 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/

  23. 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

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexander Hück .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics