skip to main content
research-article

A short cut to parallelization theorems

Published:25 September 2013Publication History
Skip Abstract Section

Abstract

The third list-homomorphism theorem states that if a function is both foldr and foldl, it has a divide-and-conquer parallel implementation as well. In this paper, we develop a theory for obtaining such parallelization theorems. The key is a new proof of the third list-homomorphism theorem based on shortcut deforestation. The proof implies that there exists a divide-and-conquer parallel program of the form of h(x 'merge' y) = h1 x odot h2 y, where h is the subject of parallelization, merge is the operation of integrating independent substructures, h1 and h2 are computations applied to substructures, possibly in parallel, and odot merges the results calculated for substructures, if (i) h can be specified by two certain forms of iterative programs, and (ii) merge can be implemented by a function of a certain polymorphic type. Therefore, when requirement (ii) is fulfilled, h has a divide-and-conquer implementation if h has two certain forms of implementations. We show that our approach is applicable to structure-consuming operations by catamorphisms (folds), structure-generating operations by anamorphisms (unfolds), and their generalizations called hylomorphisms.

References

  1. R. S. Bird and S. A. Curtis. Functional pearls: Finding celebrities: A lesson in functional programming. J. Funct. Program., 16(1):13--20, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. S. Bird and O. de Moor. Algebra of Programming. Prentice Hall, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Y.-Y. Chi and S.-C. Mu. Constructing list homomorphisms from proofs. In Programming Languages and Systems - 9th Asian Symposium, APLAS 2011, Proceedings, volume 7078 of Lecture Notes in Computer Science, pages 74--88. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W.-N. Chin, A. Takano, and Z. Hu. Parallelization via context preservation. In Proceedings of the 1998 International Conference on Computer Languages, ICCL '98, pages 153--162. IEEE, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. O. Chitil. Type inference builds a short cut to deforestation. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, ICFP'99, pages 249--260. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. M. Fokkinga. Tupling and mutumorphisms. Squiggolist, 1(4), 1989.Google ScholarGoogle Scholar
  7. A. Geser and S. Gorlatch. Parallelizing functional programs by generalization. J. Funct. Program., 9(6):649--673, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. N. Ghani and P. Johann. Monadic augment and generalised short cut fusion. J. Funct. Program., 17(6):731--776, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. Gibbons. The third homomorphism theorem. J. Funct. Program., 6(4): 657--665, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  10. J. Gibbons, Computing downwards accumulations on trees quickly. Theor. Comput. Sci., 169(1):67--80, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Gibbons, G. Hutton, and T. Altenkirch. When is a function a fold or an unfold? Electr. Notes Theor. Comput. Sci., 44(1):146--160, 2001.Google ScholarGoogle ScholarCross RefCross Ref
  12. A. Gill. Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Department of Computing Science, Glasgow University, 1996.Google ScholarGoogle Scholar
  13. A. Gill, J. Launchbury, and S. Peyton Jones. A short cut to deforestation. In FPCA'93 Conference on Functional Programming Languages and Computer Architecture, pages 223--232. ACM, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Gorlatch. Extracting and implementing list homomorphisms in parallel program development. Sci. Comput. Program., 33(1):1--27, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Hinze. Adjoint folds and unfolds--an extended study. Sci. Comput. Program., 2013. In Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Z. Hu, H. Iwasaki, and M. Takechi. Formal derivation of efficient parallel programs by construction of list homomorphisms. ACMTrans. Program. Lang. Syst., 3(19):444--461, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Z. Hu, M. Takeichi, and W.-N. Chin. Parallelization in calculational forms. In POPL '98: Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 316--328. ACM, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. P. Huet. The zipper. J. Funct. Program., 7(5):549--554, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. Johann. A generalization of short-cut fusion and its correctness proof. Higher-Order and Symbolic Computation, 15(4):273--300, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. S. Katsumata and S. Nishimura. Algebraic fusion of functions with an accumulating parameter and its improvement. J. Funct. Program., 18 (5-6):781--819, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. G. Keller and M. M. T. Chakravarty. Flattening trees. Euro-Par '98 Parallel Processing, 4th International Euro-Par Conference, Proceedings, volume 1470 of Lecture Notes in Computer Science, pages 709--719. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. J. Launchbury and T. Sheard. Warm fusion: Deriving build-catas from recursive definitions. In Conference Record of FPCA'95 SIGPLANSIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture, pages 314--323. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Y. Liu, Z. Hu, and K. Matsuzaki. Towards systematic parallel programming over MapReduce. In Parallel Processing - 17th International Conference, Euro-Par 2011, Proceedings, Part II, volume 6853 of Lecture Notes in Computer Science, pages 39--50. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. Malcolm. Data structures and program transformation. Sci. Comput. Program., 14(2-3):255--279, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. K. Matsuzaki, Z. Hu, and M. Takeichi. Towards automatic parallelization of tree reductions in dynamic programming. In SPAA 2006: Proceedings of the 18th Annual ACM Symposium on Parallel Algorithms and Architectures, pages 39--48. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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
  27. J. Misra. Powerlist: A structure for parallel recursion. ACM Trans. Program. Lang. Syst., 16(6):1737--1767, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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
  29. A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. The third homomorphism theorem on trees: Downward & upward lead to divide-andconquer. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pages 177--185. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. K. Morita, A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. Automatic inversion generates divide-and-conquer parallel programs. In Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation, pages 146--155. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. S.-C. Mu and A. Morihata. Generalising and dualising the third listhomomorphism theorem: functional pearl. In Proceeding of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP 2011, pages 385--391. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. J. H. Reif, editor. Synthesis of Parallel Algorithms. Morgan Kaufmann Publishers, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. J. C. Reynolds. Types, abstraction and parametric polymorphism. Information Processing, 83:513--523, 1983.Google ScholarGoogle Scholar
  34. J. Svenningsson. Shortcut fusion for accumulating parameters & zip-like functions. In Proceedings of the 7th ACM SIGPLAN International Conference on Functional programming, ICFP'02, pages 124--132. ACM, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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
  36. P. Wadler. Deforestation: Transforming programs to eliminate trees. In ESOP'88, 2nd European Symposium on Programming, Proceedings, volume 300 of Lecture Notes in Computer Science, pages 344--358. Springer, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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
  38. D. N. Xu, S.-C. Khoo, and Z. Hu. PType system: A featherweight parallelizability detector. In Programming Languages and Systems: Second Asian Symposium, APLAS 2004, Proceedings, volume 3302 of Lecture Notes in Computer Science, pages 197--212. Springer, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  39. T. Yokoyama, Z. Hu, and M. Takeichi. Calculation rules for warming-up in fusion transformation. In On-line Pre-Review Processings of the Sixth Symposium on Trends in Functional Programming, TFP 2005, pages 399--412, 2005.Google ScholarGoogle Scholar

Index Terms

  1. A short cut to parallelization theorems

        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!