Abstract
The goal of this paper is to develop a form of functional arrays (sequences) that are as efficient as imperative arrays, can be used in parallel, and have well defined cost-semantics. The key idea is to consider sequences with functional value semantics but non-functional cost semantics. Because the value semantics is functional, "updating" a sequence returns a new sequence. We allow operations on "older" sequences (called interior sequences) to be more expensive than operations on the "most recent" sequences (called leaf sequences).
We embed sequences in a language supporting fork-join parallelism. Due to the parallelism, operations can be interleaved non-deterministically, and, in conjunction with the different cost for interior and leaf sequences, this can lead to non-deterministic costs for a program. Consequently the costs of programs can be difficult to analyze. The main result is the derivation of a deterministic cost dynamics which makes analyzing the costs easier. The theorems are not specific to sequences and can be applied to other data types with different costs for operating on interior and leaf versions.
We present a wait-free concurrent implementation of sequences that requires constant work for accessing and updating leaf sequences, and logarithmic work for accessing and linear work for updating interior sequences. We sketch a proof of correctness for the sequence implementation. The key advantages of the present approach compared to current approaches is that our implementation requires no changes to existing programming languages, supports nested parallelism, and has well defined cost semantics. At the same time, it allows for functional implementations of algorithms such as depth-first search with the same asymptotic complexity as imperative implementations.
- A. Aasa, S. Holmström, and C. Nilsson. An efficiency comparison of some representations of purely functional arrays. BIT, 28(3):490–503, 1988. Google Scholar
Digital Library
- Z. M. Ariola, J. Maraist, M. Odersky, M. Felleisen, and P. Wadler. A call-byneed lambda calculus. In Proc. ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 233–246, 1995. Google Scholar
Digital Library
- L. Birkedal, F. Sieczkowski, and J. Thamsborg. A concurrent logical relation. In Computer Science Logic (CSL’12) - 26th International Workshop/21st Annual Conference of the EACSL, CSL 2012, September 3-6, 2012, Fontainebleau, France, pages 107–121, 2012.Google Scholar
- G. Blelloch and J. Greiner. Parallelism in sequential functional languages. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture, FPCA ’95, pages 226–237, 1995. Google Scholar
Digital Library
- G. E. Blelloch and J. Greiner. A provable time and space efficient implementation of nesl. In Proceedings of the First ACM SIGPLAN International Conference on Functional Programming, ICFP ’96, 1996. Google Scholar
Digital Library
- G. E. Blelloch and R. Harper. Cache and i/o efficent functional algorithms. In Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, pages 39–50, 2013. Google Scholar
Digital Library
- A. Bloss. Update analysis and the efficient implementation of functional aggregates. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, FPCA ’89, pages 26–38, New York, NY, USA, 1989. ACM. Google Scholar
Digital Library
- R. D. Blumofe and C. E. Leiserson. Scheduling multithreaded computations by work stealing. J. ACM, 46(5):720–748, Sept. 1999. Google Scholar
Digital Library
- R. P. Brent. The parallel evaluation of general arithmetic expressions. J. ACM, 21(2):201–206, Apr. 1974. Google Scholar
Digital Library
- T.-R. Chuang. Fully persistent arrays for efficient incremental updates and voluminous reads. In Symposium Proceedings on 4th European Symposium on Programming, ESOP’92, pages 110–129, London, UK, UK, 1992. Springer-Verlag. Google Scholar
Digital Library
- J. R. Driscoll, N. Sarnak, D. D. Sleator, and R. E. Tarjan. Making data structures persistent. J. Comput. Syst. Sci., 38(1), 1989. Google Scholar
Digital Library
- J. Girard. Linear logic. Theor. Comput. Sci., 50:1–102, 1987. Google Scholar
Digital Library
- J. Greiner and G. E. Blelloch. A provably time-efficient parallel implementation of full speculation. ACM Trans. Program. Lang. Syst., 21(2): 240–285, Mar. 1999. Google Scholar
Digital Library
- J. C. Guzmán and P. Hudak. Single-threaded polymorphic lambda calculus. In Proc. Symposium on Logic in Computer Science (LICS), pages 333– 343, 1990.Google Scholar
Cross Ref
- P. R. Harper. Practical Foundations for Programming Languages. Cambridge University Press, New York, NY, USA, 2012. Google Scholar
Digital Library
- R. Harper. Practical Foundations for Programming Languages, 2nd edition. Cambridge University Press, 2016. Google Scholar
Cross Ref
- M. P. Herlihy. Impossibility and universality results for wait-free synchronization. In Proceedings of the Seventh Annual ACM Symposium on Principles of Distributed Computing, PODC ’88, pages 276–290, 1988. Google Scholar
Digital Library
- M. P. Herlihy and J. M. Wing. Linearizability: A correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst., 12(3):463–492, July 1990. Google Scholar
Digital Library
- P. Hudak. A semantic model of reference counting and its abstraction (detailed summary). In Proceedings of the 1986 ACM Conference on LISP and Functional Programming, LFP ’86, pages 351–363, New York, NY, USA, 1986. ACM. Google Scholar
Digital Library
- P. Hudak and A. G. Bloss. The aggregate update problem in functional programming systems. In ACM Symposium on Principles of Programming Languages (POPL), pages 300–314, 1985. Google Scholar
Digital Library
- G. F. Italiano and N. Sarnak. Fully persistent data structures for disjoint set union problems, pages 449–460. Springer Berlin Heidelberg, 1991.Google Scholar
- C. B. Jones. Tentative steps toward a development method for interfering programs. ACM Trans. Program. Lang. Syst., 5(4):596–619, Oct. 1983. Google Scholar
Digital Library
- E. Moggi. Computational lambda-calculus and monads. In Proc. Symposium on Logic in Computer Science (LICS), pages 14–23, 1989. Google Scholar
Digital Library
- A. J. Turon, J. Thamsborg, A. Ahmed, L. Birkedal, and D. Dreyer. Logical relations for fine-grained concurrency. In The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, Rome, Italy - January 23 - 25, 2013, pages 343–356, 2013. Google Scholar
Digital Library
- P. Wadler. Linear types can change the world! In PROGRAMMING CONCEPTS AND METHODS. North, 1990.Google Scholar
- P. Wadler. Monads for functional programming. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques-Tutorial Text, pages 24–52, London, UK, UK, 1995. Springer-Verlag. Google Scholar
Digital Library
Index Terms
Parallel functional arrays
Recommendations
Parallel functional arrays
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesThe goal of this paper is to develop a form of functional arrays (sequences) that are as efficient as imperative arrays, can be used in parallel, and have well defined cost-semantics. The key idea is to consider sequences with functional value ...
Formally based profiling for higher-order functional languages
We present the first source-level profiler for a compiled, nonstrict, higher-order, purely functional language capable of measuring time as well as space usage. Our profiler is implemented in a production-quality optimizing compiler for Haskell and can ...
Multi-phase array redistribution: modeling and evaluation
IPPS '95: Proceedings of the 9th International Symposium on Parallel ProcessingArray redistribution is used in languages such as High Performance Fortran to allow programmers to dynamically change the distribution of arrays across processors. Distributed-memory implementations of several scientific applications require array ...







Comments