|
|
The Impact of Dynamic Data Reshaping on Adjoint Code Generation for Weakly-Typed Languages Such as Matlab-
incollection
- | |
|
Author(s)
Johannes Willkomm
, Christian H. Bischof
, H. Martin Bücker
|
Published in Recent Advances in Algorithmic Differentiation
|
Editor(s) Shaun Forth, Paul Hovland, Eric Phipps, Jean Utke, Andrea Walther |
Year 2012 |
Publisher Springer |
Abstract Productivity-oriented programming languages typically emphasize convenience over syntactic rigor. A well-known example is Matlab, which employs a weak type system to allow the user to assign arbitrary types and shapes to a variable, and it provides various shortcuts in programming that result in implicit data reshapings. Examples are scalar expansion, where a scalar is implicitly expanded to a matrix of the appropriate size filled with copies of the scalar value, the use of row vectors in place of column vectors and vice versa, and the automatic expansion of arrays when indices outside of the previously allocated range are referenced. These features need to be addressed at runtime when generating adjoint code, as Matlab does not provide required information about types, shapes and conversions at compile time. This fact, and the greater scope of reshaping possible, is a main distinguishing feature of Matlab compared to traditional programming languages, some of which, e.g. Fortran 90, also support vector expressions. In this paper, in the context of the ADiMat source transformation tool for Matlab, we develop techniques generally applicable for adjoint code generation in the face of dynamic data reshapings occurring both on the left- and right-hand side of assignments. Experiments show that in this fashion correct adjoint code can be generated also for very dynamic language scenarios at moderate additional cost. |
Cross-References Forth2012RAi |
AD Tools ADiMat |
BibTeX
@INCOLLECTION{
Willkomm2012TIo,
title = "The Impact of Dynamic Data Reshaping on Adjoint Code Generation for Weakly-Typed
Languages Such as {M}atlab",
doi = "10.1007/978-3-642-30023-3_12",
author = "Johannes Willkomm and Christian H. Bischof and H. Martin B{\"u}cker",
abstract = "Productivity-oriented programming languages typically emphasize convenience over
syntactic rigor. A well-known example is Matlab, which employs a weak type system to allow the user
to assign arbitrary types and shapes to a variable, and it provides various shortcuts in programming
that result in implicit data reshapings. Examples are scalar expansion, where a scalar is implicitly
expanded to a matrix of the appropriate size filled with copies of the scalar value, the use of row
vectors in place of column vectors and vice versa, and the automatic expansion of arrays when
indices outside of the previously allocated range are referenced. These features need to be
addressed at runtime when generating adjoint code, as Matlab does not provide required information
about types, shapes and conversions at compile time. This fact, and the greater scope of reshaping
possible, is a main distinguishing feature of Matlab compared to traditional programming languages,
some of which, e.g. Fortran 90, also support vector expressions. In this paper, in the context of
the AdiMAT source transformation tool for Matlab, we develop techniques generally applicable for
adjoint code generation in the face of dynamic data reshapings occurring both on the left- and
right-hand side of assignments. Experiments show that in this fashion correct adjoint code can be
generated also for very dynamic language scenarios at moderate additional cost.",
pages = "127--138",
crossref = "Forth2012RAi",
booktitle = "Recent Advances in Algorithmic Differentiation",
series = "Lecture Notes in Computational Science and Engineering",
publisher = "Springer",
address = "Berlin",
volume = "87",
editor = "Shaun Forth and Paul Hovland and Eric Phipps and Jean Utke and Andrea Walther",
isbn = "978-3-540-68935-5",
issn = "1439-7358",
year = "2012",
ad_tools = "ADiMat"
}
| |
back
|
|