Abstract
Construction of complex array operations by composition of more basic ones allows for abstract and concise specifications of algorithms. Unfortunately, naïve compilation of such specifications leads to creation of many temporary arrays at runtime and, consequently, to poor performance characteristics.
This paper elaborates on a new compiler optimization, named with-loop-scalarization, which aims at eliminating temporary arrays in the context of nested array operations. It is based on with-loops, a versatile array comprehension construct used by the functional array language SaC both for specification as well as for internal representation of array operations.
The impact of with-loop-scalarization on the runtime performance of compiled SaC code is demonstrated by several experiments involving support for arithmetic on arrays of complex numbers and the application kernel FT from the NAS benchmark suite.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Abrams, P.S.: An APL Machine. SLAC 114, Stanford Linear Accelerator Center (1970)
Anderson, S., Hudak, P.: Compilation of Haskell Array Comprehensions for Scientific Computing. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 1990), White Plains, New York, USA. SIGPLAN Notices, vol. 25, pp. 137–149. ACM Press, New York (1990)
Bailey, D.H., Barszcz, E., Barton, J.T., Browning, D.S., Carter, R.L., Dagum, L., Fatoohi, R.A., Frederickson, P.O., Lasinski, T.A., Schreiber, T.A., Simon, R.S., Venkatakrishnam, V., Weeratunga, S.K.: The NAS Parallel Benchmarks. International Journal of Supercomputer Applications 5(3), 63–73 (1991)
Bernecky, R.: APEX: The APL Parallel Executor. Master’s thesis, University of Toronto, Toronto, Canada (1997)
Blelloch, G.E.: NESL: A Nested Data-Parallel Language (Version 3.1). Technical Report CMU-CS-95-170, Carnegie Mellon University, Pittsburgh, Pennsylvania, USA (1995)
Blelloch, G.E., Sabot, G.W.: Compiling Collection-Oriented Languages onto Massively Parallel Computers. Journal of Parallel and Distributed Computing 8(2), 119–134 (1990)
Budd, T.: An APL Compiler. Springer, Berlin (1988)
Chakravarty, M.M.T., Keller, G.: Functional Array Fusion. In: Proceedings of the 6th ACM SIGPLAN International Conference on Functional Programming (ICFP 2001), Florence, Italy, pp. 205–216. ACM Press, New York (2001)
Chakravarty, M.M.T., Keller, G.: An Approach to Fast Arrays in Haskell. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, pp. 27–58. Springer, Heidelberg (2003)
Chamberlain, B.L., Choi, S.-E., Lewis, C., Snyder, L., Weathersby, W.D., Lin, C.: The Case for High-Level Parallel Programming in ZPL. IEEE Computational Science and Engineering 5(3) (1998)
Chin, W.N.: Safe Fusion of Functional Expressions II: Further Improvements. Journal of Functional Programming 4(4), 515–550 (1994)
Gill, A.: Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Glasgow University, Glasgow, Scotland, UK (1996)
Gill, A., Launchbury, J., Peyton Jones, S.L.: A Short Cut to Deforestation. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA 1993), Copenhagen, Denmark, pp. 223–232. ACM Press, New York (1993)
Grelck, C.: Implementing the NAS Benchmark MG in SAC. In: Proceedings of the 16th International Parallel and Distributed Processing Symposium (IPDPS 2002), Fort Lauderdale, Florida, USA, IEEE Computer Society Press, Los Alamitos (2002)
Grelck, C., Kreye, D., Scholz, S.-B.: On Code Generation for Multi-Generator WITH-Loops in SAC. In: Koopman, P., Clack, C. (eds.) IFL 1999. LNCS, vol. 1868, pp. 77–94. Springer, Heidelberg (2000)
Grelck, C., Scholz, S.-B.: Axis Control in SAC. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 182–198. Springer, Heidelberg (2003)
Grelck, C., Scholz, S.-B.: Towards an Efficient Functional Implementation of the NAS Benchmark FT. In: Malyshkin, V.E. (ed.) PaCT 2003. LNCS, vol. 2763, pp. 230–235. Springer, Heidelberg (2003)
Hammes, J., Sur, S., Böhm, W.: On the Effectiveness of Functional Language Features: NAS Benchmark FT. Journal of Functional Programming 7(1), 103–123 (1997)
International Standards Organization. Programming Language APL, Extended. ISO N93.03, ISO (1993)
Iverson, K.E.: J. Introduction and Dictionary. Iverson Software Inc., Toronto, Canada (1995)
Jenkins, M.A., Jenkins, W.H.: The Q’Nial Language and Reference Manual. Nial Systems Ltd., Ottawa (1993)
McGraw, J.R., Skedzielewski, S.K., Allan, S.J., Oldehoeft, R.R., et al.: Sisal: Streams and Iteration in a Single Assignment Language: Reference Manual Version 1.2. M 146, Lawrence Livermore National Laboratory, Livermore, California, USA (1985)
Oldehoeft, R.R.: Implementing Arrays in SISAL 2.0. In: Proceedings of the 2nd SISAL Users Conference, San Diego, California, USA, pp. 209–222. Lawrence Livermore National Laboratory (1992)
Scholz, S.-B.: With-loop-folding in SAC — Condensing Consecutive Array Operations. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, pp. 72–92. Springer, Heidelberg (1998)
Scholz, S.-B.: A Case Study: Effects of WITH-Loop Folding on the NAS Benchmark MG in SAC. In: Hammond, K., Davie, T., Clack, C. (eds.) IFL 1998. LNCS, vol. 1595, pp. 216–228. Springer, Heidelberg (1999)
Scholz, S.-B.: Single Assignment C — Efficient Support for High-Level Array Operations in a Functional Setting. Journal of Functional Programming 13(6), 1005–1059 (2003)
van Arkel, D., van Groningen, J., Smetsers, S.: Fusion in Practice. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 51–67. Springer, Heidelberg (2003)
van Groningen, J.: The Implementation and Efficiency of Arrays in Clean 1.1. In: Kluge, W.E. (ed.) IFL 1996. LNCS, vol. 1268, pp. 105–124. Springer, Heidelberg (1997)
Wadler, P.: Deforestation: Transforming Programs to Eliminate Trees. Theoretical Computer Science 73(2), 231–248 (1990)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Grelck, C., Scholz, SB., Trojahner, K. (2004). With-Loop Scalarization – Merging Nested Array Operations. In: Trinder, P., Michaelson, G.J., Peña, R. (eds) Implementation of Functional Languages. IFL 2003. Lecture Notes in Computer Science, vol 3145. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27861-0_8
Download citation
DOI: https://doi.org/10.1007/978-3-540-27861-0_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-23727-3
Online ISBN: 978-3-540-27861-0
eBook Packages: Computer ScienceComputer Science (R0)