We give an in-depth introduction to the design of our functional array programming language SaC, the main aspects of its compilation into host machine code, and its parallelisation based on multi-threading. The language design of SaC aims at combining high-level, compositional array programming with fully automatic resource management for highly productive code development and maintenance. We outline the compilation process that maps SaC programs to computing machinery. Here, our focus is on optimisation techniques that aim at restructuring entire applications from nested compositions of general fine-grained operations into specialised coarse-grained operations. We present our implicit parallelisation technology for shared memory architectures based on multi-threading and discuss further optimisation opportunities on this level of code generation. Both optimisation and parallelisation rigorously exploit the absence of side-effects and the explicit data flow characteristic of a functional setting.
Article PDF
Similar content being viewed by others
Avoid common mistakes on your manuscript.
References
High Performance Fortran Forum: High Performance Fortran Language Specification V2.0. (1997).
Chamberlain B., Choi S.E., Lewis E., Lin C., Snyder L., Weathersby W(2000) ZPL: A Machine Independent Programming Language for Parallel Computers. IEEE Transactions on Software Engineering 26:197–211
Cann D.(1992) Retire Fortran? A Debate Rekindled. Communications of the ACM, 35:81–89
Dagum L., Menon R.(1998) OpenMP: An Industry-Standard API for Shared-Memory Programming. IEEE Transactions on Computational Science and Engineering, 5:46–55
Zima H., Chapman B.(1991). Supercompilers for Parallel and Vector Computers. Addison-Wesley, Reading, Massachusetts, USA
Wolfe M. (1995). High-Performance Compilers for Parallel Computing. Addison-Wesley, Reading, Massachusetts, USA
R. Saavedra, W. Mao, D. Park, J. Chame, and S. Moon, The Combined Effectiveness of Unimodular Transformations, Tiling, and Software Prefetching, In Proceedings of the 10th International Parallel Processing Symposium (IPPS’96), Honolulu, Hawaii, USA, pp. 39–45 (1996).
Chamberlain B., Lewis E., Lin C., Snyder L.(1999) Regions: An Abstraction for Expressing Array Computation. In: Levefre O(eds). Proceedings of the International Conference on Array Processing Languages (APL’99). Scranton, Pennsylvania, USA. Volume 29 of APL Quote Quad., ACM Press pp. 41–49
R. Allen, and K. Kennedy, Optimizing Compilers for Modern Architectures. Morgan Kaufmann Publishers (2001).
H. Zima, High-Level Programming Support for HPC – The Tradeoff between Elegance and Performance In Proceedings of the 19th International Supercomputer Conference (ISC’01), Heidelberg, Germany (2001).
Jones S.P.(2003). Haskell 98 Language and Libraries. Cambridge University Press, Cambridge UK
Plasmeijer M., van Eekelen M.(2001). Concurrent Clean 2.0 Language Report. University of Nijmegen, The Netherlands
van Groningen J.(1997). The Implementation and Efficiency of Arrays in Clean 1.1, In: Kluge W.(eds). Proceedings of the 8th :International Workshop on Implementation of Functional Languages (IFL’96), Bonn, Germany, Selected Papers, Volume 1268 of Lecture Notes in Computer Science. Springer-Verlag, Berlin Germany, pp. 105–124
P. Serrarens, Implementing the Conjugate Gradient Algorithm in a Functional Language, In W. Kluge (ed.), Proceedings of the 8th International Workshop on of Functional Languages (IFL’96), Bonn, Germany, Selected Papers, Volume 1268 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany pp. 125–140 (1997).
T. Zörner, Numerical Analysis and Functional Programming, In K. Hammond, T. Davie, and C. Clack (eds.), Proceedings of the 10th International Workshop on Implementation of Functional Languages (IFL’98), London, UK, University College, London, UK, pp. 27–48 (1998).
M. M. Chakravarty, and G. Keller, An Approach to Fast Arrays in Haskell, In J. Jeuring, and S. P. Jones (eds.), Summer School and Workshop on Advanced Functional Programming, Oxford, England, UK, (2002), Volume 2638 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany pp. 27–58 (2003).
P. Hartel, and K. Langendoen, Benchmarking Implementations of Lazy Functional Languages, In Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA’93), Copenhagen, Denmark, ACM Press, New york, pp. 341–349 (1993).
Hartel P. et al (1996) Benchmarking Implementations of Functional Languages with “Pseudo- knot”, a Float-Intensive Benchmark. Journal of Functional Programming 6:621–655
Hammes J., Sur S., öhm W.B(1997) On the Effectiveness of Functional Language Features: NAS Benchmark FT. Journal of Functional Programming 7:103–123
P. Hudak, and A. Bloss, The Aggregate Update Problem in Functional Programming Systems, In Proceedings of the 12th ACM Symposium on Principles of Programming Languages (POPL’85), New Orleans, Louisiana, USA, ACM Press, New York, pp. 300–313 (1985).
E. Barendsen, and S. Smetsers, Uniqueness Type Inference, In M. Hermenegildo, and S. Swierstra (eds.), Proceedings of the 7th International Symposium on Programming Language Implementation and Logic Programming (PLILP’95), Utrecht, The Netherlands, Volume 982 of Lecture Notes in Computer Science., Springer-Verlag, Berlin, Germany, pp. 189–206 (1995).
P. Wadler, The Essence of Functional Programming, In Proceedings of the 19th ACM Symposium on Principles of Programming Languages (POPL’92), Albuquerque, New Mexico, USA, ACM Press, New York, pp. 1–14 (1992).
Milner R., Tofte M., Harper R.(1990). The Definition of Standard ML. MIT Press, Cambridge, Massachusetts, USA
Falkoff A., Iverson K.(1973) The Design of APL. IBM Journal of Research and Development 17:324–334
Scholz S.B.(2003) Single Assignment C—Efficient Support for High-Level Array Operations in a Functional Setting. Journal of Functional Programming 13:1005–1059
Jenkins M.(1989) Q’Nial: A Portable Interpreter for the Nested Interactive Array Language Nial. Software Practice and Experience 19:111–126
Iverson K.(1991). Programming in J. Iverson Software Inc., Toronto, Canada
S. B. Scholz, A Case Study: Effects of WITH-Loop Folding on the NAS Benchmark MG in SAC, In K. Hammond, T. Davie, and C. Clack (eds.), Proceedings of the 10th International Workshop on Implementation of Functional Languages (IFL’98), London, UK, Selected Papers, Volume 1595 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany, pp. 216–228 (1999).
C. Grelck, S. B. Scholz, and K. Trojahner, With-Loop Scalarization: Merging Nested Array Operations, In P. Trinder, G. Michaelson (eds.), Proceedings of the 15th International Workshop on Implementation of Functional Languages (IFL’03), Edinburgh, Scotland, UK, Revised Selected Papers, Volume 3145 of Lecture Notes in Computer , Springer-Verlag, Berlin, Germany (2004).
C. Grelck, K. Hinckfuß, S. B. Scholz, With-Loop Fusion for Data Locality and Parallelism, In A. Butterfield (ed.), Implementation and Application of Functional Languages, 17th International Workshop (IFL’05), Dublin, Ireland. Volume 4015 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany (2006).
C. Grelck, Shared Memory Multiprocessor Support for SAC, In K. Hammond, T. Davie, and C. Clack (eds.), Proceedings of the 10th International Workshop on Implementation of Functional Languages (IFL’98), London, UK, Selected Papers, Volume 1595 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany, pp. 38–54 (1999).
C. Grelck, A Multithreaded Compiler Backend for High-Level Array Programming, In M. Hamza (ed.), Proceedings of the 21st International Multi-Conference on Applied Informatics (AI’03), Part II: International Conference on Parallel and Distributed Computing and Networks (PDCN’03), Innsbruck, Austria, ACTA Press, Anaheim, California, USA, pp. 478–484 (2003).
Grelck C.(2005) Shared Memory Multiprocessor Support for Functional Array Processing in SAC. Journal of Functional Programming 15:353–401
C. Grelck, and S. B. Scholz, HPF vs. SAC—A Case Study, In A. Bode, T. Ludwig, W. Karl, and R. Wismüller (eds.), Proceedings of the 6th European Conference on Parallel Processing (Euro-Par’00), Munich, Germany, Volume 1900 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany, pp. 620–624 (2000).
Grelck C., Scholz S.B.(2003) Towards an Efficient Functional Implementation of the NAS Benchmark FT. In: Malyshkin V.(eds). Proceedings of the 7th International Conference on Parallel Computing Technologies (PaCT’03). Springer-Verlag, Berlin Germany pp. 230–235
A. Shafarenko, S. B. Scholz, S. Herhut, C. Grelck, and K. Trojahner, Implementing a Numerical Solution for the KPI Equation using Single Assignment C: Lessons and Experience, In A. Butterfield, (ed.), Implementation and Application of Functional Languages, 17th International Workshop (IFL’05), Dublin, Ireland. Volume 4015 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, Germany (2006).
H. Barendregt, The Lambda Calculus, Its Syntax and Semantics, Volume 103 of Studies in Logics and the Foundations of Mathematics. North Holland, Amsterdam, The Netherlands (1981).
Cann D.C.(1989). Compilation Techniques for High Performance Applicative Computation. Technical Report CS-89-108. Lawrence Livermore National Laboratory, Livermore, California, USA
C. Grelck, and K. Trojahner, Implicit Memory Management for SaC, In C. Grelck, and F. Huch (eds.), Implementation and Application of Functional Languages, 16th International Workshop, IFL’04, University of Kiel, pp. 335–348 (2004).
Jenkins M., Falster P. (1999). Array Theory and NIAL. Technical Report 157. Technical University of Denmark, ELTEK, Lyngby, Denmark
Appel A.(1998) SSA is Functional Programming. ACM SIGPLAN Notices 33:17–20
Grelck C., Kreye D., Scholz S.B. (2000) On Code Generation for Multi-Generator WITH-Loops in SAC. In: Koopman P., Clack C. (eds). Proceedings of the 11th International Workshop on Implementation of Functional Languages (IFL’99). Lochem, The Netherlands, pp. 77–94
Achten P., Plasmeijer M. (1995) The Ins and Outs of Clean I/O. Journal of Functional Programming 5:81–110
Grelck C., Scholz S.B.(1995) Classes and Objects as Basis for I/O in SAC. In: Johnsson T. (eds). Proceedings of the 7th International Workshop on Implementation of Functional Languages (IFL’95). Chalmers University of Technology, Sweden, pp. 30–44
Grelck C.(2002) Optimizations on Array Skeletons in a Shared Memory Environment. In: Arts T., Mohnen M. (eds). Proceedings of the 13th International Workshop on Implementation of Functional Languages (IFL’01). Springer-Verlag, Berlin,zGermany, pp. 36–54
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Grelck, C., Scholz, SB. SAC—A Functional Array Language for Efficient Multi-threaded Execution. Int J Parallel Prog 34, 383–427 (2006). https://doi.org/10.1007/s10766-006-0018-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10766-006-0018-x