skip to main content
research-article

Balanced trees inhabiting functional parallel programming

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

Divide-and-conquer is an important technique in parallel programming. However, algebraic data structures do not fit divide-and-conquer parallelism. For example, the usual pointer-based implementation of lists cannot efficiently be divided at their middle, which prevents us from developing list-iterating divide-and-conquer parallel programs. Tree-iterating programs possibly face a similar problem, because trees might be ill-balanced and list-like shapes. This paper examines parallel programming based on balanced trees: we consider balanced-tree structures and develop recursive functions on them. By virtue of their balancing nature, either bottom-up or top-down recursive functions exploit divide-and-conquer parallelism. Our main contribution is to demonstrate the promise of this approach. We propose a way of systematically developing balanced trees from parallel algorithms, and then, we show that efficient parallel programs on them can be developed by equational reasoning powered by Reynolds' relational parametricity. We consider functions that operate either lists or binary trees, and show that our methods can uniformly deal with both cases. The developed parallel programs are purely functional, correct by construction, and sometimes even simpler than known algorithms.

Skip Supplemental Material Section

Supplemental Material

_talk11.mp4

References

  1. K. R. Abrahamson, N. Dadoun, D. G. Kirkpatrick, and T. M. Przytycka. A simple parallel tree contraction algorithm. J. Algorithms, 10 (2): 287--302, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. U. A. Acar, G. E. Blelloch, R. Harper, J. L. Vittes, and S. L. M. Woo. Dynamizing static algorithms, with applications to dynamic trees and history independence. In Proc. the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2004, pages 531--540. SIAM, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. P. Brent. The parallel evaluation of general arithmetic expressions. J. ACM, 21 (2): 201--206, 1974. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. W. Bent, D. D. Sleator, and R. E. Tarjan. Biased search trees. SIAM J. Comput., 14 (3): 545--568, 1985.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. S. Bird. An Introduction to the Theory of Lists. In Logic of Programming and Calculi of Discrete Design,volume 36 of NATO ASI Series F, pages 3--42. Springer-Verlag, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. G. E. Blelloch, J. C. Hardwick, J. Sipelstein, M. Zagha, and S. Chatterjee. Implementation of a portable nested data-parallel language. J. Parallel Distrib. Comput., 21 (1): 4--14, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. H.-J. Boehm, R. R. Atkinson, and M. F. Plass. Ropes: An alternative to strings. Softw., Pract. Exper. 25(12): 1315--1330, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. M. Burstall and J. Darlington. A transformation system for developing recursive programs. J. ACM, 24 (1): 44--67, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. W.-N. Chin, A. Takano, and Z. Hu. Parallelization via context preservation. In Proc. the 1998 International Conference on Computer Languages, ICCL '98, pages 153--162. IEEE Computer Society, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. I. Cole. Algorithmic Skeletons: Structural Management of Parallel Computation. MIT Press, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. N. A. Day, J. Launchbury, and J. Lewis. Logical abstractions in Haskell. In Proc. the 1999 Haskell Workshop. Utrecht University Department of Computer Science, Technical Report UU-CS-1999-28, October 1999.Google ScholarGoogle Scholar
  12. J. Dean and S. Ghemawat. MapReduce: Simplified data processing on large clusters. In Proc. 6th Symposium on Operating System Design and Implementation (OSDI 2004), pages 137--150. USENIX, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. Fluet, M. Rainey, J. H. Reppy, and A. Shaw Implicitly-threaded parallelism in Manticore. In Proc. the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP 2008, pages 119--130. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. G. N. Frederickson. A data structure for dynamically maintaining rooted trees. J. Algorithms, 24 (1): 37--65, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. H. Gazit, G. L. Miller, and S.-H. Teng. Optimal tree contraction in the EREW model. In Proc. the Princeton Workshop on Algorithms, Architectures, and Technology Issues for Models of Concurrent Computation, pages 139--156. Plenum Press, 1987.Google ScholarGoogle Scholar
  16. J. Gibbons, W. Cai, and D. B. Skillicorn. Efficient parallel algorithms for tree accumulations. Sci. Comput. Program., 23 (1): 1--18, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Z. Hu, H. Iwasaki, and M. Takeichi. Deriving structural hylomorphisms from recursive definitions. In Proc. the 1st ACM SIGPLAN International Conference on Functional Programming, ICFP'96, pages 73--82. ACM, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Z. Hu, H. Iwasaki, M. Takeichi, and A. Takano. Tupling calculation eliminates multiple data traversals. In Proc. the 2nd ACM SIGPLAN International Conference on Functional Programming, ICFP'97, pages 164--175. ACM, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Z. Hu, M. Takeichi, and W.-N. Chin. Parallelization in calculational forms. In POPL '98: Proc. the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 316--328. ACM, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Z. Hu, H. Iwasaki, and M. Takeichi. An accumulative parallel skeleton for all. In Programming Languages and Systems, 11th European Symposium on Programming, ESOP 2002, Proceedings, volume 2305 of Lecture Notes in Computer Science, pages 83--97. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. G. Keller, M. M. T. Chakravarty, R. Leshchinskiy, S. L. P. Jones, and B. Lippmeier. Regular, shape-polymorphic, parallel arrays in haskell. In Proc. the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP 2010, pages 261--272. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. D. Knuth. The Art of Computer Programming, volume 3. Addison Wesley Longman, second edition edition, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. R. Kosaraju and A. L. Delcher. Optimal parallel evaluation of tree-structured computations by raking. In VLSI Algorithms and Architectures, 3rd Aegean Workshop on Computing, AWOC 88, Proceedings, volume 319 of Lecture Notes in Computer Science, pages 101--110. Springer, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. Kühnemann, R. Glück, and K. Kakehi. Relating accumulative and non-accumulative functional programs. In Rewriting Techniques and Applications, 12th International Conference, RTA 2001, Proceedings, volume 2051 of Lecture Notes in Computer Science, pages 154--168. Springer, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. K. Matsuzaki. Efficient implementation of tree accumulations on distributed-memory parallel computers. In Computational Science - ICCS 2007, 7th International Conference, Proceedings, Part II, volume 4488 of Lecture Notes in Computer Science, pages 609--616. Springer, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. K. Matsuzaki, Z. Hu, and M. Takeichi. Towards automatic parallelization of tree reductions in dynamic programming. In SPAA 2006: Proc. the 18th Annual ACM Symposium on Parallel Algorithms and Architectures, pages 39--48. ACM, 2006a. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. K. Matsuzaki, Z. Hu, and M. Takeichi. Parallel skeletons for manipulating general trees. Parallel Comput., 32 (7--8): 590--603, 2006b. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. E. Meijer, M. M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming Languages and Computer Architecture, 5th ACM Conference, Proceedings, volume 523 of Lecture Notes in Computer Science, pages 124--144. Springer, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. G. L. Miller and J. H. Reif. Parallel tree contraction and its application. In 26th Annual Symposium on Foundations of Computer Science, pages 478--489. IEEE, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Morihata and K. Matsuzaki. Automatic parallelization of recursive functions using quantifier elimination. In Functional and Logic Programming, 10th International Symposium, FLOPS 2010, Proceedings, volume 6009 of Lecture Notes in Computer Science, pages 321--336. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. The third homomorphism theorem on trees: Downward & upward lead to divide-and-conquer. In Proc. the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pages 177--185. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. S. Peyton Jones, editor. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge, UK, 2003.Google ScholarGoogle Scholar
  33. S. L. Peyton Jones, R. Leshchinskiy, G. Keller, and M. M. T. Chakravarty. Harnessing the multicores: Nested data parallelism in haskell. In IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science, FSTTCS 2008, volume 08004 of Dagstuhl Seminar Proceedings. Internationales Begegnungs-und Forschungszentrum fuer Informatik (IBFI), 2008.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. J. H. Reif, editor. Synthesis of Parallel Algorithms. Morgan Kaufmann Publishers, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. J. C. Reynolds. Types, abstraction and parametric polymorphism. Inf. Process., 83: 513--523, 1983.Google ScholarGoogle Scholar
  36. D. B. Skillicorn. Structured parallel parallel computation in structured documents. J. UCS, 3 (1): 42--68, 1997.Google ScholarGoogle Scholar
  37. D. B. Skillicorn. Parallel implementation of tree skeletons. J. Parallel Distrib. Comput., 39 (2): 115--125, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. A. Takano and E. Meijer. Shortcut deforestation in calculational form. In Conference Record of FPCA'95: SIGPLAN-SIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture, pages 306--313. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. J. Voigtländer. Concatenate, reverse and map vanish for free. In Proc. the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP'02), pages 14--25, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. J. Voigtländer. Much ado about two (pearl): a pearl on parallel prefix computation. In Proc. the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pages 29--35. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. J. Voigtländer. Bidirectionalization for free! (pearl). In Proc. the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pages 165--176. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. P. Wadler. Theorems for free! In FPCA'89 Conference on Functional Programming Languages and Computer Architecture, pages 347--359. ACM, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. P. Wadler. Deforestation: Transforming programs to eliminate trees. Theor. Comput. Sci., 73 (2): 231--248, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Balanced trees inhabiting functional parallel programming

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!