ABSTRACT
We present a new programming model for deterministic parallel computation in a pure functional language. The model is monadic and has explicit granularity, but allows dynamic construction of dataflow networks that are scheduled at runtime, while remaining deterministic and pure. The implementation is based on monadic concurrency, which has until now only been used to simulate concurrency in functional languages, rather than to provide parallelism. We present the API with its semantics, and argue that parallel execution is deterministic. Furthermore, we present a complete work-stealing scheduler implemented as a Haskell library, and we show that it performs at least as well as the existing parallel programming models in Haskell.
Supplemental Material
- Arvind, Rishiyur S. Nikhil, and Keshav K. Pingali. I-structures: data structures for parallel computing. ACM Trans. Program. Lang. Syst., 11: 598--632, October 1989. Google ScholarDigital Library
- Clem Baker-Finch, David J. King, and Phil Trinder. An operational semantics for parallel lazy evaluation. In Proceedings of the fifth ACM SIGPLAN international conference on Functional programming, ICFP '00, pages 162--173, 2000. Google ScholarDigital Library
- Robert D. Blumofe, Christopher F. Joerg, Bradley C. Kuszmaul, Charles E. Leiserson, Keith H. Randall, and Yuli Zhou. Cilk: an efficient multithreaded runtime system. In Proceedings of the fifth ACM SIGPLAN symposium on Principles and practice of parallel programming, pages 207--216, 1995. Google ScholarDigital Library
- Zoran Budimlic, Michael Burke, Vincent Cave, Kathleen Knobe, Geoff Lowney, Ryan Newton, Jens Palsberg, David Peixotto, Vivek Sarkar, Frank Schlimbach, and Sagnak Tasirlar. The CnC programming model. Journal of Scientific Programming, 2010.Google Scholar
- Vincent Cavé, Zoran Budimlić, and Vivek Sarkar. Comparing the usability of library vs. language approaches to task parallelism. In Evaluation and Usability of Programming Languages and Tools, PLATEAU '10, pages 9:1--9:6. ACM, 2010. Google ScholarDigital Library
- M. Chakravarty, R. Leshchinskiy, S. Peyton Jones, G. Keller, and S. Marlow. Data Parallel Haskell: a status report. In DAMP'07 -- Workshop on Declarative Aspects of Multicore Programming. ACM Press, 2007. Google ScholarDigital Library
- Koen Claessen. A poor man's concurrency monad. Journal of Functional Programming, 9: 313--323, May 1999. Google ScholarDigital Library
- Murray Cole. Algorithmic Skeletons: structured management of parallel computation. MIT Press, 1989. Google ScholarDigital Library
- Matthew Fluet, Mike Rainey, John Reppy, Adam Shaw, and Yingqi Xiao. Manticore: a heterogeneous parallel language. In Proceedings of the 2007 workshop on Declarative aspects of multicore programming, pages 37--44, 2007. Google ScholarDigital Library
- M. I. Gordon et al. Exploiting coarse-grained task, data, and pipeline parallelism in stream programs. In ASPLOS-XII: Proceedings of the 12th international conference on Architectural support for programming languages and operating systems, pages 151--162, 2006. Google ScholarDigital Library
- John Launchbury and Simon L. Peyton Jones. Lazy functional state threads. In Proceedings of the ACM SIGPLAN 1994 conference on Programming language design and implementation, pages 24--35, 1994. Google ScholarDigital Library
- Edward A. Lee and Thomas M. Parks. Readings in hardware/software co-design. chapter Dataflow process networks, pages 59--85. Kluwer Academic Publishers, 2002. Google ScholarDigital Library
- Peng Li and Steve Zdancewic. Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. In Proceedings of the 2007 ACM SIGPLAN conference on Programming language design and implementation, PLDI '07, pages 189--199, 2007. Google ScholarDigital Library
- Simon Marlow, Patrick Maier, Hans-Wolfgang Loidl, Mustafa K. Aswad, and Phil Trinder. Seq no more: better strategies for parallel Haskell. In Proceedings of the third ACM Haskell symposium on Haskell, pages 91--102, 2010. Google ScholarDigital Library
- Derek Gordon Murray and Steven Hand. Scripting the cloud with Skywriting. In HotCloud '10: Proceedings of the Second Workshop on Hot Topics in Cloud Computing, Berkeley, CA, USA, 2010. USENIX. Google ScholarDigital Library
- Rishiyur Arvind Nikhil. Implicit parallel programming in pH. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 2001. ISBN 1-55860-644-0.Google Scholar
- John Reppy, Claudio V. Russo, and Yingqi Xiao. Parallel concurrent ML. In Proceedings of the 14th ACM SIGPLAN international conference on Functional programming, pages 257--268, 2009. Google ScholarDigital Library
- Enno Scholz. A concurrency monad based on constructor primitives, or, being first-class is not enough. Technical report, Universität Berlin, 1995.Google Scholar
- Daniel John Spoonhower. Scheduling deterministric parallel programs. PhD thesis, Carnegie Mellon University, 2009.Google Scholar
- PW Trinder, K Hammond, H-W Loidl, and SL Peyton Jones. Algorithm + strategy = parallelism. 8: 23--60, January 1998. Google ScholarDigital Library
Index Terms
- A monad for deterministic parallelism
Recommendations
A monad for deterministic parallelism
Haskell '11We present a new programming model for deterministic parallel computation in a pure functional language. The model is monadic and has explicit granularity, but allows dynamic construction of dataflow networks that are scheduled at runtime, while ...
Layout-sensitive language extensibility with SugarHaskell
Haskell '12: Proceedings of the 2012 Haskell SymposiumProgrammers need convenient syntax to write elegant and concise programs. Consequently, the Haskell standard provides syntactic sugar for some scenarios (e.g., do notation for monadic code), authors of Haskell compilers provide syntactic sugar for more ...
Bringing back monad comprehensions
Haskell '11: Proceedings of the 4th ACM symposium on HaskellThis paper is about a Glasgow Haskell Compiler (GHC) extension that generalises Haskell's list comprehension notation to monads. The monad comprehension notation implemented by the extension supports generator and filter clauses, as was the case in the ...
Comments